summaryrefslogtreecommitdiffstats
path: root/sys/dev/snp
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-09-24 08:12:41 +0000
committerphk <phk@FreeBSD.org>2004-09-24 08:12:41 +0000
commit5dd2cd84fe935437286d31918a2e395dd887d352 (patch)
tree572cca4c1b81538ce656a5490678b6a185db5edd /sys/dev/snp
parenta67be8b6bef6cda9099fa8528cc3b8ea9c1b4cf3 (diff)
downloadFreeBSD-src-5dd2cd84fe935437286d31918a2e395dd887d352.zip
FreeBSD-src-5dd2cd84fe935437286d31918a2e395dd887d352.tar.gz
Hold thread reference while we frob cdevsw.
Diffstat (limited to 'sys/dev/snp')
-rw-r--r--sys/dev/snp/snp.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c
index 6103a5d..a414d7c 100644
--- a/sys/dev/snp/snp.c
+++ b/sys/dev/snp/snp.c
@@ -184,11 +184,17 @@ snpdevtotty(dev)
struct cdev *dev;
{
struct cdevsw *cdp;
+ struct tty *tp;
- cdp = devsw(dev);
- if (cdp == NULL || (cdp->d_flags & D_TTY) == 0)
+ cdp = dev_refthread(dev);
+ if (cdp == NULL)
return (NULL);
- return (dev->si_tty);
+ if (!(cdp->d_flags & D_TTY))
+ tp = NULL;
+ else
+ tp = dev->si_tty;
+ dev_relthread(dev);
+ return (tp);
}
#define SNP_INPUT_BUF 5 /* This is even too much, the maximal
OpenPOWER on IntegriCloud