Commit Graph

4584 Commits

Author SHA1 Message Date
Eric Blake 3f6f9155c9 * exceptions.cc (handle_exceptions): Set si_addr according to
POSIX for SIGSEGV.
2009-07-23 02:47:17 +00:00
Corinna Vinschen d974d420d4 * mount.cc (fs_info::update): Open filesystem with access set to 0.
Explain why.
2009-07-22 18:49:48 +00:00
Corinna Vinschen c9b8019225 * mount.cc: Revert accidental checkin. 2009-07-22 18:27:47 +00:00
Corinna Vinschen c45871c9c5 * path.cc (symlink_info::check): Handle STATUS_NOT_SUPPORTED from
NtCreateFile just like STATUS_EAS_NOT_SUPPORTED.
2009-07-22 18:21:09 +00:00
Corinna Vinschen 6c188691db * mount.cc (fillout_mntent): Fix typo (noexec -> notexec). 2009-07-22 16:21:33 +00:00
Corinna Vinschen ffea27fc8d * path.cc (symlink_info::check): Fix typo in comment. 2009-07-22 15:55:47 +00:00
Corinna Vinschen 4a77aea071 * fhandler.h (enum del_lock_called_from): New enumeration.
(fhandler_base::del_my_locks): Declare taking a del_lock_called_from
	as argument.
	* fhandler.cc (fhandler_base::close): Call del_my_locks with "on_close".
	(fhandler_base::fixup_after_fork): Call del_my_locks with "after_fork".
	(fhandler_base::fixup_after_exec): Call del_my_locks with "after_exec".
	* flock.cc (fhandler_base::del_my_locks): Take del_lock_called_from
	as argument.  Call node->del_my_locks with NULL handle in after_exec
	case.  Explain why.
2009-07-22 15:46:36 +00:00
Corinna Vinschen a7b11fec84 * dtable.cc (dup2): Correct return value for no-op. 2009-07-21 13:29:00 +00:00
Corinna Vinschen b48215aae0 * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Add special case
for MVFS.  Explain why.
	(fhandler_disk_file::utimens): Drop local variables lastaccess and
	lastwrite.  Copy timestamps right into FILE_BASIC_INFORMATION structure
	to avoid copying them twice.
2009-07-21 08:10:36 +00:00
Corinna Vinschen 20fc2f4936 * wincap.h (wincaps::has_always_all_codepages): New element.
* wincap.cc: Implement above element throughout.
	* wchar.h (__sjis_mbtowc): Declare.
	(__eucjp_mbtowc): Ditto.
	(__gbk_mbtowc): Ditto.
	(__kr_mbtowc): Ditto.
	(__big5_mbtowc): Ditto.
	* syscalls.cc (internal_setlocale): Convert to char * function.
	Return parameter by default.  Return NULL if request to use a
	charset can't be satisfied due to missing codepage support in the
	underlying OS.  Fix comment.
	(setlocale): Store original locale.  Restore to original locale if
	internal_setlocale returns NULL.
2009-07-20 15:44:55 +00:00
Corinna Vinschen 637a1aec8f * fork.cc (fork): Create local tmp_pathbuf. Explain why. 2009-07-20 14:16:06 +00:00
Christopher Faylor acced2cea2 * exceptions.cc (sig_handle_tty_stop): Set stopsig to SIGCONT when continuing.
(stopped_or_terminated): Honor WCONTINUED.
* wait.cc (wait4): Ditto.
* include/cygwin/wait.h (WCONTINUED): Define.
(__W_CONTINUED): Ditto.
(WIFCONTINUED): Ditto.
2009-07-18 20:25:07 +00:00
Dave Korn c627d4ddd0 * libstdcxx_wrapper.cc (operator delete): Remove stray space in
asm name.
2009-07-17 23:37:05 +00:00
Christopher Faylor 486a2c9610 * cygtls.cc (_cygtls::init_exception_handler): Test for e, not e->prev or we
could still end up adding our handler twice.  Add comment explaining what we're
doing.
* dll_init.cc (dll_dllcrt0_1): Clarify comment.
2009-07-17 18:17:11 +00:00
Christopher Faylor d2445fa2cc * cygtls.cc (_cygtls::init_exception_handler): Avoid adding our exception
handler twice.
2009-07-17 16:54:21 +00:00
Corinna Vinschen 8319377680 * syscalls.cc (unlink_nt): Just return when a sharing violation
occurs on remote filesystems.
2009-07-17 16:45:22 +00:00
Corinna Vinschen 0fb0fb8391 * globals.cc: Improve comment on R/O UNICODE_STRINGs.
* mount.h (class fs_info): Add is_mvfs bit.
	* mount.cc (fs_info::update): Recognize MVFS remote filesystem.
	(fillout_mntent): Reorder filesystem checks for speed.  Add
	mvfs, unixfs, and sunwnfs filesystem types.
	* path.h (class path_conv): Add fs_is_mvfs method.
	* path.cc (symlink_worker): On MVFS, always create symlinks as
	Windows shortcuts.  Explain why.
