OSDN Git Service

* shortcut.c (PATH_ALL_EXEC): Add parentheses to avoid a compiler warning.
authorcgf <cgf>
Sat, 10 Mar 2001 23:37:50 +0000 (23:37 +0000)
committercgf <cgf>
Sat, 10 Mar 2001 23:37:50 +0000 (23:37 +0000)
* 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.

winsup/cygwin/ChangeLog
winsup/cygwin/exceptions.cc
winsup/cygwin/pinfo.h
winsup/cygwin/shortcut.c
winsup/cygwin/sigproc.cc
winsup/cygwin/sigproc.h

index dc2e3b6..088a901 100644 (file)
@@ -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>
 
        * syscalls.cc (_rename): Set errno to ENOENT when an old path doesn't
index dc5b7fb..6e1ae45 100644 (file)
@@ -601,7 +601,7 @@ sig_handle_tty_stop (int sig)
   if (my_parent_is_alive ())
     {
       pinfo parent (myself->ppid);
-      sig_send (parent, __SIGCHILDSTOPPED);
+      sig_send (parent, SIGCHLD);
     }
   sigproc_printf ("process %d stopped by signal %d, myself->ppid_handle %p",
                  myself->pid, sig, myself->ppid_handle);
@@ -875,7 +875,7 @@ set_pending:
     LeaveCriticalSection (&th->lock);
 
   if (!hth)
-    sigproc_printf ("didn't suspend main thread, th %p", th);
+    sigproc_printf ("good.  Didn't suspend main thread, th %p", th);
   else
     {
       res = ResumeThread (hth);
index 2be2623..7f46850 100644 (file)
@@ -1,6 +1,6 @@
 /* pinfo.h: process table info
 
-   Copyright 2000 Cygnus Solutions.
+   Copyright 2000, 2001 Red Hat, Inc.
 
 This file is part of Cygwin.
 
@@ -14,7 +14,7 @@ enum
 {
   __SIGFLUSH       = -2,
   __SIGSTRACE      = -1,
-  __SIGCHILDSTOPPED =  0,
+  __SIGUNUSED      =  0,
   __SIGOFFSET      =  3
 };
 
index 6851f12..b7ca869 100644 (file)
@@ -25,7 +25,7 @@ details. */
 #define PATH_SYMLINK    MOUNT_SYMLINK
 #define PATH_EXEC       MOUNT_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. */
 static BOOL
index f31660e..9eae394 100644 (file)
@@ -309,15 +309,6 @@ proc_subproc (DWORD what, DWORD val)
         This will cause an eventual scan of waiters. */
       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
      * thread which is signaled when the appropriate pid exits or stops.
      * (usually called from the main thread)
@@ -480,7 +471,7 @@ proc_terminate (void)
 void __stdcall
 sig_clear (int sig)
 {
-  (void) InterlockedExchange (myself->getsigtodo(sig), 0L);
+  (void) InterlockedExchange (myself->getsigtodo (sig), 0L);
   return;
 }
 
@@ -703,7 +694,7 @@ sig_send (_pinfo *p, int sig, DWORD ebp)
 
   /* 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.
    */
@@ -790,7 +781,7 @@ out:
 void __stdcall
 sig_set_pending (int sig)
 {
-  (void) InterlockedIncrement (myself->getsigtodo(sig));
+  (void) InterlockedIncrement (myself->getsigtodo (sig));
   return;
 }
 
@@ -1134,7 +1125,6 @@ wait_sig (VOID *)
        }
 
       rc -= WAIT_OBJECT_0;
-      int dispatched = FALSE;
       sigproc_printf ("awake");
       /* A sigcatch semaphore has been signaled.  Scan the sigtodo
        * array looking for any unprocessed signals.
@@ -1145,7 +1135,7 @@ wait_sig (VOID *)
       int dispatched_sigchld = 0;
       for (int sig = -__SIGOFFSET; sig < NSIG; sig++)
        {
-         while (InterlockedDecrement (myself->getsigtodo(sig)) >= 0)
+         while (InterlockedDecrement (myself->getsigtodo (sig)) >= 0)
            {
              if (sig == SIGCHLD)
                saw_sigchld = 1;
@@ -1171,37 +1161,31 @@ wait_sig (VOID *)
                  // proc_strace ();    // Dump cached strace.prntf stuff.
                  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 */
                default:
                  sigproc_printf ("Got signal %d", sig);
                  int wasdispatched = sig_handle (sig);
-                 dispatched |= wasdispatched;
                  if (sig == SIGCHLD && wasdispatched)
                    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;
                }
            }
+
+       nextsig:
          /* Decremented too far. */
-         if (InterlockedIncrement (myself->getsigtodo(sig)) > 0)
+         if (InterlockedIncrement (myself->getsigtodo (sig)) > 0)
            saw_pending_signals = 1;
-       nextsig:
-         continue;
        }
 
-      /* FIXME: The dispatched stuff probably isn't needed anymore. */
-      if (dispatched >= 0 && pending_signals < 0 && !saw_pending_signals)
+      if (pending_signals < 0 && !saw_pending_signals)
        pending_signals = 0;
 
-      if (nzombies && saw_sigchld && !dispatched_sigchld)
+      if (saw_sigchld)
        proc_subproc (PROC_CLEARWAIT, 0);
+
       /* Signal completion of signal handling depending on which semaphore
        * woke up the WaitForMultipleObjects above.
        */
@@ -1209,6 +1193,7 @@ wait_sig (VOID *)
        {
        case 0:
          SetEvent (sigcomplete_main);
+         sigproc_printf ("set main thread completion event");
          break;
        case 1:
          ReleaseSemaphore (sigcomplete_nonmain, 1, NULL);
@@ -1217,7 +1202,6 @@ wait_sig (VOID *)
          /* Signal from another process.  No need to synchronize. */
          break;
        }
-
       sigproc_printf ("looping");
     }
 
index 0daa493..c67574d 100644 (file)
@@ -17,11 +17,10 @@ details. */
 enum procstuff
 {
   PROC_ADDCHILD                = 1,    // add a new subprocess to list
-  PROC_CHILDSTOPPED    = 2,    // a child stopped
-  PROC_CHILDTERMINATED = 3,    // a child died
-  PROC_CLEARWAIT       = 4,    // clear all waits - signal arrived
-  PROC_WAIT            = 5,    // setup for wait() for subproc
-  PROC_NOTHING         = 6     // nothing, really
+  PROC_CHILDTERMINATED = 2,    // a child died
+  PROC_CLEARWAIT       = 3,    // clear all waits - signal arrived
+  PROC_WAIT            = 4,    // setup for wait() for subproc
+  PROC_NOTHING         = 5     // nothing, really
 };
 
 typedef struct struct_waitq