diff options
author | Roland McGrath <roland@gnu.org> | 1996-03-28 19:30:33 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1996-03-28 19:30:33 +0000 |
commit | 8c1442d02fa18a1f008fab7f96ebec9abaec589b (patch) | |
tree | 88a9d25ea65a94c6d3310ceb03e16f7225d64a35 /sysdeps/mach/hurd/kill.c | |
parent | 43efc1033385fe355baffb0592d90653aeb47fd2 (diff) | |
download | glibc-8c1442d02fa18a1f008fab7f96ebec9abaec589b.tar.gz glibc-8c1442d02fa18a1f008fab7f96ebec9abaec589b.tar.xz glibc-8c1442d02fa18a1f008fab7f96ebec9abaec589b.zip |
Thu Mar 28 14:22:51 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* sysdeps/mach/hurd/kill.c: If proc_pid2task gives us MACH_PORT_NULL the process is a zombie; send no messages and return success.
Diffstat (limited to 'sysdeps/mach/hurd/kill.c')
-rw-r--r-- | sysdeps/mach/hurd/kill.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sysdeps/mach/hurd/kill.c b/sysdeps/mach/hurd/kill.c index 9227f2243f..1f10613b09 100644 --- a/sysdeps/mach/hurd/kill.c +++ b/sysdeps/mach/hurd/kill.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -50,7 +50,8 @@ __kill (pid_t pid, int sig) { task_t refport; err = __proc_pid2task (proc, pid, &refport); - if (!err) + /* Ignore zombies. */ + if (!err && refport != MACH_PORT_NULL) { err = __task_terminate (refport); __mach_port_deallocate (__mach_task_self (), refport); @@ -73,6 +74,12 @@ __kill (pid_t pid, int sig) /* If we could not get the task port, we can do nothing. */ return taskerr; + if (refport == MACH_PORT_NULL) + /* proc_pid2task returned success with a null task port. + That means the process is a zombie. Signals + to zombies should return success and do nothing. */ + return 0; + /* For user convenience in the case of a task that has not registered any message port with the proc server, translate a few signals to direct task operations. */ @@ -85,6 +92,7 @@ __kill (pid_t pid, int sig) return __task_suspend (refport); case SIGCONT: return __task_resume (refport); + case SIGTERM: case SIGQUIT: case SIGINT: return __task_terminate (refport); @@ -111,7 +119,7 @@ __kill (pid_t pid, int sig) /* Send SIG to each process in pgrp (- PID). */ pid_t pidbuf[10], *pids = pidbuf; mach_msg_type_number_t i, npids = sizeof (pidbuf) / sizeof (pidbuf[0]); - + err = __proc_getpgrppids (proc, - pid, &pids, &npids); if (!err) { |