From 8c1442d02fa18a1f008fab7f96ebec9abaec589b Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 28 Mar 1996 19:30:33 +0000 Subject: Thu Mar 28 14:22:51 1996 Roland McGrath * sysdeps/mach/hurd/kill.c: If proc_pid2task gives us MACH_PORT_NULL the process is a zombie; send no messages and return success. --- ChangeLog | 5 +++++ sysdeps/mach/hurd/kill.c | 14 +++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c31f24ea4f..73be9b7416 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Mar 28 14:22:51 1996 Roland McGrath + + * sysdeps/mach/hurd/kill.c: If proc_pid2task gives us MACH_PORT_NULL + the process is a zombie; send no messages and return success. + Thu Mar 28 11:53:26 1996 Roland McGrath * wctype/cname-lookup.h: Find localeinfo.h in ../locale. 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) { -- cgit v1.2.3