Commit Graph

5506 Commits

Author SHA1 Message Date
Corinna Vinschen ba31e832be * fhandler.cc (ACCFLAGS): Remove macro.
(fhandler_base::get_default_fmode): Use O_ACCMODE instead of ACCFLAGS
	and or'ed read/write flags.
	(fhandler_base::open_9x): Use O_ACCMODE instead of or'ed read/write
	flags.
	(fhandler_base::open): Ditto.
	* fhandler_disk_file.cc (fhandler_base::open_fs): Ditto.
	* fhandler_mem.cc (fhandler_dev_mem::open): Ditto.
	* fhandler_raw.cc (fhandler_dev_raw::open): Ditto.
2005-12-14 16:38:22 +00:00
Corinna Vinschen e3d14af155 * fhandler.cc (fhandler_base::open_9x): Handle O_SYNC and O_DIRECT
flags.
	(fhandler_base::open): Ditto.
	* fhandler_floppy.cc (fhandler_dev_floppy::open): Don't allocate devbuf
	in O_DIRECT case.
	* fhandler_raw.cc (fhandler_dev_raw::ioctl): Don't allow buffer
	changes in O_DIRECT case.  Allow returning a buffer size 0, which
	indicates O_DIRECT.
	* fhandler_tape.cc (fhandler_dev_tape::open): Use O_SYNC flag to
	hand down the !buffer_writes case.  Don't allocate devbuf in O_DIRECT
	case.
	(fhandler_dev_tape::raw_read): Don't mess with devbuf if it's NULL.
	* include/fcntl.h: Define _FDIRECT, O_DIRECT, O_DSYNC and O_RSYNC.
	* include/cygwin/version.h: Bump API minor version.
2005-12-14 15:54:33 +00:00
Christopher Faylor 2c8fd40695 * cygtls.cc (_cygtls::remove): Don't bother if we're exiting.
* sigproc.cc (_cygtls::remove_wq): Ditto.
2005-12-13 16:01:57 +00:00
Christopher Faylor 1f3a4b8496 * fhandler_tty.cc (fhandler_tty::open): Enhance comment. 2005-12-13 14:47:18 +00:00
Corinna Vinschen 4c848934fe * fhandler_tty.cc (fhandler_tty::open): Close newly created window
station after switching to original window station.
2005-12-13 09:07:12 +00:00
Christopher Faylor 82f423291b * fhandler_tty.cc (fhandler_tty::open): Add a comment. 2005-12-13 05:43:30 +00:00
Joshua Daniel Franklin 3220aed354 * faq-programming.xml: Add note about struct stat64. 2005-12-13 05:32:43 +00:00
Christopher Faylor 56b5372519 * times.cc (hires_ms::usecs): Subtract from slop from system time or we'll
always end up priming the pump.
2005-12-13 02:55:11 +00:00
Christopher Faylor d090ee8081 * times.cc (systime): Correct precision referenced in comment.
* fhandler_tty.cc (fhandler_tty_slave::open): Don't free original windows
station since that will cause strange problems displaying fonts.  Reset windows
station to original station after creating console.
* times.cc (hires_ms::usecs): Only reprime when calculated time is less than
system time.
2005-12-13 02:02:51 +00:00
Christopher Faylor becfe4e93e * include/winuser.h (WINSTA_ALL_ACCESS): Define. 2005-12-13 01:24:36 +00:00
Christopher Faylor 678a9510df * pinfo.cc (winpids::add): Don't copy procinfo when there is no cygwin process
associated with the pid, i.e., procinfo == NULL.
2005-12-13 00:54:32 +00:00
Christopher Faylor c9da5a2183 * times.cc (hires_ms::usecs): Correct order when checking if high precision
time is <= current time.
2005-12-13 00:43:46 +00:00
Christopher Faylor a300f5fd14 correct ChangeLog 2005-12-12 19:10:02 +00:00
Christopher Faylor 363934dc9b * pinfo.cc (size_copied): New convenience macro.
(winpids::add): Alias the element that we are working on for slightly better
clarity.  Honor the "make_copy" flag.
(winpids::release): Free and zero procinfo field if it was allocated via
malloc.
(winpids::~winpids): Free copied array.
* pinfo.h (class pinfo): Make winpids class a friend.
(winpids::make_copy): New field.
(winpids::copied): New array.
(winpids::reset): Reset npids after releasing pinfos or suffer a memory leak.
(winpids::winpids): Try harder to allocate all fields in the class.
2005-12-12 18:43:31 +00:00
Corinna Vinschen 75a22c880a * autoload.cc (GetSystemTimes): Remove. 2005-12-12 14:27:16 +00:00
Corinna Vinschen e96abae130 * fhandler_proc.cc (format_proc_uptime): Drop usage of GetSystemTimes.
Use NtQuerySystemInformation to evaluate uptime and idle_time from
	all CPU's processor times.  Fallback to GetTickCount.
