Stop abusing the pgrpsess_lock.
This commit is contained in:
parent
aa3bf85c54
commit
183ccde6c6
@ -1862,14 +1862,12 @@ setlogin(td, uap)
|
||||
if (error == ENAMETOOLONG)
|
||||
error = EINVAL;
|
||||
else if (!error) {
|
||||
PGRPSESS_XLOCK();
|
||||
PROC_LOCK(p);
|
||||
SESS_LOCK(p->p_session);
|
||||
(void) memcpy(p->p_session->s_login, logintmp,
|
||||
sizeof(logintmp));
|
||||
SESS_UNLOCK(p->p_session);
|
||||
PROC_UNLOCK(p);
|
||||
PGRPSESS_XUNLOCK();
|
||||
}
|
||||
done2:
|
||||
mtx_unlock(&Giant);
|
||||
|
@ -157,7 +157,6 @@ tprintf(struct proc *p, int pri, const char *fmt, ...)
|
||||
if (pri != -1)
|
||||
flags |= TOLOG;
|
||||
if (p != NULL) {
|
||||
PGRPSESS_XLOCK();
|
||||
PROC_LOCK(p);
|
||||
if (p->p_flag & P_CONTROLT && p->p_session->s_ttyvp) {
|
||||
SESS_LOCK(p->p_session);
|
||||
@ -172,7 +171,6 @@ tprintf(struct proc *p, int pri, const char *fmt, ...)
|
||||
tp = NULL;
|
||||
} else
|
||||
PROC_UNLOCK(p);
|
||||
PGRPSESS_XUNLOCK();
|
||||
}
|
||||
pca.pri = pri;
|
||||
pca.tty = tp;
|
||||
@ -181,11 +179,11 @@ tprintf(struct proc *p, int pri, const char *fmt, ...)
|
||||
retval = kvprintf(fmt, putchar, &pca, 10, ap);
|
||||
va_end(ap);
|
||||
if (shld) {
|
||||
PGRPSESS_XLOCK();
|
||||
PROC_LOCK(p);
|
||||
SESS_LOCK(p->p_session);
|
||||
SESSRELE(p->p_session);
|
||||
SESS_UNLOCK(p->p_session);
|
||||
PGRPSESS_XUNLOCK();
|
||||
PROC_UNLOCK(p);
|
||||
}
|
||||
msgbuftrigger = 1;
|
||||
}
|
||||
|
@ -1041,11 +1041,11 @@ ttioctl(tp, cmd, data, flag)
|
||||
break;
|
||||
case TIOCSCTTY: /* become controlling tty */
|
||||
/* Session ctty vnode pointer set in vnode layer. */
|
||||
PGRPSESS_XLOCK();
|
||||
PGRPSESS_SLOCK();
|
||||
if (!SESS_LEADER(p) ||
|
||||
((p->p_session->s_ttyvp || tp->t_session) &&
|
||||
(tp->t_session != p->p_session))) {
|
||||
PGRPSESS_XUNLOCK();
|
||||
PGRPSESS_SUNLOCK();
|
||||
return (EPERM);
|
||||
}
|
||||
tp->t_session = p->p_session;
|
||||
@ -1056,7 +1056,7 @@ ttioctl(tp, cmd, data, flag)
|
||||
PROC_LOCK(p);
|
||||
p->p_flag |= P_CONTROLT;
|
||||
PROC_UNLOCK(p);
|
||||
PGRPSESS_XUNLOCK();
|
||||
PGRPSESS_SUNLOCK();
|
||||
break;
|
||||
case TIOCSPGRP: { /* set pgrp of tty */
|
||||
register struct pgrp *pgrp;
|
||||
|
@ -660,9 +660,9 @@ vn_ioctl(fp, com, data, td)
|
||||
if (error == 0 && com == TIOCSCTTY) {
|
||||
|
||||
/* Do nothing if reassigning same control tty */
|
||||
PGRPSESS_XLOCK();
|
||||
PGRPSESS_SLOCK();
|
||||
if (td->td_proc->p_session->s_ttyvp == vp) {
|
||||
PGRPSESS_XUNLOCK();
|
||||
PGRPSESS_SUNLOCK();
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -672,7 +672,7 @@ vn_ioctl(fp, com, data, td)
|
||||
td->td_proc->p_session->s_ttyvp = vp;
|
||||
SESS_UNLOCK(td->td_proc->p_session);
|
||||
|
||||
PGRPSESS_XUNLOCK();
|
||||
PGRPSESS_SUNLOCK();
|
||||
|
||||
/* Get rid of reference to old control tty */
|
||||
if (vpold)
|
||||
|
Loading…
x
Reference in New Issue
Block a user