diff options
author | julian <julian@FreeBSD.org> | 2001-09-12 08:38:13 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 2001-09-12 08:38:13 +0000 |
commit | 5596676e6c6c1e81e899cd0531f9b1c28a292669 (patch) | |
tree | b1a19fcdf05759281fab0d89efb13f0fdf42102e /sys/kern/tty_tty.c | |
parent | 83e00d4274950d2b531c24692cd123538ffbddb9 (diff) | |
download | FreeBSD-src-5596676e6c6c1e81e899cd0531f9b1c28a292669.zip FreeBSD-src-5596676e6c6c1e81e899cd0531f9b1c28a292669.tar.gz |
KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.
Sorry john! (your next MFC will be a doosie!)
Reviewed by: peter@freebsd.org, dillon@freebsd.org
X-MFC after: ha ha ha ha
Diffstat (limited to 'sys/kern/tty_tty.c')
-rw-r--r-- | sys/kern/tty_tty.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c index b175719..1c6635c 100644 --- a/sys/kern/tty_tty.c +++ b/sys/kern/tty_tty.c @@ -71,23 +71,23 @@ static struct cdevsw ctty_cdevsw = { /* flags */ D_TTY, }; -#define cttyvp(p) ((p)->p_flag & P_CONTROLT ? (p)->p_session->s_ttyvp : NULL) +#define cttyvp(td) ((td)->td_proc->p_flag & P_CONTROLT ? (td)->td_proc->p_session->s_ttyvp : NULL) /*ARGSUSED*/ static int -cttyopen(dev, flag, mode, p) +cttyopen(dev, flag, mode, td) dev_t dev; int flag, mode; - struct proc *p; + struct thread *td; { - struct vnode *ttyvp = cttyvp(p); + struct vnode *ttyvp = cttyvp(td); int error; if (ttyvp == NULL) return (ENXIO); - vn_lock(ttyvp, LK_EXCLUSIVE | LK_RETRY, p); - error = VOP_OPEN(ttyvp, flag, NOCRED, p); - VOP_UNLOCK(ttyvp, 0, p); + vn_lock(ttyvp, LK_EXCLUSIVE | LK_RETRY, td); + error = VOP_OPEN(ttyvp, flag, NOCRED, td); + VOP_UNLOCK(ttyvp, 0, td); return (error); } @@ -98,15 +98,15 @@ cttyread(dev, uio, flag) struct uio *uio; int flag; { - struct proc *p = uio->uio_procp; - register struct vnode *ttyvp = cttyvp(p); + struct thread *td = uio->uio_td; + register struct vnode *ttyvp = cttyvp(td); int error; if (ttyvp == NULL) return (EIO); - vn_lock(ttyvp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(ttyvp, LK_EXCLUSIVE | LK_RETRY, td); error = VOP_READ(ttyvp, uio, flag, NOCRED); - VOP_UNLOCK(ttyvp, 0, p); + VOP_UNLOCK(ttyvp, 0, td); return (error); } @@ -117,8 +117,8 @@ cttywrite(dev, uio, flag) struct uio *uio; int flag; { - struct proc *p = uio->uio_procp; - struct vnode *ttyvp = cttyvp(uio->uio_procp); + struct thread *td = uio->uio_td; + struct vnode *ttyvp = cttyvp(uio->uio_td); struct mount *mp; int error; @@ -128,51 +128,51 @@ cttywrite(dev, uio, flag) if (ttyvp->v_type != VCHR && (error = vn_start_write(ttyvp, &mp, V_WAIT | PCATCH)) != 0) return (error); - vn_lock(ttyvp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(ttyvp, LK_EXCLUSIVE | LK_RETRY, td); error = VOP_WRITE(ttyvp, uio, flag, NOCRED); - VOP_UNLOCK(ttyvp, 0, p); + VOP_UNLOCK(ttyvp, 0, td); vn_finished_write(mp); return (error); } /*ARGSUSED*/ static int -cttyioctl(dev, cmd, addr, flag, p) +cttyioctl(dev, cmd, addr, flag, td) dev_t dev; u_long cmd; caddr_t addr; int flag; - struct proc *p; + struct thread *td; { - struct vnode *ttyvp = cttyvp(p); + struct vnode *ttyvp = cttyvp(td); if (ttyvp == NULL) return (EIO); if (cmd == TIOCSCTTY) /* don't allow controlling tty to be set */ return EINVAL; /* to controlling tty -- infinite recursion */ if (cmd == TIOCNOTTY) { - if (!SESS_LEADER(p)) { - p->p_flag &= ~P_CONTROLT; + if (!SESS_LEADER(td->td_proc)) { + td->td_proc->p_flag &= ~P_CONTROLT; return (0); } else return (EINVAL); } - return (VOP_IOCTL(ttyvp, cmd, addr, flag, NOCRED, p)); + return (VOP_IOCTL(ttyvp, cmd, addr, flag, NOCRED, td)); } /*ARGSUSED*/ static int -cttypoll(dev, events, p) +cttypoll(dev, events, td) dev_t dev; int events; - struct proc *p; + struct thread *td; { - struct vnode *ttyvp = cttyvp(p); + struct vnode *ttyvp = cttyvp(td); if (ttyvp == NULL) /* try operation to get EOF/failure */ - return (seltrue(dev, events, p)); - return (VOP_POLL(ttyvp, events, p->p_ucred, p)); + return (seltrue(dev, events, td)); + return (VOP_POLL(ttyvp, events, td->td_proc->p_ucred, td)); } static void ctty_clone __P((void *arg, char *name, int namelen, dev_t *dev)); @@ -188,7 +188,7 @@ ctty_clone(void *arg, char *name, int namelen, dev_t *dev) return; if (strcmp(name, "tty")) return; - vp = cttyvp(curproc); + vp = cttyvp(curthread); if (vp == NULL) { if (ctty) *dev = ctty; |