2005-12-12 12:18:14 +00:00
Corinna Vinschen 2193d02b4d * mmap.cc (gen_create_protect): Always generate WRITECOPY protection
for private maps.
	(fixup_mmaps_after_fork): Fix calculation of WRITECOPY protection for
	VirtualProtect.  Add some words to the comment.
2005-12-12 10:00:32 +00:00
Christopher Faylor 4e8e54543e * winsup.api/ltp/dup03.c (cleanup): Fix longstanding off-by-one error when
setting array element to -1.
2005-12-11 22:31:00 +00:00
Christopher Faylor 4989ff286d fix typo. 2005-12-11 17:30:53 +00:00
Christopher Faylor 9b020020ec * dirent.h: Change the rest of the d_ino's to __deprecated_d_ino. 2005-12-10 23:25:24 +00:00
Christopher Faylor 3ab689126c * malloc.cc: Update to version 2.8.3.
* cygmalloc.h (MSPACE): Remove unneeded definition.
2005-12-10 17:09:58 +00:00
Danny Smith 3f8edcbdb1 * lib/kernel32.def (CreateFiberEx): Correct suffix. 2005-12-09 07:49:40 +00:00
Danny Smith 4d6c08adfe 2005-12-09 Huw Davies <hdavies@users.sourceforge.net>
Danny Smith <dannysmith@users.sourceforge.net>

	* lib/msxml-uuid.c: New file to generate UUIDs for
	MSXML interfaces.
	* lib/Makefile.in (UUID_OBJS): Add msxml-uuid.o.

Add missing ChangeLog entries for 2005-12-07 commits.
2005-12-09 04:59:24 +00:00
Corinna Vinschen 7d6fde96de * fhandler_raw.cc (fhandler_dev_raw::ioctl): Only allow 0, 1 or a
multiple of 512 as new buffersize.
2005-12-08 10:55:29 +00:00
Corinna Vinschen ddd62ccbd4 * fhandler_socket.cc (fhandler_socket::recvfrom): Mask flags with
MSG_WINMASK for Windows socket calls.
	(fhandler_socket::recvmsg): Ditto.
	(fhandler_socket::sendmsg): Ditto.
2005-12-08 10:13:57 +00:00
Christopher Faylor 6c9a5ebbfc * hires.h (hires_ms::initime_ms): Delete.
(hires_ms::initime_us): Just define as LONGLONG.
(hires_ms::uptime): New function.
* select.cc (select_stuff::wait): Use gtod for timing to attempt to avoid
windows 32 bit wraparound.
* times.cc (systime): New function.
(times): Replace GetTickCount with gtod.uptime.
(hires_us::prime): Use systime() to calculate system time rather than calling
GetSystemTimeAsFileTime directly.
(hires_ms::prime): Ditto.  Eliminate initime_ms.
(hires_ms::usecs): Try harder to detect wraparound.
* fhandler_proc.cc (format_proc_partitions): Set drive_size to zero to avoid a
compiler warning.
2005-12-07 22:28:49 +00:00
Corinna Vinschen c09178b052 * fhandler_proc.cc (format_proc_partitions): Use modern IOCTLs
to determine drive size as far as possible.
2005-12-07 20:32:27 +00:00
Danny Smith 14d2d90cff * include/winbase.h (GetDevicePowerState): Add prototype.
* lib/kernel32.def (GetDevicePowerState): Correct suffix.
2005-12-07 20:27:09 +00:00
Danny Smith 8696d63606 2005-12-07 Brian Gunlogson <gmb300@users.sourceforge.net>
* include/winuser.h (GetClassLongPtr{AW}): Guard prototypes with _WIN64.
	Define as macro if !_WIN64.
	(SetClassLongPtr{AW}): Likewise.
	(GCLP_*): Add GetClassLongPtr defines.
	* lib/user32.def (GetClassLongPtr{AW}): Remove stubs.
	(SetClassLongPtr{AW}): Likewise.
