aboutsummaryrefslogtreecommitdiff
path: root/sys/netgraph
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2008-11-08 06:25:57 +0000
committerAlexander Motin <mav@FreeBSD.org>2008-11-08 06:25:57 +0000
commit45056382d09b2a6e1cb09569a9cb54a36f025449 (patch)
treea3aad7de5faa584b08b414c3ab96a7a2e9de5e22 /sys/netgraph
parent85ae3122e923a3055827f62495be7fefc58d8453 (diff)
Notes
Diffstat (limited to 'sys/netgraph')
-rw-r--r--sys/netgraph/ng_tty.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/netgraph/ng_tty.c b/sys/netgraph/ng_tty.c
index 5cab9717fece..c504b8479f9e 100644
--- a/sys/netgraph/ng_tty.c
+++ b/sys/netgraph/ng_tty.c
@@ -73,6 +73,7 @@
#include <sys/syslog.h>
#include <sys/tty.h>
#include <sys/ttycom.h>
+#include <sys/proc.h>
#include <net/if.h>
#include <net/if_var.h>
@@ -250,7 +251,8 @@ ngt_shutdown(node_p node)
static int
ngt_rcvmsg(node_p node, item_p item, hook_p lasthook)
{
- struct thread *td = curthread; /* XXX */
+ struct proc *p;
+ struct thread *td;
const sc_p sc = NG_NODE_PRIVATE(node);
struct ng_mesg *msg, *resp = NULL;
int error = 0;
@@ -262,8 +264,14 @@ ngt_rcvmsg(node_p node, item_p item, hook_p lasthook)
case NGM_TTY_SET_TTY:
if (sc->tp != NULL)
return (EBUSY);
- error = ttyhook_register(&sc->tp, td, *(int *)msg->data,
+
+ p = pfind(((int *)msg->data)[0]);
+ if (p == NULL)
+ return (ESRCH);
+ td = FIRST_THREAD_IN_PROC(p);
+ error = ttyhook_register(&sc->tp, td, ((int *)msg->data)[1],
&ngt_hook, sc);
+ PROC_UNLOCK(p);
if (error != 0)
return (error);
break;