2009-07-17 09:00:19 +00:00
Corinna Vinschen d6f45fb002 * syscalls.cc (unlink_nt): First remove the R/O DOS attribute with
FILE_WRITE_ATTRIBUTES access only, then re-open the file for DELETE.
	Explain why.
2009-07-16 16:55:25 +00:00
Corinna Vinschen 76cf56714e * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Remove file
attribute check already done in NtSetAttributesFile.
2009-07-16 15:28:57 +00:00
Corinna Vinschen fc261e53f0 * globals.cc: Reorder constant UNICODE_STRINGs for clarity.
* mount.h (fs_info::sttaus): Move filesystem type flags into
	substructure.  Add union to allow simple test for having set any
	one filesystem type flag.  Replace has_buggy_open flag with is_sunwnfs
	flag.  Replace has_buggy_fileid_dirinfo with is_unixfs flag.
	(fs_info::got_fs): New private method.
	(fs_info::has_buggy_open): New explicit implementation.
	(fs_info::has_buggy_fileid_dirinfo): Ditto.
	* mount.cc (fs_info::update): Optimize filesystem checks for speed.
	* winsup.h (IMPLEMENT_STATUS_FLAG): Change write accessor to return
	value just set.
2009-07-16 09:56:25 +00:00
Corinna Vinschen 5e5a843711 * fhandler_netdrive.cc (GET_RESOURCE_INFO): Remove.
(thread_netdrive): Drop GET_RESOURCE_INFO case.
	(fhandler_netdrive::exists): Use GET_RESOURCE_OPENENUM info class
	to check for existance.
2009-07-15 18:18:03 +00:00
Corinna Vinschen f84aaff222 * fhandler_netdrive.cc (fhandler_netdrive::readdir): Remove useless
alloca.
2009-07-15 14:31:51 +00:00
Corinna Vinschen b31ca33dcc * path.cc (cwdstuff::set): Only fix up UNC path in win32 so as not
to overwrite incoming path.
2009-07-15 13:27:34 +00:00
Corinna Vinschen 8deb411836 Throughout avoid having to initialize constant UNICODE_STRINGs.
* globals.cc: Define constant UNICODE_STRINGs and store in .rdata
	section.
	* fhandler_disk_file.cc: Throughout, use readonly UNICODE_STRINGs
	rather then initializing local UNICODE_STRING variable where
	applicable.
	* fhandler_mem.cc (fhandler_dev_mem::open): Ditto.
	* flock.cc (inode_t::inode_t): Ditto.
	* mmap.cc: Ditto.
	* syscalls.cc: Ditto.
	* mount.cc (fs_info::update): Ditto.
	* path.cc: Ditto.

	* ntdll.h (RtlEqualUnicodePathPrefix): Redefine to take prefix as
	UNICODE_STRING.
	(RtlEqualUnicodePathSuffix): Redefine to take suffix as UNICODE_STRING.
	* fhandler_disk_file.cc: Accommodate throughout.
	* mount.cc (fs_info::update): Ditto.
	* path.cc (cwdstuff::set): Ditto.
	* syscalls.cc: Ditto.
2009-07-14 17:37:42 +00:00
Corinna Vinschen 472345a06c * globals.cc (active_codepage): Remove. 2009-07-14 16:24:33 +00:00
Christopher Faylor 62fb43a722 * how-spawn-works.txt: Add "out of date" note.
* how-vfork-works.txt: Ditto.
2009-07-12 21:26:40 +00:00
Christopher Faylor 4a42a25876 * Makefile.in: Don't do anything special with any RCS directories.
* ntdll.h (PROCESSINFOCLASS): Remove unneeded trailing comma.
* pinfo.cc (_pinfo::dup_proc_pipe): Remove unneeded assignment.
* sigproc.cc (sig_send): Don't send signal to myself if this is an exec stub.
2009-07-12 21:15:47 +00:00
Corinna Vinschen 77dcafa5ad * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Don't use
FileAllInformation info class since it needs a big buffer.  Add a
	comment.
