diff options
author | Sergey Bugaev <bugaevc@gmail.com> | 2021-05-26 16:40:47 +0300 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-08-10 22:12:30 +0200 |
commit | 111e1a54234613eb5055903cffa20d1f1e6a659e (patch) | |
tree | 9613e1deb5199ee8299bf668e997a2ed91ecfe0b /proc/notify.c | |
parent | 2c6c2b011eda70abac23c6ff9702917485f9ed3b (diff) | |
download | hurd-111e1a54234613eb5055903cffa20d1f1e6a659e.tar.gz hurd-111e1a54234613eb5055903cffa20d1f1e6a659e.tar.bz2 hurd-111e1a54234613eb5055903cffa20d1f1e6a659e.zip |
proc: Use ports_request_dead_name_notification ()
Diffstat (limited to 'proc/notify.c')
-rw-r--r-- | proc/notify.c | 39 |
1 files changed, 13 insertions, 26 deletions
diff --git a/proc/notify.c b/proc/notify.c index 8d694458..41a34112 100644 --- a/proc/notify.c +++ b/proc/notify.c @@ -1,5 +1,6 @@ /* Handle notifications - Copyright (C) 1992, 1993, 1994, 1996, 1999 Free Software Foundation, Inc. + Copyright (C) 1992, 1993, 1994, 1996, 1999, 2021 + Free Software Foundation, Inc. This file is part of the GNU Hurd. @@ -17,7 +18,7 @@ along with the GNU Hurd; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* Written by Michael I. Bushnell. */ +/* Written by Michael I. Bushnell and Sergey Bugaev. */ #include <mach.h> #include <sys/types.h> @@ -33,40 +34,26 @@ #include "notify_S.h" /* We ask for dead name notifications to detect when tasks and - message ports die. Both notifications get sent to the process - port. */ + message ports die. All notifications get sent to the notify + port. */ kern_return_t do_mach_notify_dead_name (struct port_info *pi, - mach_port_t deadport) + mach_port_t dead_name) { struct proc *p; - if (!pi) + if (!pi || !ports_port_is_notify (pi)) return EOPNOTSUPP; - if (pi->port_right == generic_port) - { - check_dead_execdata_notify (deadport); - mach_port_deallocate (mach_task_self (), deadport); - return 0; - } + check_dead_execdata_notify (dead_name); - p = (struct proc *) pi; + p = task_find_nocreate (dead_name); + if (p) + process_has_exited (p); - if (p->p_pi.bucket != proc_bucket - || p->p_pi.class != proc_class) - return EOPNOTSUPP; + mach_port_deallocate (mach_task_self (), dead_name); - if (p->p_task == deadport) - { - process_has_exited (p); - mach_port_deallocate (mach_task_self (), deadport); - return 0; - } - else - { - return EINVAL; - } + return 0; } /* We get no-senders notifications on exception ports that we |