* 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.
This commit is contained in:
parent
7636b58590
commit
bbf38a55c6
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue