diff options
author | Miles Bader <miles@gnu.org> | 1995-12-21 16:45:27 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1995-12-21 16:45:27 +0000 |
commit | 7de3393e3983036f1e8c46322ea7c820bd31a363 (patch) | |
tree | d8d0d6ed1f623e31d272b9af9fe5a271e3e855e1 /proc | |
parent | fc08880d48190b3c4845dc5e7354ba1ce62e6f0a (diff) |
(free_session): Correctly get rid of the receive right we're holding.
(S_proc_getsidport): Add and use new arg sessport_type. Return errors.
Diffstat (limited to 'proc')
-rw-r--r-- | proc/pgrp.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/proc/pgrp.c b/proc/pgrp.c index 0601bb64..5af36aeb 100644 --- a/proc/pgrp.c +++ b/proc/pgrp.c @@ -76,7 +76,7 @@ free_session (struct session *s) { if (s->s_sessionid) mach_port_mod_refs (mach_task_self (), s->s_sessionid, - MACH_PORT_RIGHT_RECEIVE, 1); + MACH_PORT_RIGHT_RECEIVE, -1); remove_session_from_hash (s); free (s); } @@ -260,18 +260,20 @@ S_proc_getpgrppids (struct proc *callerp, /* Implement proc_getsidport as described in <hurd/proc.defs>. */ kern_return_t S_proc_getsidport (struct proc *p, - mach_port_t *sessport) + mach_port_t *sessport, mach_msg_type_name_t *sessport_type) { + error_t err = 0; if (!p->p_pgrp) *sessport = MACH_PORT_NULL; else { - if (!p->p_pgrp->pg_session->s_sessionid) - mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE, - &p->p_pgrp->pg_session->s_sessionid); + if (p->p_pgrp->pg_session->s_sessionid == MACH_PORT_NULL) + err = mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE, + &p->p_pgrp->pg_session->s_sessionid); *sessport = p->p_pgrp->pg_session->s_sessionid; } - return 0; + *sessport_type = MACH_MSG_TYPE_MAKE_SEND_ONCE; + return err; } /* Implement proc_setpgrp as described in <hurd/proc.defs>. */ |