kill(getpid(), 0) will fail

Chris Faylor cgf@bbc.com
Tue Mar 2 18:10:00 GMT 1999


I think the correct patch is to make proc_exists recognize the
various flavors of "myself" as pointers to the current process.
I've checked in a patch to do that.  That should eliminate your
problem also, shouldn't it?

cgf

On Thu, Feb 25, 1999 at 02:19:52PM +0900, Kazuhiro Fujieda wrote:
>kill(getpid(), 0) will fail. This is used to check kill() in the
>configure script included in rcs-5.7.
>
>kill_worker() passes `myself_nowait_nomain' to proc_exists()
>instead of `myself', but proc_exists() takes no account of it.
>I believe this is the only case that `myself_nowait_nomain' is
>passed to proc_exists().
>
>So the following patch can fix this problem.
>
>--- signal.cc-	Wed Feb 03 13:55:21 1999
>+++ signal.cc	Thu Feb 25 13:55:41 1999
>@@ -145,17 +145,20 @@ kill_worker (pid_t pid, int sig)
>       return -1;
>     }
> 
>-  if (dest == myself && !sendSIGCONT)
>-    dest = myself_nowait_nonmain;
>   if (sig == 0)
>     res = proc_exists (dest) ? 0 : -1;
>-  else if ((res = sig_send (dest, sig)))
>+  else
>     {
>-      wm_printf ("%d = sig_send, %E ", res);
>-      res = -1;
>+      if (dest == myself && !sendSIGCONT)
>+	dest = myself_nowait_nonmain;
>+      if ((res = sig_send (dest, sig)))
>+	{
>+	  wm_printf ("%d = sig_send, %E ", res);
>+	  res = -1;
>+	}
>+      else if (sendSIGCONT)
>+	(void) sig_send (dest, SIGCONT);
>     }
>-  else if (sendSIGCONT)
>-    (void) sig_send (dest, SIGCONT);
> 
>   syscall_printf ("%d = kill_worker (%d, %d)", res, pid, sig);
>   return res;


More information about the Cygwin-developers mailing list