2009-07-12 13:00:36 +00:00
Dave Korn 97bef5b7fd * winbase.h (ilockexch): Avoid making 'ret' volatile.
(ilockcmpexch): Likewise.
2009-07-07 21:41:43 +00:00
Dave Korn cd6c79f4fe * ChangeLog: Assorted minor whitespace fixes in old entries. 2009-07-07 20:25:34 +00:00
Dave Korn b602bb90e2 winsup/ChangeLog:
* Makefile.common (COMPILE_CXX): Add support for per-file overrides
	to exclude $(nostdinc) and $(nostdincxx) from compiler flags.
	(COMPILE_CC): Likewise for $(nostdinc).

winsup/cygwin/ChangeLog:

	* Makefile.in (DLL_OFILES): Add libstdcxx_wrapper.o
	(libstdcxx_wrapper_CFLAGS): Add flags for new module.
	(_cygwin_crt0_common_STDINCFLAGS): Define per-file override.
	(libstdcxx_wrapper_STDINCFLAGS, cxx_STDINCFLAGS): Likewise.
	* cxx.cc: Include "cygwin-cxx.h".
	(operator new): Tweak prototype for full standards compliance.
	(operator new[]): Likewise.
	(operator new (nothrow)): New fallback function.
	(operator new[] (nothrow), operator delete (nothrow),
	operator delete[] (nothrow)): Likewise.
	(default_cygwin_cxx_malloc): New struct of pointers to the above,
	for final last-resort fallback default.
	* cygwin-cxx.h: New file.
	(struct per_process_cxx_malloc): Define.
	(default_cygwin_cxx_malloc): Declare extern.
	* cygwin.din (__wrap__ZdaPv): Export new wrapper.
	(__wrap__ZdaPvRKSt9nothrow_t, __wrap__ZdlPv,
	__wrap__ZdlPvRKSt9nothrow_t, __wrap__Znaj,
	__wrap__ZnajRKSt9nothrow_t, __wrap__Znwj,
	__wrap__ZnwjRKSt9nothrow_t): Likewise.
	* globals.cc (__cygwin_user_data): Init newly-repurposed 'forkee'
	field (now 'cxx_malloc') to point to default_cygwin_cxx_malloc.
	* libstdcxx_wrapper.cc: New file.
	(__wrap__ZdaPv, __wrap__ZdaPvRKSt9nothrow_t, __wrap__ZdlPv,
	__wrap__ZdlPvRKSt9nothrow_t, __wrap__Znaj,
	__wrap__ZnajRKSt9nothrow_t, __wrap__Znwj,
	__wrap__ZnwjRKSt9nothrow_t): Define wrapper functions for libstdc++
	malloc operators and their overrides.
	* winsup.h (default_cygwin_cxx_malloc): Declare extern.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
	* include/sys/cygwin.h (struct per_process_cxx_malloc): Forward
	declare here.
	(struct per_process::forkee): Rename and repurpose from this ...
	(struct per_process::cxx_malloc): ... to this.
	* lib/_cygwin_crt0_common.cc: Include cygwin-cxx.h.
	(WEAK): Define shorthand helper macro.
	(__cygwin_cxx_malloc): Define and populate with weak references
	to whatever libstdc++ malloc operators will be visible at final
	link time for Cygwin apps and dlls.
	(_cygwin_crt0_common): Always look up cygwin DLL's internal
	per_process data, and don't test for (impossible) failure.  Inherit
	any members of __cygwin_cxx_malloc that we don't have overrides
	for from the DLL's default and store the resulting overall set of
	overrides back into the DLL's global per_process data.
