projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use vn_close rather than vrele after vn_open
[unix-history]
/
usr
/
src
/
sys
/
kern
/
tty_tty.c
diff --git
a/usr/src/sys/kern/tty_tty.c
b/usr/src/sys/kern/tty_tty.c
index
53b29dc
..
6a3c8fa
100644
(file)
--- a/
usr/src/sys/kern/tty_tty.c
+++ b/
usr/src/sys/kern/tty_tty.c
@@
-1,9
+1,10
@@
-/*
- * Copyright (c) 1982, 1986 Regents of the University of California.
- * All rights reserved. The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+/*-
+ * Copyright (c) 1982, 1986, 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * %sccs.include.redist.c%
*
*
- * @(#)tty_tty.c 7.1
0
(Berkeley) %G%
+ * @(#)tty_tty.c 7.1
5
(Berkeley) %G%
*/
/*
*/
/*
@@
-12,22
+13,20
@@
#include "param.h"
#include "systm.h"
#include "conf.h"
#include "param.h"
#include "systm.h"
#include "conf.h"
-#include "user.h"
#include "ioctl.h"
#include "tty.h"
#include "proc.h"
#include "vnode.h"
#include "file.h"
#include "ioctl.h"
#include "tty.h"
#include "proc.h"
#include "vnode.h"
#include "file.h"
-#include "uio.h"
#define cttyvp(p) ((p)->p_flag&SCTTY ? (p)->p_session->s_ttyvp : NULL)
/*ARGSUSED*/
#define cttyvp(p) ((p)->p_flag&SCTTY ? (p)->p_session->s_ttyvp : NULL)
/*ARGSUSED*/
-cttyopen(dev, flag)
+cttyopen(dev, flag
, mode, p
)
dev_t dev;
dev_t dev;
- int flag;
+ int flag, mode;
+ struct proc *p;
{
{
- struct proc *p = curproc;
struct vnode *ttyvp = cttyvp(p);
int error;
struct vnode *ttyvp = cttyvp(p);
int error;
@@
-35,11
+34,11
@@
cttyopen(dev, flag)
return (ENXIO);
VOP_LOCK(ttyvp);
error = VOP_ACCESS(ttyvp,
return (ENXIO);
VOP_LOCK(ttyvp);
error = VOP_ACCESS(ttyvp,
- (flag&FREAD ? VREAD : 0) | (flag&FWRITE ? VWRITE : 0), p->p_ucred);
+ (flag&FREAD ? VREAD : 0) | (flag&FWRITE ? VWRITE : 0), p->p_ucred, p);
+ if (!error)
+ error = VOP_OPEN(ttyvp, flag, NOCRED, p);
VOP_UNLOCK(ttyvp);
VOP_UNLOCK(ttyvp);
- if (error)
- return (error);
- return (VOP_OPEN(ttyvp, flag, NOCRED));
+ return (error);
}
/*ARGSUSED*/
}
/*ARGSUSED*/
@@
-47,11
+46,11
@@
cttyread(dev, uio, flag)
dev_t dev;
struct uio *uio;
{
dev_t dev;
struct uio *uio;
{
- register struct vnode *ttyvp = cttyvp(
curproc
);
+ register struct vnode *ttyvp = cttyvp(
uio->uio_procp
);
int error;
if (ttyvp == NULL)
int error;
if (ttyvp == NULL)
- return (E
NX
IO);
+ return (EIO);
VOP_LOCK(ttyvp);
error = VOP_READ(ttyvp, uio, flag, NOCRED);
VOP_UNLOCK(ttyvp);
VOP_LOCK(ttyvp);
error = VOP_READ(ttyvp, uio, flag, NOCRED);
VOP_UNLOCK(ttyvp);
@@
-63,11
+62,11
@@
cttywrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
{
dev_t dev;
struct uio *uio;
{
- register struct vnode *ttyvp = cttyvp(
curproc
);
+ register struct vnode *ttyvp = cttyvp(
uio->uio_procp
);
int error;
if (ttyvp == NULL)
int error;
if (ttyvp == NULL)
- return (E
NX
IO);
+ return (EIO);
VOP_LOCK(ttyvp);
error = VOP_WRITE(ttyvp, uio, flag, NOCRED);
VOP_UNLOCK(ttyvp);
VOP_LOCK(ttyvp);
error = VOP_WRITE(ttyvp, uio, flag, NOCRED);
VOP_UNLOCK(ttyvp);
@@
-75,34
+74,36
@@
cttywrite(dev, uio, flag)
}
/*ARGSUSED*/
}
/*ARGSUSED*/
-cttyioctl(dev, cmd, addr, flag)
+cttyioctl(dev, cmd, addr, flag
, p
)
dev_t dev;
int cmd;
caddr_t addr;
int flag;
dev_t dev;
int cmd;
caddr_t addr;
int flag;
+ struct proc *p;
{
{
- struct vnode *ttyvp = cttyvp(
curproc
);
+ struct vnode *ttyvp = cttyvp(
p
);
if (ttyvp == NULL)
if (ttyvp == NULL)
- return (E
NX
IO);
+ return (EIO);
if (cmd == TIOCNOTTY) {
if (cmd == TIOCNOTTY) {
- if (!SESS_LEADER(
curproc
)) {
-
curproc
->p_flag &= ~SCTTY;
+ if (!SESS_LEADER(
p
)) {
+
p
->p_flag &= ~SCTTY;
return (0);
} else
return (EINVAL);
}
return (0);
} else
return (EINVAL);
}
- return (VOP_IOCTL(ttyvp, cmd, addr, flag, NOCRED));
+ return (VOP_IOCTL(ttyvp, cmd, addr, flag, NOCRED
, p
));
}
/*ARGSUSED*/
}
/*ARGSUSED*/
-cttyselect(dev, flag)
+cttyselect(dev, flag
, p
)
dev_t dev;
int flag;
dev_t dev;
int flag;
+ struct proc *p;
{
{
- struct vnode *ttyvp = cttyvp(
curproc
);
+ struct vnode *ttyvp = cttyvp(
p
);
if (ttyvp == NULL)
return (1); /* try operation to get EOF/failure */
if (ttyvp == NULL)
return (1); /* try operation to get EOF/failure */
- return (VOP_SELECT(ttyvp, flag, FREAD|FWRITE, NOCRED));
+ return (VOP_SELECT(ttyvp, flag, FREAD|FWRITE, NOCRED
, p
));
}
}