* dcrt0.cc (dll_crt0_1): Move set_os_type.
(_dll_crt0): To here. (cygwin_dll_init): And here. * external.cc (fillout_pinfo): Use more foolproof method for scanning for pids. * pinfo.cc (set_myself): Eliminate myself_identity.init. * sigproc.cc (wait_sig): Do it here instead to reduce the amount of time where there could potentially be two processes with the same pid. * spawn.cc (spawn_guts): Eliminate duplicate initialization. * include/sys/cygwin.h: Mark unused PID_* elements.
This commit is contained in:
parent
14d3488d1f
commit
3c2c374555
|
@ -1,3 +1,16 @@
|
|||
Fri Aug 25 21:25:32 2000 Christopher Faylor <cgf@cygnus.com>
|
||||
|
||||
* dcrt0.cc (dll_crt0_1): Move set_os_type.
|
||||
(_dll_crt0): To here.
|
||||
(cygwin_dll_init): And here.
|
||||
* external.cc (fillout_pinfo): Use more foolproof method for scanning
|
||||
for pids.
|
||||
* pinfo.cc (set_myself): Eliminate myself_identity.init.
|
||||
* sigproc.cc (wait_sig): Do it here instead to reduce the amount of
|
||||
time where there could potentially be two processes with the same pid.
|
||||
* spawn.cc (spawn_guts): Eliminate duplicate initialization.
|
||||
* include/sys/cygwin.h: Mark unused PID_* elements.
|
||||
|
||||
Fri Aug 25 21:49:00 2000 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* exec.cc (_execve): Change definition according to declaration in
|
||||
|
|
|
@ -646,9 +646,6 @@ dll_crt0_1 ()
|
|||
user_data->threadinterface->Init0();
|
||||
#endif
|
||||
|
||||
/* Set the os_being_run global. */
|
||||
set_os_type ();
|
||||
|
||||
/* Initialize the host dependent constants object. */
|
||||
host_dependent.init ();
|
||||
|
||||
|
@ -811,6 +808,9 @@ _dll_crt0 ()
|
|||
init_exceptions (&cygwin_except_entry);
|
||||
do_global_ctors (&__CTOR_LIST__, 1);
|
||||
|
||||
/* Set the os_being_run global. */
|
||||
set_os_type ();
|
||||
|
||||
#ifdef DEBUGGING
|
||||
char buf[80];
|
||||
if (GetEnvironmentVariable ("CYGWIN_SLEEP", buf, sizeof (buf)))
|
||||
|
@ -922,6 +922,9 @@ cygwin_dll_init ()
|
|||
init_exceptions (&cygwin_except_entry);
|
||||
do_global_ctors (&__CTOR_LIST__, 1);
|
||||
|
||||
/* Set the os_being_run global. */
|
||||
set_os_type ();
|
||||
|
||||
user_data->heapbase = user_data->heapptr = user_data->heaptop = NULL;
|
||||
|
||||
if (!DuplicateHandle (GetCurrentProcess (), GetCurrentProcess (),
|
||||
|
|
|
@ -31,38 +31,28 @@ fillout_pinfo (pid_t pid, int winpid)
|
|||
if (!pids.npids)
|
||||
pids.init ();
|
||||
|
||||
static unsigned int i = 0;
|
||||
if (!pid)
|
||||
i = 0;
|
||||
|
||||
memset (&ep, 0, sizeof ep);
|
||||
for (unsigned i = 0; i < pids.npids; i++)
|
||||
for (; i < pids.npids; )
|
||||
{
|
||||
if (!pids[i])
|
||||
DWORD thispid = pids[i++];
|
||||
if (!thispid)
|
||||
continue;
|
||||
pinfo p (pids[i]);
|
||||
pid_t thispid;
|
||||
|
||||
if (p)
|
||||
thispid = p->pid;
|
||||
else if (winpid)
|
||||
thispid = pids[i];
|
||||
else
|
||||
continue;
|
||||
|
||||
if (!pid || thispid == pid)
|
||||
{
|
||||
if (nextpid && pid)
|
||||
{
|
||||
pid = 0;
|
||||
nextpid = 0;
|
||||
continue;
|
||||
}
|
||||
pinfo p (thispid);
|
||||
|
||||
if (!p)
|
||||
{
|
||||
ep.pid = pids[i];
|
||||
ep.dwProcessId = cygwin_pid (pids[i]);
|
||||
if (!winpid)
|
||||
continue;
|
||||
ep.pid = thispid;
|
||||
ep.dwProcessId = cygwin_pid (thispid);
|
||||
ep.process_state = PID_IN_USE;
|
||||
ep.ctty = -1;
|
||||
}
|
||||
else if (p->pid && NOTSTATE(p, PID_CLEAR))
|
||||
else if (p->pid)
|
||||
{
|
||||
ep.ctty = tty_attached (p) ? p->ctty : -1;
|
||||
ep.pid = p->pid;
|
||||
|
@ -85,10 +75,10 @@ fillout_pinfo (pid_t pid, int winpid)
|
|||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ep.pid)
|
||||
{
|
||||
i = 0;
|
||||
pids.reset ();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -81,14 +81,14 @@ enum
|
|||
PID_CYGPARENT = 0x0080, // Set if parent was a cygwin app.
|
||||
PID_SPLIT_HEAP = 0x0100, // Set if the heap has been split,
|
||||
// which means we can't fork again.
|
||||
PID_CLEAR = 0x0200, // Flag that pid should be cleared from parent's
|
||||
PID_UNUSED = 0x0200, // Flag that pid should be cleared from parent's
|
||||
// wait list
|
||||
PID_SOCKETS_USED = 0x0400, // Set if process uses Winsock.
|
||||
PID_UNUSED1 = 0x0400, // Set if process uses Winsock.
|
||||
PID_INITIALIZING = 0x0800, // Set until ready to receive signals.
|
||||
PID_USETTY = 0x1000, // Setting this enables or disables cygwin's
|
||||
// tty support. This is inherited by
|
||||
// all execed or forked processes.
|
||||
PID_REPARENT = 0x2000, // child has execed
|
||||
PID_UNUSED2 = 0x2000, // child has execed
|
||||
PID_EXECED = 0x4000, // redirect to original pid info block
|
||||
PID_NOREDIR = 0x8000 // don't redirect if execed
|
||||
};
|
||||
|
|
|
@ -24,7 +24,6 @@ details. */
|
|||
static char NO_COPY pinfo_dummy[sizeof(pinfo)] = {0};
|
||||
|
||||
pinfo NO_COPY myself ((_pinfo *)&pinfo_dummy); // Avoid myself != NULL checks
|
||||
static pinfo NO_COPY myself_identity ((_pinfo *)&pinfo_dummy);
|
||||
|
||||
/* Initialize the process table.
|
||||
This is done once when the dll is first loaded. */
|
||||
|
@ -39,9 +38,6 @@ set_myself (pid_t pid, HANDLE h)
|
|||
myself->dwProcessId = winpid;
|
||||
myself->process_state |= PID_IN_USE;
|
||||
myself->start_time = time (NULL); /* Register our starting time. */
|
||||
pid_t myself_cyg_pid = cygwin_pid (myself->dwProcessId);
|
||||
if (pid != myself_cyg_pid && parent_alive)
|
||||
myself_identity.init (myself_cyg_pid, PID_EXECED);
|
||||
|
||||
char buf[30];
|
||||
__small_sprintf (buf, "cYg%8x %x", _STRACE_INTERFACE_ACTIVATE_ADDR,
|
||||
|
@ -95,7 +91,7 @@ pinfo_init (LPBYTE info)
|
|||
{
|
||||
/* Invent our own pid. */
|
||||
|
||||
set_myself (1, NULL);
|
||||
set_myself (1);
|
||||
myself->ppid = 1;
|
||||
myself->pgid = myself->sid = myself->pid;
|
||||
myself->ctty = -1;
|
||||
|
|
|
@ -1202,6 +1202,11 @@ wait_sig (VOID *)
|
|||
if (!SetEvent (child_proc_info->subproc_ready))
|
||||
system_printf ("SetEvent (subproc_ready) failed, %E");
|
||||
ForceCloseHandle (child_proc_info->subproc_ready);
|
||||
/* Initialize an "indirect" pid block so that if someone looks up this
|
||||
process via its Windows PID it will be redirected to the appropriate
|
||||
Cygwin PID shared memory block. */
|
||||
static pinfo NO_COPY myself_identity;
|
||||
myself_identity.init (cygwin_pid (myself->dwProcessId), PID_EXECED);
|
||||
}
|
||||
|
||||
SetEvent (wait_sig_inited);
|
||||
|
|
|
@ -696,7 +696,6 @@ skip_arg_parsing:
|
|||
child->rootlen = myself->rootlen;
|
||||
child->dwProcessId = pi.dwProcessId;
|
||||
child->hProcess = pi.hProcess;
|
||||
child->process_state |= PID_INITIALIZING;
|
||||
for (i = 0; i < NSIG; i++)
|
||||
{
|
||||
child->getsig(i).sa_mask = 0;
|
||||
|
|
Loading…
Reference in New Issue