diff options
-rw-r--r-- | proc/ChangeLog | 12 | ||||
-rw-r--r-- | proc/mgt.c | 4 | ||||
-rw-r--r-- | proc/msg.c | 33 | ||||
-rw-r--r-- | proc/notify.c | 8 | ||||
-rw-r--r-- | proc/proc.h | 3 |
5 files changed, 33 insertions, 27 deletions
diff --git a/proc/ChangeLog b/proc/ChangeLog index 94c9acbd..2edfb145 100644 --- a/proc/ChangeLog +++ b/proc/ChangeLog @@ -1,5 +1,17 @@ Tue Mar 9 13:11:43 1999 Thomas Bushnell, BSG <tb@mit.edu> + * notify.c (do_mach_notify_dead_name): Don't check against + P->p_msgport anymore. + * msg.c (message_port_dead): Delete function. + (S_proc_setmsgport): Don't request a dead-name notification + anymore. + (S_proc_getmsgport): Check to see if P->p_msgport is dead before + returning it. + * mgt.c (S_proc_reassign): Only use mach_port_deallocate to + release P->msgport. + (process_has_exited): Likewise. + * proc.h (message_port_dead): Delete prototype. + * mgt.c (S_proc_reassign): It's not necessary to re-request the task-death notification; we've moved both the task right and the proc port that gets the notification, so delete that. @@ -229,7 +229,7 @@ S_proc_reassign (struct proc *p, destroy them. */ if (p->p_msgport != MACH_PORT_NULL) { - mach_port_destroy (mach_task_self (), p->p_msgport); + mach_port_deallocate (mach_task_self (), p->p_msgport); p->p_msgport = MACH_PORT_NULL; p->p_deadmsg = 1; } @@ -644,7 +644,7 @@ process_has_exited (struct proc *p) alert_parent (p); if (p->p_msgport) - mach_port_destroy (mach_task_self (), p->p_msgport); + mach_port_deallocate (mach_task_self (), p->p_msgport); p->p_msgport = MACH_PORT_NULL; prociterate ((void (*) (struct proc *, void *))check_message_dying, p); @@ -1,5 +1,5 @@ /* Message port manipulations - Copyright (C) 1994, 1995, 1996 Free Software Foundation + Copyright (C) 1994, 1995, 1996, 1999 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -63,12 +63,6 @@ S_proc_setmsgport (struct proc *p, prociterate (check_message_return, p); p->p_checkmsghangs = 0; - mach_port_request_notification (mach_task_self (), msgport, - MACH_NOTIFY_DEAD_NAME, 1, p->p_pi.port_right, - MACH_MSG_TYPE_MAKE_SEND_ONCE, &foo); - if (foo) - mach_port_deallocate (mach_task_self (), foo); - if (p == startup_proc) /* Init is single threaded, so we can't delay our reply for the essential task RPC; spawn a thread to do it. */ @@ -98,10 +92,13 @@ S_proc_getmsgport (struct proc *callerp, { int cancel; struct proc *p = pid_find_allow_zombie (pid); + error_t err; + mach_port_urefs_t refs; if (!callerp) return EOPNOTSUPP; - + +restart: while (p && p->p_deadmsg && !p->p_dead) { callerp->p_msgportwait = 1; @@ -119,15 +116,19 @@ S_proc_getmsgport (struct proc *callerp, if (!p) return ESRCH; + err = mach_port_get_refs (mach_task_self (), p->p_msgport, + MACH_PORT_RIGHT_SEND, &refs); + if (err || !refs) + { + /* The port appears to be dead; throw it away. */ + mach_port_deallocate (mach_task_self (), p->p_msgport); + p->p_msgport = MACH_PORT_NULL; + p->p_deadmsg = 1; + goto restart; + } + *msgport = p->p_msgport; - return 0; -} -void -message_port_dead (struct proc *p) -{ - mach_port_deallocate (mach_task_self (), p->p_msgport); - p->p_msgport = MACH_PORT_NULL; - p->p_deadmsg = 1; + return 0; } diff --git a/proc/notify.c b/proc/notify.c index 7ab8d56b..d0fd2f60 100644 --- a/proc/notify.c +++ b/proc/notify.c @@ -57,13 +57,7 @@ do_mach_notify_dead_name (mach_port_t notify, return EOPNOTSUPP; } - if (p->p_msgport == deadport) - { - message_port_dead (p); - ports_port_deref (p); - return 0; - } - else if (p->p_task == deadport) + if (p->p_task == deadport) { process_has_exited (p); ports_port_deref (p); diff --git a/proc/proc.h b/proc/proc.h index 8a84ddc7..d591b4ea 100644 --- a/proc/proc.h +++ b/proc/proc.h @@ -1,5 +1,5 @@ /* Process server definitions - Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1992, 1993, 1994, 1995, 1996, 1999 Free Software Foundation, Inc. This file is part of the GNU Hurd. @@ -165,7 +165,6 @@ int genpid (); void abort_getmsgport (struct proc *); int zombie_check_pid (pid_t); void check_message_dying (struct proc *, struct proc *); -void message_port_dead (struct proc *); void check_dead_execdata_notify (mach_port_t); void add_proc_to_hash (struct proc *); |