* shortcut.c (PATH_ALL_EXEC): Add parentheses to avoid a compiler warning.
* exceptions.cc (setup_handler): Clarify debugging message. * sigproc.cc (proc_subproc): Remove PROC_CHILDSTOPPED test. It is handled by normal PROC_CLEARWAIT case. (wait_sig): Eliminate "dispatched" tracking. Remove __SIGCHILDSTOPPED test. Decrement counter again before jumping out of InterlockedDecrement loop so that subsequent InterlockedIncrement will keep the counter at the correctly decremented value and also detect when there are pending signals. * sigproc.h: Remove __SIGCHILDSTOPPED element. (procstuff): Remove PROC_CHILDSTOPPED element.
This commit is contained in:
parent
6a6a6fa2ae
commit
7cf3b655ec
@ -1,3 +1,19 @@
|
|||||||
|
Sat Mar 10 16:52:12 2001 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
|
* shortcut.c (PATH_ALL_EXEC): Add parentheses to avoid a compiler
|
||||||
|
warning.
|
||||||
|
|
||||||
|
* exceptions.cc (setup_handler): Clarify debugging message.
|
||||||
|
* sigproc.cc (proc_subproc): Remove PROC_CHILDSTOPPED test. It is
|
||||||
|
handled by normal PROC_CLEARWAIT case.
|
||||||
|
(wait_sig): Eliminate "dispatched" tracking. Remove __SIGCHILDSTOPPED
|
||||||
|
test. Decrement counter again before jumping out of
|
||||||
|
InterlockedDecrement loop so that subsequent InterlockedIncrement will
|
||||||
|
keep the counter at the correctly decremented value and also detect
|
||||||
|
when there are pending signals.
|
||||||
|
* sigproc.h: Remove __SIGCHILDSTOPPED element.
|
||||||
|
(procstuff): Remove PROC_CHILDSTOPPED element.
|
||||||
|
|
||||||
Sat Mar 10 15:22:44 2001 Christopher Faylor <cgf@cygnus.com>
|
Sat Mar 10 15:22:44 2001 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
* syscalls.cc (_rename): Set errno to ENOENT when an old path doesn't
|
* syscalls.cc (_rename): Set errno to ENOENT when an old path doesn't
|
||||||
|
@ -601,7 +601,7 @@ sig_handle_tty_stop (int sig)
|
|||||||
if (my_parent_is_alive ())
|
if (my_parent_is_alive ())
|
||||||
{
|
{
|
||||||
pinfo parent (myself->ppid);
|
pinfo parent (myself->ppid);
|
||||||
sig_send (parent, __SIGCHILDSTOPPED);
|
sig_send (parent, SIGCHLD);
|
||||||
}
|
}
|
||||||
sigproc_printf ("process %d stopped by signal %d, myself->ppid_handle %p",
|
sigproc_printf ("process %d stopped by signal %d, myself->ppid_handle %p",
|
||||||
myself->pid, sig, myself->ppid_handle);
|
myself->pid, sig, myself->ppid_handle);
|
||||||
@ -875,7 +875,7 @@ set_pending:
|
|||||||
LeaveCriticalSection (&th->lock);
|
LeaveCriticalSection (&th->lock);
|
||||||
|
|
||||||
if (!hth)
|
if (!hth)
|
||||||
sigproc_printf ("didn't suspend main thread, th %p", th);
|
sigproc_printf ("good. Didn't suspend main thread, th %p", th);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res = ResumeThread (hth);
|
res = ResumeThread (hth);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* pinfo.h: process table info
|
/* pinfo.h: process table info
|
||||||
|
|
||||||
Copyright 2000 Cygnus Solutions.
|
Copyright 2000, 2001 Red Hat, Inc.
|
||||||
|
|
||||||
This file is part of Cygwin.
|
This file is part of Cygwin.
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ enum
|
|||||||
{
|
{
|
||||||
__SIGFLUSH = -2,
|
__SIGFLUSH = -2,
|
||||||
__SIGSTRACE = -1,
|
__SIGSTRACE = -1,
|
||||||
__SIGCHILDSTOPPED = 0,
|
__SIGUNUSED = 0,
|
||||||
__SIGOFFSET = 3
|
__SIGOFFSET = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ details. */
|
|||||||
#define PATH_SYMLINK MOUNT_SYMLINK
|
#define PATH_SYMLINK MOUNT_SYMLINK
|
||||||
#define PATH_EXEC MOUNT_EXEC
|
#define PATH_EXEC MOUNT_EXEC
|
||||||
#define PATH_CYGWIN_EXEC MOUNT_CYGWIN_EXEC
|
#define PATH_CYGWIN_EXEC MOUNT_CYGWIN_EXEC
|
||||||
#define PATH_ALL_EXEC PATH_CYGWIN_EXEC | PATH_EXEC
|
#define PATH_ALL_EXEC (PATH_CYGWIN_EXEC | PATH_EXEC)
|
||||||
|
|
||||||
/* TODO: Ditto. */
|
/* TODO: Ditto. */
|
||||||
static BOOL
|
static BOOL
|
||||||
|
@ -309,15 +309,6 @@ proc_subproc (DWORD what, DWORD val)
|
|||||||
This will cause an eventual scan of waiters. */
|
This will cause an eventual scan of waiters. */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* A child is in the stopped state. Scan wait() queue to see if anyone
|
|
||||||
* should be notified. (Called from wait_sig thread)
|
|
||||||
*/
|
|
||||||
case PROC_CHILDSTOPPED:
|
|
||||||
child = myself; // Just to avoid accidental NULL dereference
|
|
||||||
sigproc_printf ("Received stopped notification");
|
|
||||||
clearing = 0;
|
|
||||||
goto scan_wait;
|
|
||||||
|
|
||||||
/* Handle a wait4() operation. Allocates an event for the calling
|
/* Handle a wait4() operation. Allocates an event for the calling
|
||||||
* thread which is signaled when the appropriate pid exits or stops.
|
* thread which is signaled when the appropriate pid exits or stops.
|
||||||
* (usually called from the main thread)
|
* (usually called from the main thread)
|
||||||
@ -480,7 +471,7 @@ proc_terminate (void)
|
|||||||
void __stdcall
|
void __stdcall
|
||||||
sig_clear (int sig)
|
sig_clear (int sig)
|
||||||
{
|
{
|
||||||
(void) InterlockedExchange (myself->getsigtodo(sig), 0L);
|
(void) InterlockedExchange (myself->getsigtodo (sig), 0L);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -703,7 +694,7 @@ sig_send (_pinfo *p, int sig, DWORD ebp)
|
|||||||
|
|
||||||
/* Increment the sigtodo array to signify which signal to assert.
|
/* Increment the sigtodo array to signify which signal to assert.
|
||||||
*/
|
*/
|
||||||
(void) InterlockedIncrement (p->getsigtodo(sig));
|
(void) InterlockedIncrement (p->getsigtodo (sig));
|
||||||
|
|
||||||
/* Notify the process that a signal has arrived.
|
/* Notify the process that a signal has arrived.
|
||||||
*/
|
*/
|
||||||
@ -790,7 +781,7 @@ out:
|
|||||||
void __stdcall
|
void __stdcall
|
||||||
sig_set_pending (int sig)
|
sig_set_pending (int sig)
|
||||||
{
|
{
|
||||||
(void) InterlockedIncrement (myself->getsigtodo(sig));
|
(void) InterlockedIncrement (myself->getsigtodo (sig));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1134,7 +1125,6 @@ wait_sig (VOID *)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rc -= WAIT_OBJECT_0;
|
rc -= WAIT_OBJECT_0;
|
||||||
int dispatched = FALSE;
|
|
||||||
sigproc_printf ("awake");
|
sigproc_printf ("awake");
|
||||||
/* A sigcatch semaphore has been signaled. Scan the sigtodo
|
/* A sigcatch semaphore has been signaled. Scan the sigtodo
|
||||||
* array looking for any unprocessed signals.
|
* array looking for any unprocessed signals.
|
||||||
@ -1145,7 +1135,7 @@ wait_sig (VOID *)
|
|||||||
int dispatched_sigchld = 0;
|
int dispatched_sigchld = 0;
|
||||||
for (int sig = -__SIGOFFSET; sig < NSIG; sig++)
|
for (int sig = -__SIGOFFSET; sig < NSIG; sig++)
|
||||||
{
|
{
|
||||||
while (InterlockedDecrement (myself->getsigtodo(sig)) >= 0)
|
while (InterlockedDecrement (myself->getsigtodo (sig)) >= 0)
|
||||||
{
|
{
|
||||||
if (sig == SIGCHLD)
|
if (sig == SIGCHLD)
|
||||||
saw_sigchld = 1;
|
saw_sigchld = 1;
|
||||||
@ -1171,37 +1161,31 @@ wait_sig (VOID *)
|
|||||||
// proc_strace (); // Dump cached strace.prntf stuff.
|
// proc_strace (); // Dump cached strace.prntf stuff.
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Signalled from a child process that it has stopped */
|
|
||||||
case __SIGCHILDSTOPPED:
|
|
||||||
sigproc_printf ("Received child stopped notification");
|
|
||||||
dispatched |= sig_handle (SIGCHLD);
|
|
||||||
if (proc_subproc (PROC_CHILDSTOPPED, 0))
|
|
||||||
dispatched |= 1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* A normal UNIX signal */
|
/* A normal UNIX signal */
|
||||||
default:
|
default:
|
||||||
sigproc_printf ("Got signal %d", sig);
|
sigproc_printf ("Got signal %d", sig);
|
||||||
int wasdispatched = sig_handle (sig);
|
int wasdispatched = sig_handle (sig);
|
||||||
dispatched |= wasdispatched;
|
|
||||||
if (sig == SIGCHLD && wasdispatched)
|
if (sig == SIGCHLD && wasdispatched)
|
||||||
dispatched_sigchld = 1;
|
dispatched_sigchld = 1;
|
||||||
|
/* Need to decrement again to offset increment below since
|
||||||
|
we really do want to decrement in this case. */
|
||||||
|
InterlockedDecrement (myself->getsigtodo (sig));
|
||||||
goto nextsig;
|
goto nextsig;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Decremented too far. */
|
|
||||||
if (InterlockedIncrement (myself->getsigtodo(sig)) > 0)
|
|
||||||
saw_pending_signals = 1;
|
|
||||||
nextsig:
|
nextsig:
|
||||||
continue;
|
/* Decremented too far. */
|
||||||
|
if (InterlockedIncrement (myself->getsigtodo (sig)) > 0)
|
||||||
|
saw_pending_signals = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: The dispatched stuff probably isn't needed anymore. */
|
if (pending_signals < 0 && !saw_pending_signals)
|
||||||
if (dispatched >= 0 && pending_signals < 0 && !saw_pending_signals)
|
|
||||||
pending_signals = 0;
|
pending_signals = 0;
|
||||||
|
|
||||||
if (nzombies && saw_sigchld && !dispatched_sigchld)
|
if (saw_sigchld)
|
||||||
proc_subproc (PROC_CLEARWAIT, 0);
|
proc_subproc (PROC_CLEARWAIT, 0);
|
||||||
|
|
||||||
/* Signal completion of signal handling depending on which semaphore
|
/* Signal completion of signal handling depending on which semaphore
|
||||||
* woke up the WaitForMultipleObjects above.
|
* woke up the WaitForMultipleObjects above.
|
||||||
*/
|
*/
|
||||||
@ -1209,6 +1193,7 @@ wait_sig (VOID *)
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
SetEvent (sigcomplete_main);
|
SetEvent (sigcomplete_main);
|
||||||
|
sigproc_printf ("set main thread completion event");
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
ReleaseSemaphore (sigcomplete_nonmain, 1, NULL);
|
ReleaseSemaphore (sigcomplete_nonmain, 1, NULL);
|
||||||
@ -1217,7 +1202,6 @@ wait_sig (VOID *)
|
|||||||
/* Signal from another process. No need to synchronize. */
|
/* Signal from another process. No need to synchronize. */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
sigproc_printf ("looping");
|
sigproc_printf ("looping");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,11 +17,10 @@ details. */
|
|||||||
enum procstuff
|
enum procstuff
|
||||||
{
|
{
|
||||||
PROC_ADDCHILD = 1, // add a new subprocess to list
|
PROC_ADDCHILD = 1, // add a new subprocess to list
|
||||||
PROC_CHILDSTOPPED = 2, // a child stopped
|
PROC_CHILDTERMINATED = 2, // a child died
|
||||||
PROC_CHILDTERMINATED = 3, // a child died
|
PROC_CLEARWAIT = 3, // clear all waits - signal arrived
|
||||||
PROC_CLEARWAIT = 4, // clear all waits - signal arrived
|
PROC_WAIT = 4, // setup for wait() for subproc
|
||||||
PROC_WAIT = 5, // setup for wait() for subproc
|
PROC_NOTHING = 5 // nothing, really
|
||||||
PROC_NOTHING = 6 // nothing, really
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct struct_waitq
|
typedef struct struct_waitq
|
||||||
|
Loading…
x
Reference in New Issue
Block a user