2009-07-07 20:12:44 +00:00
Corinna Vinschen 6499c6e07b * cygtls.cc (_cygtls::remove): Fix typo. 2009-07-07 08:07:38 +00:00
Christopher Faylor 37b9360dc6 * Makefile.in (clean): Clean generated files in srcdir.
* tlsoffsets.h: Regenerate.
2009-07-06 23:19:08 +00:00
Christopher Faylor 421dde25fa * cygtls.cc (_cygtls::remove): Avoid closing a NULL handle. 2009-07-06 23:05:10 +00:00
Corinna Vinschen 58fc288ada * fhandler_socket.cc (fhandler_socket::recv_internal): Convert wsabuf
and wsacnt to references.  Fix handling of WSAEMSGSIZE.
2009-07-06 20:30:34 +00:00
Corinna Vinschen 023c25829c * cygtls.h (struct _local_storage): Add thread storage pointers for
memory used by socket select functions.  Combine them into a single
	struct select.
	* cygtls.cc: Accommodate above change throughout.
	(_cygtls::init_thread): Drop initalizing of sockevt to
	INVALID_HANDLE_VALUE.
	(_cygtls::fixup_after_fork): Reset sockevt to NULL.
	(_cygtls::remove): Don't use sockevt value to bail out prematurely.
	Set sockevt to NULL.  Free malloced select members.
	* select.h (struct select_socket_info): Drop max_w4 member.
	* select.cc (thread_socket): Use INFINITE timeout value if number of
	objects to wait for is <= MAXIMUM_WAIT_OBJECTS.  Use num_w4 member
	of select_socket_info struct rather than dropped max_w4.
	(init_tls_select_info): New inline function to initialize TLS select
	members.
	(start_thread_socket): Just call init_tls_select_info to initialize TLS
	select members and use them later on.
	(socket_cleanup): Don't free select_socket_info pointer members since
	they are thread local now.
2009-07-06 15:42:01 +00:00
Christopher Faylor 1183d7fb13 * dtable.cc (handle_to_fn): Detect failing NtQueryObject. 2009-07-06 15:11:30 +00:00
Corinna Vinschen e4001d4ccd * autoload.cc: Delete stray CR. 2009-07-06 10:44:14 +00:00
Christopher Faylor 5ea3e685eb * fhandler_console.cc: Change workstation -> windows station throughout. 2009-07-05 16:49:56 +00:00
Christopher Faylor 01d8a2dfd6 * autoload.cc (SetParent): Add new import.
* fhandler.h (fhandler_console::create_invisible_console): Declare new
function.
(create_invisible_console_workaround): Ditto.
* fhandler_console.cc (fhandler_console::create_invisible_console): Define new
function.
(create_invisible_console_workaround): Ditto.  Add too much code to deal with
broken Windows 7.  Use a helper app to start an invisible console window.
(fhandler_console::need_invisible): Reorganize to use helper functions to
create invisible console.
* spawn.cc (spawn_guts): Avoid zeroing already zeroed fields in si.
2009-07-04 23:51:10 +00:00
Dave Korn 38a58dd13c * autoload.cc (AttachConsole): Correct size of args. 2009-07-04 14:51:09 +00:00
Christopher Faylor 3c4f2024a1 * dcrt0.cc (jit_debug): New global.
(initial_env): Set jit_debug when we are automatically starting a gdb process.
* dtable.cc (dtable::get_debugger_info): Don't tty tricks when we are being
debugged by our own captive gdb, as determined by jit_debug == true.
(dtable::init_std_file_from_handle): Detect errors when initializing a tty
early rather than at random points later.
* fhandler.h (fhandler_*::init): Return int to indicate success/failure.
* fhandler.cc (fhandler_base::init): Reflect change in return value.
* pipe.cc (fhandler_pipe::init): Ditto.
(fhandler_pipe::create_selectable): Don't say we're retrying when we aren't.
* fhandler_console.cc (fhandler_console::init): Ditto.  Return success/failure.
* fhandler_serial.cc (fhandler_serial::init): Ditto.
* fhandler_tty.cc (fhandler_tty_slave::init): Ditto.
(fhandler_tty_slave::open): Make debugging output more detailed.
* tty.cc (tty_list::terminate): Don't close I/O handles before all slaves have
checked in.
(tty::slave_alive): Make a non-inlined function.  Check if tty pipe handles can
be created as an additional exists check.
* tty.h (tty::slave_alive): Just define here.
2009-07-03 18:05:51 +00:00
Corinna Vinschen 8d7471ab44 * posix.sgml: Add fpurge and mkstemps to BSD list. 2009-07-03 13:04:01 +00:00
Corinna Vinschen e5f37aa148 * cygwin.din (fpurge, mkstemps): New exports.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
	* mktemp.cc (_gettemp): Add parameter.
	(mkstemps): New function.
	(mkstemp, mkdtemp, mktemp): Adjust clients.
