diff options
author | mav <mav@FreeBSD.org> | 2008-12-13 21:17:46 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2008-12-13 21:17:46 +0000 |
commit | 37aff7daa7032f0fb1c864a4f83d04aa3c7bf5ea (patch) | |
tree | d9e25fe3d039b5ca9124d8b071d6154220f8dcb3 /sys/netgraph | |
parent | 1d585eec2563a0e5077fe0c6f7c32e6d74edc663 (diff) | |
download | FreeBSD-src-37aff7daa7032f0fb1c864a4f83d04aa3c7bf5ea.zip FreeBSD-src-37aff7daa7032f0fb1c864a4f83d04aa3c7bf5ea.tar.gz |
Change ttyhook_register() second argument from thread to process pointer.
Thread was not really needed there, while previous ng_tty implementation
that used thread pointer had locking issues (using sx while holding mutex).
Diffstat (limited to 'sys/netgraph')
-rw-r--r-- | sys/netgraph/ng_tty.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/netgraph/ng_tty.c b/sys/netgraph/ng_tty.c index c504b84..0e69e77 100644 --- a/sys/netgraph/ng_tty.c +++ b/sys/netgraph/ng_tty.c @@ -252,7 +252,6 @@ static int ngt_rcvmsg(node_p node, item_p item, hook_p lasthook) { struct proc *p; - struct thread *td; const sc_p sc = NG_NODE_PRIVATE(node); struct ng_mesg *msg, *resp = NULL; int error = 0; @@ -266,12 +265,13 @@ ngt_rcvmsg(node_p node, item_p item, hook_p lasthook) return (EBUSY); p = pfind(((int *)msg->data)[0]); - if (p == NULL) + if (p == NULL || (p->p_flag & P_WEXIT)) return (ESRCH); - td = FIRST_THREAD_IN_PROC(p); - error = ttyhook_register(&sc->tp, td, ((int *)msg->data)[1], - &ngt_hook, sc); + _PHOLD(p); PROC_UNLOCK(p); + error = ttyhook_register(&sc->tp, p, ((int *)msg->data)[1], + &ngt_hook, sc); + PRELE(p); if (error != 0) return (error); break; |