Hold thread reference while we frob cdevsw.

This commit is contained in:
Poul-Henning Kamp 2004-09-24 08:12:41 +00:00
parent 9fb3aed0f6
commit 969d098b0f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=135724

View File

@ -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