2009-07-03 13:01:17 +00:00
Corinna Vinschen d3920e10ad * net.cc (get_xp_ifs): Fix typo in comment. 2009-07-01 15:45:23 +00:00
Corinna Vinschen 975a630109 * fhandler.h (class fhandler_socket): Add class members and methods
to store and retrieve the SO_RCVBUF and SO_SNDBUF sizes.
	* fhandler_socket.cc (fhandler_socket::dup): Duplicate new members.
	(fhandler_socket::send_internal): Check for SO_SNDBUF size and
	restrict send to 1 byte less per KB 823764.  Leave loop immediately
	if WSASendMsg has been used.
	* net.cc (fdsock): Change comment again.  Set buffer sizes to 65536.
	Store values in fhandler_socket.
	(cygwin_setsockopt): Store SO_RCVBUF and SO_SNDBUF sizes in
	fhandler_socket.
	(cygwin_sendto): Drop call to sig_dispatch_pending.
	(cygwin_recvfrom): Ditto.
	(cygwin_recvmsg): Ditto.
	(cygwin_sendmsg): Ditto.
2009-07-01 09:16:17 +00:00
Christopher Faylor b4fa816474 * select.h: New file split from fhandler.h.
(select_record::select_record): Define do-nothing constructor for "new" to
avoid gratuitous zeroing.
(select_info): New base class.
(select_pipe_info): New class with methods for dealing with pipes.
(select_socket_info): New class with methods for dealing with sockets.
(select_serial_info): Dummy class for serial.
(select_mailslot_info): Dummy class for mailslots.
(select_stuff): Define device_specific_* as actual classes rather than void *.
* dtable.h (dtable::select_read): Accommodate return value change to 'bool' and
argument change to "select_stuff".
(dtable::select_write): Ditto.
(dtable::select_except): Ditto.
* dtable.cc (dtable::select_read): Accommodate return value change to 'bool'
and argument change to "select_stuff".
(dtable::select_write): Ditto.
(dtable::select_except): Ditto.
* fhandler.h: Excise select-related classes.
(fhandler_*::select_read): Change argument to select_stuff.
(fhandler_*::select_write): Ditto.
(fhandler_*::select_except): Ditto.
* select.cc (UNIX_FD_ZERO): Use memset rather than bzero.
(select_stuff::test_and_set): Change return type to bool.  Allocate
select_record on entry and let fhandler_*::select_* operate on the start.next
field of select_stuff.
(pipeinf): Delete.
(select_pipe_info::select_pipe_info): New constructor.  Allocates event for
controlling pipe waits.
(select_pipe_info::~select_pipe_info): New destructor.  Destroy event.  Stop
thread.
(select_pipe_info::add_watch_handle): New function.
(thread_pipe): Wait for the hEvent part of any overlapped pipes before peeking.
(start_thread_pipe): Don't allocate device_specific_pipe stuff here.  Assume
that it has been allocated earlier.
(pipe_cleanup): Rely on select_pipe_info destructor to clean up pipe
paraphenalia.
(fhandler_*::select_*): Derive select_record from new select_stuff argument.
(fhandler_pipe::select_*): Ditto.  Allocate pipe-specific field if not already
allocated.
(serialinf): Delete.
(thread_serial): serialinf -> select_serial_info.
(fhandler_base::ready_for_read): Rewrite to accommodate change in argument to
fhandler_*::select_*.
(socketinf): Delete.
(thread_socket): socketinf -> select_socket_info.
(mailslotinf): Delete.
(thread_mailslot): mailslotinf -> select_mailslot_info.
2009-06-30 21:18:44 +00:00
Christopher Faylor 840bb39798 * fhandler.cc (fhandler_base::has_ongoing_io): Accept an argument indicating
whether the overlapped event should be tested.
(fhandler_base::read_overlapped): Pass is_overlapped state to has_ongoing_io.
(fhandler_base::write_overlapped): Ditto.
* fhandler.h (fhandler_base::has_ongoing_io): Accommodate argument change.
* select.cc (peek_pipe): Ditto.
2009-06-30 14:36:11 +00:00
Corinna Vinschen 4a83803381 * net.cc (fdsock): Set default socket buffer sizes to 65520. Change
comment accordingly.
	* fhandler_socket.cc (fhandler_socket::send_internal): Set maximum
	send size to 65520 as well.
2009-06-30 10:36:40 +00:00
Christopher Faylor 9adef9ffef * select.cc (peek_pipe): Turn on (temporarily?) the experimental code which
tries to determine when a pipe is writable.
2009-06-29 14:32:58 +00:00