summaryrefslogtreecommitdiffstats
path: root/sys/kern/tty.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2002-04-01 21:31:13 +0000
committerjhb <jhb@FreeBSD.org>2002-04-01 21:31:13 +0000
commitdc2e474f79c1287592679cd5e0c4c2307feccd60 (patch)
tree79021f0d43a5858be317d5cd33eac8cd4962b336 /sys/kern/tty.c
parent34c7d606c9818987384d404948ecdc98521462bd (diff)
downloadFreeBSD-src-dc2e474f79c1287592679cd5e0c4c2307feccd60.zip
FreeBSD-src-dc2e474f79c1287592679cd5e0c4c2307feccd60.tar.gz
Change the suser() API to take advantage of td_ucred as well as do a
general cleanup of the API. The entire API now consists of two functions similar to the pre-KSE API. The suser() function takes a thread pointer as its only argument. The td_ucred member of this thread must be valid so the only valid thread pointers are curthread and a few kernel threads such as thread0. The suser_cred() function takes a pointer to a struct ucred as its first argument and an integer flag as its second argument. The flag is currently only used for the PRISON_ROOT flag. Discussed on: smp@
Diffstat (limited to 'sys/kern/tty.c')
-rw-r--r--sys/kern/tty.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index c9a56fd..1214513 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -730,9 +730,11 @@ ttioctl(tp, cmd, data, flag)
void *data;
{
register struct proc *p;
+ struct thread *td;
int s, error;
- p = curproc; /* XXX */
+ td = curthread; /* XXX */
+ p = td->td_proc;
/* If the ioctl involves modification, hang if in the background. */
switch (cmd) {
@@ -851,7 +853,7 @@ ttioctl(tp, cmd, data, flag)
ISSET(constty->t_state, TS_CONNECTED))
return (EBUSY);
#ifndef UCONSOLE
- if ((error = suser_xxx(p->p_ucred, NULL, 0)) != 0)
+ if ((error = suser(td)) != 0)
return (error);
#endif
constty = tp;
@@ -1023,9 +1025,9 @@ ttioctl(tp, cmd, data, flag)
splx(s);
break;
case TIOCSTI: /* simulate terminal input */
- if ((flag & FREAD) == 0 && suser_xxx(p->p_ucred, NULL, 0))
+ if ((flag & FREAD) == 0 && suser(td))
return (EPERM);
- if (!isctty(p, tp) && suser_xxx(p->p_ucred, NULL, 0))
+ if (!isctty(p, tp) && suser(td))
return (EACCES);
s = spltty();
(*linesw[tp->t_line].l_rint)(*(u_char *)data, tp);
@@ -1099,7 +1101,7 @@ ttioctl(tp, cmd, data, flag)
}
break;
case TIOCSDRAINWAIT:
- error = suser_xxx(p->p_ucred, NULL, 0);
+ error = suser(td);
if (error)
return (error);
tp->t_timeout = *(int *)data * hz;
OpenPOWER on IntegriCloud