* pinfo.cc (_pinfo::dup_proc_pipe): Reorganize to provide more information for
failing condition. (pinfo::wait): Pass name of function to dup_proc_pipe. Eliminate error check for dup_proc_pipe since it never actually returned an error. * pinfo.h (_pinfo::dup_proc_pipe): Add an argument. * spawn.cc (child_info_spawn::worker): Pass name of function to dup_proc_pipe.
This commit is contained in:
parent
1d928241e1
commit
ab79e06445
|
@ -1,3 +1,13 @@
|
||||||
|
2012-03-07 Christopher Faylor <me.cygwin2012@cgf.cx>
|
||||||
|
|
||||||
|
* pinfo.cc (_pinfo::dup_proc_pipe): Reorganize to provide more
|
||||||
|
information for failing condition.
|
||||||
|
(pinfo::wait): Pass name of function to dup_proc_pipe. Eliminate error
|
||||||
|
check for dup_proc_pipe since it never actually returned an error.
|
||||||
|
* pinfo.h (_pinfo::dup_proc_pipe): Add an argument.
|
||||||
|
* spawn.cc (child_info_spawn::worker): Pass name of function to
|
||||||
|
dup_proc_pipe.
|
||||||
|
|
||||||
2012-03-07 Corinna Vinschen <corinna@vinschen.de>
|
2012-03-07 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* glob.cc (MAXPATHLEN): Reinstantiate with a value of 8192.
|
* glob.cc (MAXPATHLEN): Reinstantiate with a value of 8192.
|
||||||
|
|
|
@ -986,7 +986,7 @@ proc_waiter (void *arg)
|
||||||
#define warn_printf system_printf
|
#define warn_printf system_printf
|
||||||
#endif
|
#endif
|
||||||
HANDLE
|
HANDLE
|
||||||
_pinfo::dup_proc_pipe (HANDLE hProcess)
|
_pinfo::dup_proc_pipe (HANDLE hProcess, const char *func)
|
||||||
{
|
{
|
||||||
DWORD flags = DUPLICATE_SAME_ACCESS;
|
DWORD flags = DUPLICATE_SAME_ACCESS;
|
||||||
HANDLE orig_wr_proc_pipe = wr_proc_pipe;
|
HANDLE orig_wr_proc_pipe = wr_proc_pipe;
|
||||||
|
@ -997,17 +997,25 @@ _pinfo::dup_proc_pipe (HANDLE hProcess)
|
||||||
flags |= DUPLICATE_CLOSE_SOURCE;
|
flags |= DUPLICATE_CLOSE_SOURCE;
|
||||||
bool res = DuplicateHandle (GetCurrentProcess (), wr_proc_pipe,
|
bool res = DuplicateHandle (GetCurrentProcess (), wr_proc_pipe,
|
||||||
hProcess, &wr_proc_pipe, 0, FALSE, flags);
|
hProcess, &wr_proc_pipe, 0, FALSE, flags);
|
||||||
if (!res && WaitForSingleObject (hProcess, 0) != WAIT_OBJECT_0)
|
if (res)
|
||||||
{
|
{
|
||||||
wr_proc_pipe = orig_wr_proc_pipe;
|
wr_proc_pipe_owner = dwProcessId;
|
||||||
warn_printf ("something failed for pid %d: res %d, hProcess %p, wr_proc_pipe %p vs. %p, %E",
|
sigproc_printf ("(%s) duped wr_proc_pipe %p for pid %d(%u)", func,
|
||||||
pid, res, hProcess, wr_proc_pipe, orig_wr_proc_pipe);
|
wr_proc_pipe, pid, dwProcessId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wr_proc_pipe_owner = dwProcessId;
|
DWORD duperr = GetLastError ();
|
||||||
sigproc_printf ("duped wr_proc_pipe %p for pid %d(%u)", wr_proc_pipe,
|
DWORD wfsores = WaitForSingleObject (hProcess, 0);
|
||||||
pid, dwProcessId);
|
if (wfsores != WAIT_OBJECT_0)
|
||||||
|
{
|
||||||
|
warn_printf ("(%s) process synchronization failed for pid %u/%p, "
|
||||||
|
"wr_proc_pipe %p vs. %p: DuplicateHandle winerr %d, "
|
||||||
|
"WFSO returned %u, %E",
|
||||||
|
func, pid, hProcess, wr_proc_pipe, orig_wr_proc_pipe, duperr,
|
||||||
|
wfsores);
|
||||||
|
}
|
||||||
|
wr_proc_pipe = orig_wr_proc_pipe;
|
||||||
}
|
}
|
||||||
return orig_wr_proc_pipe;
|
return orig_wr_proc_pipe;
|
||||||
}
|
}
|
||||||
|
@ -1030,11 +1038,7 @@ pinfo::wait ()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(*this)->dup_proc_pipe (hProcess))
|
(*this)->dup_proc_pipe (hProcess, "pinfo::wait");
|
||||||
{
|
|
||||||
system_printf ("Couldn't duplicate pipe topid %d(%p), %E", (*this)->pid, hProcess);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
preserve (); /* Preserve the shared memory associated with the pinfo */
|
preserve (); /* Preserve the shared memory associated with the pinfo */
|
||||||
|
|
|
@ -111,7 +111,7 @@ public:
|
||||||
char *cwd (size_t &);
|
char *cwd (size_t &);
|
||||||
char *cmdline (size_t &);
|
char *cmdline (size_t &);
|
||||||
bool set_ctty (class fhandler_termios *, int);
|
bool set_ctty (class fhandler_termios *, int);
|
||||||
HANDLE dup_proc_pipe (HANDLE) __attribute__ ((regparm(2)));
|
HANDLE dup_proc_pipe (HANDLE, const char *) __attribute__ ((regparm(3)));
|
||||||
void sync_proc_pipe ();
|
void sync_proc_pipe ();
|
||||||
bool alert_parent (char);
|
bool alert_parent (char);
|
||||||
int __stdcall kill (siginfo_t&) __attribute__ ((regparm (2)));
|
int __stdcall kill (siginfo_t&) __attribute__ ((regparm (2)));
|
||||||
|
|
|
@ -785,7 +785,7 @@ loop:
|
||||||
myself->sync_proc_pipe (); /* Make sure that we own wr_proc_pipe
|
myself->sync_proc_pipe (); /* Make sure that we own wr_proc_pipe
|
||||||
just in case we've been previously
|
just in case we've been previously
|
||||||
execed. */
|
execed. */
|
||||||
orig_wr_proc_pipe = myself->dup_proc_pipe (pi.hProcess);
|
orig_wr_proc_pipe = myself->dup_proc_pipe (pi.hProcess, "child_info_spawn::worker");
|
||||||
}
|
}
|
||||||
pid = myself->pid;
|
pid = myself->pid;
|
||||||
if (!iscygwin ())
|
if (!iscygwin ())
|
||||||
|
|
Loading…
Reference in New Issue