2005-12-07 20:17:39 +00:00
Corinna Vinschen db58e35d94 * fhandler_raw.cc (fhandler_dev_raw::ioctl): Fix INVALID_PARAMETER
condition.  Only copy devbuf to buf if buf is non-NULL.
2005-12-07 19:01:29 +00:00
Corinna Vinschen bb4e8382c5 * fhandler_raw.cc (fhandler_dev_raw::ioctl): Fix setting devbuf
when rd_parm is 0 or 1.
2005-12-07 18:35:29 +00:00
Corinna Vinschen 46bcbf8ce0 * fhandler_floppy.cc (fhandler_dev_floppy::lseek): Fix test for
valid file position at EOM.
2005-12-07 18:11:10 +00:00
Christopher Faylor 383840a908 * include/cygwin/stdlib.h: Guard compilation of *unsetenv* in newlib. 2005-12-07 15:17:43 +00:00
Corinna Vinschen 5a101414ed * exceptions.cc (_cygtls::handle_exceptions): In case of a
STATUS_ACCESS_VIOLATION, check if the page is a mmaped page beyond
	a file's EOF.  Generate SIGBUS instead of SIGSEGV then.
	* mmap.cc (__PROT_ATTACH): New define.
	(__PROT_FILLER): Ditto.
	(fh_anonymous): Rename from fh_paging_file;
	(fh_disk_file): New global static variable.
	(attached): New inline function.
	(filler): Ditto.
	(gen_create_protect): Split off from gen_protect to use the file's
	access mode to create mapping always with maximum allowed protections.
	(gen_protect): Accomodate pages attached beyond EOF.  Use symbolic
	values instead of numerics when possible.  Drop create parameter.
	(gen_access): Use file's access mode instead of protection.
	(CreateMapping9x): Create named mapping names so that different
	creation access modes result in different mappings.
	(CreateMappingNT): Only reserve attached pages, don't commit them.
	(MapViewNT): Ditto.  Set AT_ROUND_TO_PAGE for all non-NULL base
	addresses.
	(mmap_func_t): Define CreateMapping and MapView function pointers
	with additional openflags parameter.
	(class mmap_record): Add openflags member.
	(mmap_record::mmap_record): Add openflags parameter.
	(mmap_record::get_openflags): New accessor.
	(mmap_record::attached): Call global attached function.
	(mmap_record::filler): Call global filler function.
	(mmap_record::gen_create_protect): Call global gen_create_protect
	function.
	(mmap_record::gen_protect): Drop create parameter.
	(mmap_record::alloc_fh): Set fhandler's access flags.
	(list::search_record): Accomodate filler pages.
	(list::set): Use inode number as hash value.
	(map::get_list_by_fd): Check hash value against file's inode number.
	(mmap_is_attached_page): New function to evaluate if a given address
	is on a attached page.  Called from _cygtls::handle_exceptions.
	(mmap_worker): New function to do mapping and bookkeeping in a
	single call.
	(mmap64): Use roundup2 to round length to pagesize alignment.
	Initialize global fhandlers.  Simplify anonymous initialization.
	Add SUSv3 compatible check of file open mode vs. requested protection.
	Try creating new file handles to allow maximum page protection.
	Allow creating attached pages in case of mapping beyond EOF.
	Close new file handle if one has been created.
	(munmap): Align len to pagesize.
	(msync): Rework argument checks. Align len to pagesize.
	(mprotect): Ditto.  Accomodate attached pages.
	(mlock): Use roundup/rounddown macros instead of homemade expressions.
	(munlock): Add page alignment as in mlock.
	(fhandler_dev_zero::munmap): Fix unmapping of non-private mappings.
	(fhandler_dev_zero::fixup_mmap_after_fork): Accomodate filler pages.
	(fixup_mmaps_after_fork): Don't fail if attached pages couldn't be
	created in child.  Avoid superfluous call to VirtualFree.  Check for
	original allocation protection to fix PAGE_WRITECOPY protection.
	* ntdll.h: Revert deletion of AT_ROUND_TO_PAGE define.
	* winsup.h (mmap_is_attached_page): Declare.
2005-12-07 11:16:47 +00:00
Christopher Faylor e5a0cf2415 * include/cygwin/stdlib.h: New file.
* environ.cc (unsetenv): Change to return -1 on input error.
* include/cygwin/version.h: Add more description to latest api bump.
2005-12-05 22:30:03 +00:00
Christopher Faylor c34aee9b23 * dir.cc (readdir_workdir): Only fill out d_ino when linked into older app.
* include/cygwin/version.h: Bump api minor number to 147, reflecting
obsolescence of d_ino.
(CYGWIN_VERSION_USER_API_VERSION_COMBINED): New convenience macro.
(CYGWIN_VERSION_CHECK_FOR_NEEDS_D_INO): New convenience macro.
2005-12-05 21:02:53 +00:00
Christopher Faylor 4535b5961f revert accidental checkin 2005-12-05 20:30:40 +00:00
Christopher Faylor 09b0109620 Remove unneeded whitespace.
* cygtls.cc (_cygtls::set_state): Delete.
(_cygtls::reset_exception): Ditto.
(_cygtls::init_thread): Set initialized state directly here.
(_cygtls::push): Remove exception argument.  Don't treat exceptions specially.
* cygtls.h (_cygtls::push): Ditto.
(_cygtls::isinitialized): Don't treat exceptions specially.
(_cygtls::reset_exception): Delete.
(_cygtls::set_state): Ditto.
(_cygtls::handle_exceptions): Don't push ebp on the stack prior to calling
sig_send.  Just set incyg instead.
(_cygtls::interrupt_setup): Accommodate _cygtls::push argument change.
(_cygtls::interrupt_now): Ditto.
(setup_handler): Don't treat exceptions specially.
* gendef (longjmp): Always zero incyg flag.
2005-12-05 20:20:18 +00:00
Christopher Faylor 801d6cc753 * strace.cc (show_usecs): Renamed from 'usecs'.
(main): Use show_usecs rather than usecs.  Toggle delta if '-u' is specified.
(handle_output_debug_string): Avoid printing microsecond timestamp if
show_usecs == 0.
* utils.sgml (strace): Add words to describe '-u'.
2005-12-05 16:39:06 +00:00
Corinna Vinschen 9fc0d14410 * environ.cc (spenvs): Add "windir" as an "always export" variable
to accomodate WinSock on Windows 95.
2005-12-04 21:47:03 +00:00
Christopher Faylor 3829215776 fix description 2005-12-04 19:24:10 +00:00
Joshua Daniel Franklin 33cf0e5519 * faq-setup.xml: Add note about clean_setup.pl.
* faq-using.xml: Remove unnecessary line of elisp.
2005-12-04 03:55:28 +00:00
Christopher Faylor 49085f6f16 * include/exceptions.h (exception_list): Revert previous change. Windows
doesn't care.
(exception_handler): Use real exception_list parameter type rather than void *
* tlsoffsets.h: Regenerate.
* cygtls.h (_cygtls::handle_exceptions): Use real exception_list parameter type
rather than void *.
(handle_threadlist_exception): Ditto.
(init_exception_handler): Ditto.
* cygtls.cc (_cygtls::handle_threadlist_exception ): Ditto.
(_cygtls::init_exception_handler): Add kludge to terminate linked list with a
loop, which seems to solve problem of RtlUnwind causing problems
* exceptions.cc (rtl_unwind): Use real exception_list parameter type rather
than void *.
(_cygtls::handle_exceptions): Ditto.
2005-12-03 05:01:51 +00:00
Christopher Faylor 087f4a61d2 Add missing ChangeLog entry. 2005-12-03 04:24:34 +00:00
Christopher Faylor f153e6b280 * cygtls.h (_cygtls::el): New field.
(_cygtls::handle_exceptions): New function declaration.
(_cygtls::handle_threadlist_exception): Ditto.
(_cygtls::init_exception_handler): Ditto.
(_cygtls::init_threadlist_exceptions): Remove arg from declaration.
* cygtls.cc (_cygtls::call2): Don't initialize exceptions here.
(_cygtls::init_thread): Do it here instead and use member function.
(_cygtls::handle_threadlist_exception): Move into _cygtls class.
(_cygtls::init_exception_handler): Ditto.  Rely on existence of 'el' memmber in
_cygtls.
(_cygtls::init_threadlist_exceptions): Ditto.
* dcrt0.cc (dll_crt0_1): Remove exception_list definition and setting since it
now commonly resides in the tls.
* exceptions.cc (init_exception_handler): Move to cygtls.cc.
(init_exceptions): Ditto.
(rtl_unwind): New, safe wrapper function for RtlUnwind.
(_cygtls::handle_exceptions): Move to _cygtls.  Call rtl_unwind to unwind
frames and eliminate copying of structures.  Put address of failing instruction
in si_addr, not the address on the stack.  Return 0 to indicate that we've
handled this exception.
* external.cc (cygwin_internal): Make CW_INIT_EXCEPTIONS a no-op.
* sigproc.cc (wait_sig): Accommodate argument change to
_cygtls::init_threadlist_exceptions.
* tlsoffsets.h: Regenerate.
* include/exceptions.h (exception_list): Add more stuff to the exception list.
Apparently windows needs this?
(init_exceptions): Remove bogus declaration.
* include/cygwin/signal.h (SI_USER): Redefine as zero as per SUSv3.
* thread.cc (pthread_kill): Set si_pid and si_uid.
* timer.cc (timer_thread): Set si_code to SI_TIMER.
2005-12-03 04:23:35 +00:00
Christopher Faylor e7f6a31bb0 * dcrt0.cc (getstack): Try harder to modify memory.
(alloc_stack): Alloc page prior to stack top, too.
2005-12-02 03:12:06 +00:00
Christopher Faylor 032295a988 * devices.h (_major): Revert previous ill-advised change.
(_minor): Ditto.
2005-12-02 00:37:21 +00:00
Christopher Faylor 8b3c84227f * exceptions.cc (handle_exceptions): Translate a guard page exception to a
"SIGBUS".
2005-12-01 20:52:00 +00:00
Corinna Vinschen b534221080 * mmap.cc: Make debug output more consistently. Fix some comments.
(gen_protect): Convert to inline function.
	(gen_access): Ditto.
	(mmap_record::gen_protect): Add create parameter as in global function.
	(mmap_record::alloc_page_map): Change condition so that always the
	correct protection setting is set after mapping has been established.
	(mmap64): For anonymous mappings set offset always to 0.
	(fixup_mmaps_after_fork): Always call fixup_mmap_after_fork method
	with the MAP_FIXED flag set.
2005-12-01 20:35:13 +00:00
Christopher Faylor c57b13f9f8 * devices.h (_minor): Coerce argument to proper type before manipulating.
(_major): Ditto.
(device::is_fs_special): New function.
* fhandler_disk_file.cc (fhandler_base::fstat_helper): Set the size to 0 for
devices rather than reporting the size of the symlink.
(fhandler_disk_file::readdir): Use is_fs_special to determine if .lnk should be
stripped.
* path.cc: Rename symlink_info::is_symlink to symlink_info::issymlink
throughout.
(symlink_info::isdevice): New field.
(path_conv::check): Use 'isdevice' to determine if just-parsed entity is a
device rather than relying on non-zero major/minor.
(symlink_info::parse_device): Set isdevice to true if we've discovered a
device.
(symlink_info::check): Clear isdevice field prior to processing.  Use isdevice
to control debugging output.
(symlink_info::set): Set isdevice to false.
* path.h (path_conv::is_fs_special): New function.
* devices.cc: Regenerate.
2005-12-01 17:33:59 +00:00