Changeset View
Changeset View
Standalone View
Standalone View
head/sys/fs/devfs/devfs_vnops.c
Show First 20 Lines • Show All 823 Lines • ▼ Show 20 Lines | default: | ||||
error = dsw->d_ioctl(dev, com, ap->a_data, ap->a_fflag, td); | error = dsw->d_ioctl(dev, com, ap->a_data, ap->a_fflag, td); | ||||
} | } | ||||
dev_relthread(dev, ref); | dev_relthread(dev, ref); | ||||
if (error == ENOIOCTL) | if (error == ENOIOCTL) | ||||
error = ENOTTY; | error = ENOTTY; | ||||
if (error == 0 && com == TIOCSCTTY) { | if (error == 0 && com == TIOCSCTTY) { | ||||
/* Do nothing if reassigning same control tty */ | /* | ||||
* Do nothing if reassigning same control tty, or if the | |||||
* control tty has already disappeared. If it disappeared, | |||||
* it's because we were racing with TIOCNOTTY. TIOCNOTTY | |||||
* already took care of releasing the old vnode and we have | |||||
* nothing left to do. | |||||
*/ | |||||
sx_slock(&proctree_lock); | sx_slock(&proctree_lock); | ||||
if (td->td_proc->p_session->s_ttyvp == vp) { | if (td->td_proc->p_session->s_ttyvp == vp || | ||||
td->td_proc->p_session->s_ttyp == NULL) { | |||||
sx_sunlock(&proctree_lock); | sx_sunlock(&proctree_lock); | ||||
return (0); | return (0); | ||||
} | } | ||||
vpold = td->td_proc->p_session->s_ttyvp; | vpold = td->td_proc->p_session->s_ttyvp; | ||||
VREF(vp); | VREF(vp); | ||||
SESS_LOCK(td->td_proc->p_session); | SESS_LOCK(td->td_proc->p_session); | ||||
td->td_proc->p_session->s_ttyvp = vp; | td->td_proc->p_session->s_ttyvp = vp; | ||||
▲ Show 20 Lines • Show All 1,131 Lines • Show Last 20 Lines |