diff options
author | Christopher Faylor <me@cgf.cx> | 2006-08-09 15:04:32 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2006-08-09 15:04:32 +0000 |
commit | bbf38a55c6d1df220bd0160a99907048b6d215a0 (patch) | |
tree | 1c41c0a7d38123bfa2ff20fe7a337fc3e1e7dfab /winsup | |
parent | 7636b58590621af3c341c3eb37a017e0e6598d3f (diff) | |
download | cygnal-bbf38a55c6d1df220bd0160a99907048b6d215a0.tar.gz cygnal-bbf38a55c6d1df220bd0160a99907048b6d215a0.tar.bz2 cygnal-bbf38a55c6d1df220bd0160a99907048b6d215a0.zip |
* autoload.cc (GetHandleInformation): Declare new function.
(SetHandleInformation): Ditto.
* debug.cc (add_handle): Use SetHandleInformation to protect handle.
(close_handle): Use SetHandleInformation to unprotect handle.
* spawn.cc (spawn_guts): Move detached test outside of P_OVERLAY block.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 9 | ||||
-rw-r--r-- | winsup/cygwin/autoload.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/debug.cc | 4 | ||||
-rw-r--r-- | winsup/cygwin/spawn.cc | 4 |
4 files changed, 16 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 2b97b08f6..63e1862bd 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,12 @@ +2006-08-09 Christopher Faylor <cgf@timesys.com> + + * autoload.cc (GetHandleInformation): Declare new function. + (SetHandleInformation): Ditto. + * debug.cc (add_handle): Use SetHandleInformation to protect handle. + (close_handle): Use SetHandleInformation to unprotect handle. + + * spawn.cc (spawn_guts): Move detached test outside of P_OVERLAY block. + 2006-08-07 Corinna Vinschen <corinna@vinschen.de> * autoload.cc (NtSetInformationFile): Define. diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc index d1d234dee..25ef3d62f 100644 --- a/winsup/cygwin/autoload.cc +++ b/winsup/cygwin/autoload.cc @@ -507,6 +507,7 @@ LoadDLLfuncEx (FindVolumeClose, 4, kernel32, 1) LoadDLLfuncEx2 (GetCompressedFileSizeA, 8, kernel32, 1, 0xffffffff) LoadDLLfuncEx (GetConsoleWindow, 0, kernel32, 1) LoadDLLfuncEx (GetDiskFreeSpaceEx, 16, kernel32, 1) +LoadDLLfuncEx (GetHandleInformation, 8, kernel32, 1) LoadDLLfuncEx (GetNativeSystemInfo, 4, kernel32, 1) LoadDLLfuncEx (GetProcessWorkingSetSize, 12, kernel32, 1) LoadDLLfuncEx (GetVolumeNameForVolumeMountPointA, 12, kernel32, 1) @@ -516,6 +517,7 @@ LoadDLLfuncEx (IsWow64Process, 8, kernel32, 1); LoadDLLfuncEx (Process32First, 8, kernel32, 1) LoadDLLfuncEx (Process32Next, 8, kernel32, 1) LoadDLLfuncEx (RegisterServiceProcess, 8, kernel32, 1) +LoadDLLfuncEx (SetHandleInformation, 12, kernel32, 1) LoadDLLfuncEx (SetProcessWorkingSetSize, 12, kernel32, 1) LoadDLLfuncEx (SignalObjectAndWait, 16, kernel32, 1) LoadDLLfuncEx (SwitchToThread, 0, kernel32, 1) diff --git a/winsup/cygwin/debug.cc b/winsup/cygwin/debug.cc index 004ddec0f..5e92d40a1 100644 --- a/winsup/cygwin/debug.cc +++ b/winsup/cygwin/debug.cc @@ -166,6 +166,7 @@ add_handle (const char *func, int ln, HANDLE h, const char *name, bool inh) hl->pid = GetCurrentProcessId (); cygheap->debug.endh->next = hl; cygheap->debug.endh = hl; + SetHandleInformation (h, HANDLE_FLAG_PROTECT_FROM_CLOSE, HANDLE_FLAG_PROTECT_FROM_CLOSE); debug_printf ("protecting handle '%s'(%p), inherited flag %d", hl->name, hl->h, hl->inherited); } @@ -234,9 +235,10 @@ close_handle (const char *func, int ln, HANDLE h, const char *name, bool force) if (!mark_closed (func, ln, h, name, force)) return false; + SetHandleInformation (h, HANDLE_FLAG_PROTECT_FROM_CLOSE, 0); ret = CloseHandle (h); -#if 0 /* Uncomment to see CloseHandle failures */ +#if 1 /* Uncomment to see CloseHandle failures */ if (!ret) small_printf ("CloseHandle(%s) failed %s:%d\n", name, func, ln); #endif diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index d1ee321e5..2771d87e0 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -422,6 +422,8 @@ spawn_guts (const char * prog_arg, const char *const *argv, if (mode == _P_DETACH) c_flags |= DETACHED_PROCESS; + else + set_console_state_for_spawn (real_path.iscygexec ()); if (mode != _P_OVERLAY) myself->exec_sendsig = NULL; @@ -447,8 +449,6 @@ spawn_guts (const char * prog_arg, const char *const *argv, ProtectHandleINH (cygheap->pid_handle); else system_printf ("duplicate to pid_handle failed, %E"); - if (mode != _P_DETACH) - set_console_state_for_spawn (real_path.iscygexec ()); } /* Some file types (currently only sockets) need extra effort in the parent |