SCCS-vsn: sys/kern/tty_tty.c 7.10
SCCS-vsn: sys/kern/tty_subr.c 7.6
SCCS-vsn: sys/kern/tty.c 7.38
SCCS-vsn: sys/kern/kern_acct.c 7.15
SCCS-vsn: sys/kern/vfs_bio.c 7.34
SCCS-vsn: sys/kern/vfs_cluster.c 7.34
SCCS-vsn: sys/kern/kern_sysctl.c 7.13
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)kern_acct.c 7.14 (Berkeley) %G%
+ * @(#)kern_acct.c 7.15 (Berkeley) %G%
*/
#include "param.h"
#include "systm.h"
*/
#include "param.h"
#include "systm.h"
+#include "namei.h"
+#include "resourcevar.h"
#include "proc.h"
#include "ioctl.h"
#include "termios.h"
#include "tty.h"
#include "proc.h"
#include "ioctl.h"
#include "termios.h"
#include "tty.h"
#include "vnode.h"
#include "mount.h"
#include "kernel.h"
#include "file.h"
#include "acct.h"
#include "vnode.h"
#include "mount.h"
#include "kernel.h"
#include "file.h"
#include "acct.h"
int *retval;
{
register struct vnode *vp;
int *retval;
{
register struct vnode *vp;
- register struct nameidata *ndp = &u.u_nd;
extern int acctwatch();
struct vnode *oacctp;
int error;
extern int acctwatch();
struct vnode *oacctp;
int error;
- if (error = suser(u.u_cred, &u.u_acflag))
+ if (error = suser(p->p_ucred, &p->p_acflag))
return (error);
if (savacctp) {
acctp = savacctp;
return (error);
if (savacctp) {
acctp = savacctp;
- ndp->ni_segflg = UIO_USERSPACE;
- ndp->ni_dirp = uap->fname;
- if (error = vn_open(ndp, FWRITE, 0644))
+ nd.ni_segflg = UIO_USERSPACE;
+ nd.ni_dirp = uap->fname;
+ if (error = vn_open(&nd, p, FWRITE, 0644))
if (vp->v_type != VREG) {
vrele(vp);
return (EACCES);
if (vp->v_type != VREG) {
vrele(vp);
return (EACCES);
if ((vp = acctp) == NULL)
return (0);
bcopy(p->p_comm, ap->ac_comm, sizeof(ap->ac_comm));
if ((vp = acctp) == NULL)
return (0);
bcopy(p->p_comm, ap->ac_comm, sizeof(ap->ac_comm));
+ ru = &p->p_stats->p_ru;
s = splclock();
ut = p->p_utime;
st = p->p_stime;
s = splclock();
ut = p->p_utime;
st = p->p_stime;
splx(s);
ap->ac_utime = compress(ut.tv_sec, ut.tv_usec);
ap->ac_stime = compress(st.tv_sec, st.tv_usec);
splx(s);
ap->ac_utime = compress(ut.tv_sec, ut.tv_usec);
ap->ac_stime = compress(st.tv_sec, st.tv_usec);
- timevalsub(&t, &u.u_start);
+ timevalsub(&t, &p->p_stats->p_start);
ap->ac_etime = compress(t.tv_sec, t.tv_usec);
ap->ac_etime = compress(t.tv_sec, t.tv_usec);
- ap->ac_btime = u.u_start.tv_sec;
- ap->ac_uid = p->p_ruid;
- ap->ac_gid = p->p_rgid;
+ ap->ac_btime = p->p_stats->p_start.tv_sec;
+ ap->ac_uid = p->p_cred->p_ruid;
+ ap->ac_gid = p->p_cred->p_rgid;
t = st;
timevaladd(&t, &ut);
if (i = t.tv_sec * hz + t.tv_usec / tick)
t = st;
timevaladd(&t, &ut);
if (i = t.tv_sec * hz + t.tv_usec / tick)
- ap->ac_mem = (ru->ru_ixrss+ru->ru_idrss+ru->ru_isrss) / i;
+ ap->ac_mem = (ru->ru_ixrss + ru->ru_idrss + ru->ru_isrss) / i;
else
ap->ac_mem = 0;
ap->ac_io = compress(ru->ru_inblock + ru->ru_oublock, (long)0);
else
ap->ac_mem = 0;
ap->ac_io = compress(ru->ru_inblock + ru->ru_oublock, (long)0);
ap->ac_tty = p->p_session->s_ttyp->t_dev;
else
ap->ac_tty = NODEV;
ap->ac_tty = p->p_session->s_ttyp->t_dev;
else
ap->ac_tty = NODEV;
- ap->ac_flag = u.u_acflag;
+ ap->ac_flag = p->p_acflag;
return (vn_rdwr(UIO_WRITE, vp, (caddr_t)ap, sizeof (acctbuf),
return (vn_rdwr(UIO_WRITE, vp, (caddr_t)ap, sizeof (acctbuf),
- (off_t)0, UIO_SYSSPACE, IO_UNIT|IO_APPEND, u.u_cred, (int *)0));
+ (off_t)0, UIO_SYSSPACE, IO_UNIT|IO_APPEND, p->p_ucred, (int *)0));
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)kern_sysctl.c 7.12 (Berkeley) %G%
+ * @(#)kern_sysctl.c 7.13 (Berkeley) %G%
- int bufsize, /* max size of users buffer */
- needed, locked, (*server)(), error = 0;
+ int bufsize; /* max size of users buffer */
+ int needed, locked, (*server)(), error = 0;
- if (error = copyin((caddr_t)uap->size,
- (caddr_t)&bufsize, sizeof (bufsize)))
+ if (error = copyin((caddr_t)uap->size, (caddr_t)&bufsize,
+ sizeof (bufsize)))
goto done;
switch (ki_type(uap->op)) {
goto done;
switch (ki_type(uap->op)) {
break;
case KINFO_PROC_UID:
break;
case KINFO_PROC_UID:
- if (p->p_uid != (uid_t)arg)
+ if (p->p_ucred->cr_uid != (uid_t)arg)
continue;
break;
case KINFO_PROC_RUID:
continue;
break;
case KINFO_PROC_RUID:
- if (p->p_ruid != (uid_t)arg)
+ if (p->p_cred->p_ruid != (uid_t)arg)
return (error);
eproc.e_paddr = p;
eproc.e_sess = p->p_pgrp->pg_session;
return (error);
eproc.e_paddr = p;
eproc.e_sess = p->p_pgrp->pg_session;
+ eproc.e_pcred = *p->p_cred;
+ eproc.e_ucred = *p->p_ucred;
+ eproc.e_vm = *p->p_vmspace;
eproc.e_pgid = p->p_pgrp->pg_id;
eproc.e_jobc = p->p_pgrp->pg_jobc;
if ((p->p_flag&SCTTY) &&
eproc.e_pgid = p->p_pgrp->pg_id;
eproc.e_jobc = p->p_pgrp->pg_jobc;
if ((p->p_flag&SCTTY) &&
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)tty.c 7.37 (Berkeley) %G%
+ * @(#)tty.c 7.38 (Berkeley) %G%
};
extern struct tty *constty; /* temporary virtual console */
};
extern struct tty *constty; /* temporary virtual console */
-extern char partab[], maptab[];
/*
* Is 'c' a line delimiter ("break" character)?
/*
* Is 'c' a line delimiter ("break" character)?
ttychars(tp)
struct tty *tp;
{
ttychars(tp)
struct tty *tp;
{
bcopy(ttydefchars, tp->t_cc, sizeof(ttydefchars));
}
bcopy(ttydefchars, tp->t_cc, sizeof(ttydefchars));
}
- * Restart typewriter output following a delay
- * timeout.
- * The name of the routine is passed to the timeout
- * subroutine and it is called during a clock interrupt.
+ * Start output on the typewriter. It is used from the top half
+ * after some characters have been put on the output queue,
+ * from the interrupt routine to transmit the next
+ * character.
+ttstart(tp)
+ struct tty *tp;
+{
+
+ if (tp->t_oproc) /* kludge for pty */
+ (*tp->t_oproc)(tp);
+}
+
+ttrstrt(tp) /* XXX */
-/*
- * Start output on the typewriter. It is used from the top half
- * after some characters have been put on the output queue,
- * from the interrupt routine to transmit the next
- * character, and after a timeout has finished.
- */
-ttstart(tp)
- struct tty *tp;
-{
-
- if (tp->t_oproc) /* kludge for pty */
- (*tp->t_oproc)(tp);
-}
/*
* Common code for tty ioctls.
/*
* Common code for tty ioctls.
register struct tty *tp;
caddr_t data;
{
register struct tty *tp;
caddr_t data;
{
+ register struct proc *p = curproc; /* XXX */
extern int nldisp;
int soft;
int s, error;
extern int nldisp;
int soft;
int s, error;
case TIOCLSET:
case OTIOCSETD:
#endif
case TIOCLSET:
case OTIOCSETD:
#endif
- while (isbackground(u.u_procp, tp) &&
- u.u_procp->p_pgrp->pg_jobc &&
- (u.u_procp->p_flag&SVFORK) == 0 &&
- (u.u_procp->p_sigignore & sigmask(SIGTTOU)) == 0 &&
- (u.u_procp->p_sigmask & sigmask(SIGTTOU)) == 0) {
- pgsignal(u.u_procp->p_pgrp, SIGTTOU, 1);
+ while (isbackground(curproc, tp) &&
+ p->p_pgrp->pg_jobc && (p->p_flag&SPPWAIT) == 0 &&
+ (p->p_sigignore & sigmask(SIGTTOU)) == 0 &&
+ (p->p_sigmask & sigmask(SIGTTOU)) == 0) {
+ pgsignal(p->p_pgrp, SIGTTOU, 1);
if (error = ttysleep(tp, (caddr_t)&lbolt,
TTOPRI | PCATCH, ttybg, 0))
return (error);
if (error = ttysleep(tp, (caddr_t)&lbolt,
TTOPRI | PCATCH, ttybg, 0))
return (error);
* Simulate typing of a character at the terminal.
*/
case TIOCSTI:
* Simulate typing of a character at the terminal.
*/
case TIOCSTI:
- if (u.u_uid && (flag & FREAD) == 0)
+ if (p->p_ucred->cr_uid && (flag & FREAD) == 0)
- if (u.u_uid && !isctty(u.u_procp, tp))
+ if (p->p_ucred->cr_uid && !isctty(p, tp))
return (EACCES);
(*linesw[tp->t_line].l_rint)(*(char *)data, tp);
break;
return (EACCES);
(*linesw[tp->t_line].l_rint)(*(char *)data, tp);
break;
* Set terminal process group.
*/
case TIOCSPGRP: {
* Set terminal process group.
*/
case TIOCSPGRP: {
- register struct proc *p = u.u_procp;
register struct pgrp *pgrp = pgfind(*(int *)data);
if (!isctty(p, tp))
register struct pgrp *pgrp = pgfind(*(int *)data);
if (!isctty(p, tp))
- if (!isctty(u.u_procp, tp))
return (ENOTTY);
*(int *)data = tp->t_pgrp ? tp->t_pgrp->pg_id : NO_PID;
break;
return (ENOTTY);
*(int *)data = tp->t_pgrp ? tp->t_pgrp->pg_id : NO_PID;
break;
(TS_CARR_ON|TS_ISOPEN))
return (EBUSY);
#ifndef UCONSOLE
(TS_CARR_ON|TS_ISOPEN))
return (EBUSY);
#ifndef UCONSOLE
- if (error = suser(u.u_cred, &u.u_acflag))
+ if (error = suser(p->p_ucred, &p->p_acflag))
return (error);
#endif
constty = tp;
return (error);
#endif
constty = tp;
-#ifdef COMPAT_43
- case TIOCGETP:
- case TIOCSETP:
- case TIOCSETN:
- case TIOCGETC:
- case TIOCSETC:
- case TIOCSLTC:
- case TIOCGLTC:
- case TIOCLBIS:
- case TIOCLBIC:
- case TIOCLSET:
- case TIOCLGET:
- case OTIOCGETD:
- case OTIOCSETD:
- case OTIOCCONS:
- return(ttcompat(tp, com, data, flag));
-#endif
-
/* allow old ioctls for now */
case TIOCGETP:
case TIOCSETP:
/* allow old ioctls for now */
case TIOCGETP:
case TIOCSETP:
return(ottioctl(tp, com, data, flag));
default:
return(ottioctl(tp, com, data, flag));
default:
+#ifdef COMPAT_43
+ return (ttcompat(tp, com, data, flag));
+#else
if (tp->t_rsel && tp->t_rsel->p_wchan == (caddr_t)&selwait)
tp->t_state |= TS_RCOLL;
else
if (tp->t_rsel && tp->t_rsel->p_wchan == (caddr_t)&selwait)
tp->t_state |= TS_RCOLL;
else
- tp->t_rsel = u.u_procp;
if (tp->t_wsel && tp->t_wsel->p_wchan == (caddr_t)&selwait)
tp->t_state |= TS_WCOLL;
else
if (tp->t_wsel && tp->t_wsel->p_wchan == (caddr_t)&selwait)
tp->t_state |= TS_WCOLL;
else
- tp->t_wsel = u.u_procp;
}
if (CCEQ(cc[VSTART], c))
goto restartoutput;
}
if (CCEQ(cc[VSTART], c))
goto restartoutput;
- }
- /*
- * Non canonical mode, don't process line editing
- * characters; check high water mark for wakeup.
- *
- *
- */
- if (!(lflag&ICANON)) {
- if (tp->t_rawq.c_cc > TTYHOG) {
- if (iflag&IMAXBEL) {
- if (tp->t_outq.c_cc < tp->t_hiwat)
- (void) ttyoutput(CTRL('g'), tp);
- } else
- ttyflush(tp, FREAD | FWRITE);
- } else {
- if (putc(c, &tp->t_rawq) >= 0) {
- ttwakeup(tp);
- ttyecho(c, tp);
- }
- }
- goto endcase;
}
c = unputc(&tp->t_rawq);
} while (c != ' ' && c != '\t');
}
c = unputc(&tp->t_rawq);
} while (c != ' ' && c != '\t');
/*
* Check for input buffer overflow
*/
/*
* Check for input buffer overflow
*/
- if (tp->t_rawq.c_cc+tp->t_canq.c_cc >= TTYHOG) {
+ if (tp->t_rawq.c_cc + tp->t_canq.c_cc >= TTYHOG) {
if (iflag&IMAXBEL) {
if (tp->t_outq.c_cc < TTHIWAT(tp))
(void) ttyoutput(CTRL('g'), tp);
if (iflag&IMAXBEL) {
if (tp->t_outq.c_cc < TTHIWAT(tp))
(void) ttyoutput(CTRL('g'), tp);
* wakeup on seeing a line delimiter.
*/
if (putc(c, &tp->t_rawq) >= 0) {
* wakeup on seeing a line delimiter.
*/
if (putc(c, &tp->t_rawq) >= 0) {
+ if ((lflag&ICANON) == 0) {
+ ttwakeup(tp);
+ ttyecho(c, tp);
+ goto endcase;
+ }
if (ttbreakc(c)) {
tp->t_rocount = 0;
catq(&tp->t_rawq, &tp->t_canq);
if (ttbreakc(c)) {
tp->t_rocount = 0;
catq(&tp->t_rawq, &tp->t_canq);
return (c ? -1 : '\t');
}
if (c == CEOT && oflag&ONOEOT)
return (c ? -1 : '\t');
}
if (c == CEOT && oflag&ONOEOT)
tk_nout++;
tp->t_outcc++;
#ifdef notdef
tk_nout++;
tp->t_outcc++;
#ifdef notdef
return (c);
if ((tp->t_lflag&FLUSHO) == 0 && putc(c, &tp->t_outq))
return (c);
return (c);
if ((tp->t_lflag&FLUSHO) == 0 && putc(c, &tp->t_outq))
return (c);
- /*
- * Calculate delays.
- * The numbers here represent clock ticks
- * and are not necessarily optimal for all terminals.
- *
- * SHOULD JUST ALLOW USER TO SPECIFY DELAYS
- *
- * (actually, should THROW AWAY terminals which need delays)
- */
colp = &tp->t_col;
ctype = partab[c];
colp = &tp->t_col;
ctype = partab[c];
switch (ctype&077) {
case ORDINARY:
switch (ctype&077) {
case ORDINARY:
- /*
- * This macro is close enough to the correct thing;
- * it should be replaced by real user settable delays
- * in any event...
- */
-#define mstohz(ms) (((ms) * hz) >> 10)
- ctype = (tp->t_flags >> 8) & 03;
- if (ctype == 1) { /* tty 37 */
- if (*colp > 0) {
- c = (((unsigned)*colp) >> 4) + 3;
- if ((unsigned)c > 6)
- c = 6;
- }
- } else if (ctype == 2) /* vt05 */
- c = mstohz(100);
*colp = 0;
break;
case TAB:
*colp = 0;
break;
case TAB:
- ctype = (tp->t_flags >> 10) & 03;
- if (ctype == 1) { /* tty 37 */
- c = 1 - (*colp | ~07);
- if (c < 5)
- c = 0;
- }
*colp |= 07;
(*colp)++;
break;
*colp |= 07;
(*colp)++;
break;
- case VTAB:
- if (tp->t_flags&VTDELAY) /* tty 37 */
- c = 0177;
- break;
-
- ctype = (tp->t_flags >> 12) & 03;
- if (ctype == 1) /* tn 300 */
- c = mstohz(83);
- else if (ctype == 2) /* ti 700 */
- c = mstohz(166);
- else if (ctype == 3) { /* concept 100 */
- int i;
-
- if ((i = *colp) >= 0)
- for (; i < 9; i++)
- (void) putc(0177, &tp->t_outq);
- }
- if (c && (tp->t_lflag&FLUSHO) == 0)
- (void) putc(c|TTY_QUOTE, &tp->t_outq);
/*
* Called from device's read routine after it has
/*
* Called from device's read routine after it has
/*
* Hang process if it's in the background.
*/
/*
* Hang process if it's in the background.
*/
- if (isbackground(u.u_procp, tp)) {
- if ((u.u_procp->p_sigignore & sigmask(SIGTTIN)) ||
- (u.u_procp->p_sigmask & sigmask(SIGTTIN)) ||
- u.u_procp->p_flag&SVFORK || u.u_procp->p_pgrp->pg_jobc == 0)
+ if (isbackground(p, tp)) {
+ if ((p->p_sigignore & sigmask(SIGTTIN)) ||
+ (p->p_sigmask & sigmask(SIGTTIN)) ||
+ p->p_flag&SPPWAIT || p->p_pgrp->pg_jobc == 0)
- pgsignal(u.u_procp->p_pgrp, SIGTTIN, 1);
+ pgsignal(p->p_pgrp, SIGTTIN, 1);
if (error = ttysleep(tp, (caddr_t)&lbolt, TTIPRI | PCATCH,
ttybg, 0))
return (error);
if (error = ttysleep(tp, (caddr_t)&lbolt, TTIPRI | PCATCH,
ttybg, 0))
return (error);
hiwat = tp->t_hiwat;
s = spltty();
hiwat = tp->t_hiwat;
s = spltty();
- oldsig = u.u_procp->p_sig;
+ oldsig = curproc->p_sig;
if (tp->t_outq.c_cc > hiwat + 200)
while (tp->t_outq.c_cc > hiwat) {
ttstart(tp);
if (tp->t_outq.c_cc > hiwat + 200)
while (tp->t_outq.c_cc > hiwat) {
ttstart(tp);
- if (wait == 0 || u.u_procp->p_sig != oldsig) {
+ if (wait == 0 || curproc->p_sig != oldsig) {
{
register char *cp;
register int cc = 0, ce;
{
register char *cp;
register int cc = 0, ce;
+ register struct proc *p = curproc;
int i, hiwat, cnt, error, s;
char obuf[OBUFSIZ];
int i, hiwat, cnt, error, s;
char obuf[OBUFSIZ];
/*
* Hang the process if it's in the background.
*/
/*
* Hang the process if it's in the background.
*/
- (tp->t_lflag&TOSTOP) && (u.u_procp->p_flag&SVFORK)==0 &&
- (u.u_procp->p_sigignore & sigmask(SIGTTOU)) == 0 &&
- (u.u_procp->p_sigmask & sigmask(SIGTTOU)) == 0 &&
- u.u_procp->p_pgrp->pg_jobc) {
- pgsignal(u.u_procp->p_pgrp, SIGTTOU, 1);
+ if (isbackground(p, tp) &&
+ tp->t_lflag&TOSTOP && (p->p_flag&SPPWAIT) == 0 &&
+ (p->p_sigignore & sigmask(SIGTTOU)) == 0 &&
+ (p->p_sigmask & sigmask(SIGTTOU)) == 0 &&
+ p->p_pgrp->pg_jobc) {
+ pgsignal(p->p_pgrp, SIGTTOU, 1);
if (error = ttysleep(tp, (caddr_t)&lbolt, TTIPRI | PCATCH,
ttybg, 0))
goto out;
if (error = ttysleep(tp, (caddr_t)&lbolt, TTIPRI | PCATCH,
ttybg, 0))
goto out;
case BACKSPACE:
case CONTROL:
case RETURN:
case BACKSPACE:
case CONTROL:
case RETURN:
- case NEWLINE: /* XXX can't happen ? */
if (tp->t_lflag&ECHOCTL)
ttyrubo(tp, 2);
break;
if (tp->t_lflag&ECHOCTL)
ttyrubo(tp, 2);
break;
+ register struct tty *tp;
-ttspeedtab(speed, table)
- struct speedtab table[];
-{
- register int i;
-
- for (i = 0; table[i].sp_speed != -1; i++)
- if (table[i].sp_speed == speed)
- return(table[i].sp_code);
- return(-1);
-}
-
-int ttyhostname = 0;
/*
* (^T)
* Report on state of foreground process group.
/*
* (^T)
* Report on state of foreground process group.
s = splclock();
utime = pick->p_utime;
stime = pick->p_stime;
s = splclock();
utime = pick->p_utime;
stime = pick->p_stime;
splx(s);
/* user time */
x = (utime.tv_usec + 5000) / 10000; /* scale to 100's */
splx(s);
/* user time */
x = (utime.tv_usec + 5000) / 10000; /* scale to 100's */
tputchar('.', tp);
ttyoutint(x%100, 10, 2, tp);
#endif
tputchar('.', tp);
ttyoutint(x%100, 10, 2, tp);
#endif
- ttyprintf(tp, "%% %dk\n", pgtok(pick->p_rssize));
+ ttyprintf(tp, "%% %dk\n", pgtok(pick->p_vmspace->vm_rssize));
}
tp->t_rocount = 0; /* so pending input will be retyped if BS */
}
}
tp->t_rocount = 0; /* so pending input will be retyped if BS */
}
return (1);
if (p2->p_flag&SSINTR && (p1->p_flag&SSINTR) == 0)
return (0);
return (1);
if (p2->p_flag&SSINTR && (p1->p_flag&SSINTR) == 0)
return (0);
- return(p2->p_pid > p1->p_pid); /* tie - return highest pid */
+ return (p2->p_pid > p1->p_pid); /* tie - return highest pid */
+/* XXX move to subr_prf.c */
#define TOTTY 0x2 /* XXX should be in header */
/*VARARGS2*/
ttyprintf(tp, fmt, x1)
#define TOTTY 0x2 /* XXX should be in header */
/*VARARGS2*/
ttyprintf(tp, fmt, x1)
- if ((tp->t_state & (TS_CARR_ON | TS_ISOPEN))
- == (TS_CARR_ON | TS_ISOPEN)) {
+ if ((tp->t_state & (TS_CARR_ON|TS_ISOPEN)) == (TS_CARR_ON|TS_ISOPEN)) {
if (c == '\n')
(void) ttyoutput('\r', tp);
(void) ttyoutput(c, tp);
if (c == '\n')
(void) ttyoutput('\r', tp);
(void) ttyoutput(c, tp);
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)tty_subr.c 7.5 (Berkeley) %G%
+ * @(#)tty_subr.c 7.6 (Berkeley) %G%
(int)(cp)&CROUND)
#define cbptr(x) ((struct cblock *)(x))
(int)(cp)&CROUND)
#define cbptr(x) ((struct cblock *)(x))
+/*
+ * Initialize clist by freeing all character blocks.
+ */
+cinit()
+{
+ register int ccp;
+ register struct cblock *cp;
+
+ ccp = (int) cfree;
+ ccp = (ccp + CROUND) & ~CROUND;
+ for(cp = (struct cblock *) ccp; cp < &cfree[nclist - 1]; cp++) {
+ cp->c_next = cfreelist;
+ cfreelist = cp;
+ cfreecount += CBSIZE;
+ }
+}
+
/*
* Character list get/put
*/
/*
* Character list get/put
*/
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)tty_tty.c 7.9 (Berkeley) %G%
+ * @(#)tty_tty.c 7.10 (Berkeley) %G%
#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*/
- struct vnode *ttyvp = cttyvp(u.u_procp);
+ struct proc *p = curproc;
+ struct vnode *ttyvp = cttyvp(p);
int error;
if (ttyvp == NULL)
return (ENXIO);
VOP_LOCK(ttyvp);
error = VOP_ACCESS(ttyvp,
int error;
if (ttyvp == NULL)
return (ENXIO);
VOP_LOCK(ttyvp);
error = VOP_ACCESS(ttyvp,
- (flag&FREAD ? VREAD : 0) | (flag&FWRITE ? VWRITE : 0), u.u_cred);
+ (flag&FREAD ? VREAD : 0) | (flag&FWRITE ? VWRITE : 0), p->p_ucred);
VOP_UNLOCK(ttyvp);
if (error)
return (error);
VOP_UNLOCK(ttyvp);
if (error)
return (error);
+cttyread(dev, uio, flag)
dev_t dev;
struct uio *uio;
{
dev_t dev;
struct uio *uio;
{
- register struct vnode *ttyvp = cttyvp(u.u_procp);
+ register struct vnode *ttyvp = cttyvp(curproc);
int error;
if (ttyvp == NULL)
int error;
if (ttyvp == NULL)
+cttywrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
{
dev_t dev;
struct uio *uio;
{
- register struct vnode *ttyvp = cttyvp(u.u_procp);
+ register struct vnode *ttyvp = cttyvp(curproc);
int error;
if (ttyvp == NULL)
int error;
if (ttyvp == NULL)
-syioctl(dev, cmd, addr, flag)
+cttyioctl(dev, cmd, addr, flag)
dev_t dev;
int cmd;
caddr_t addr;
int flag;
{
dev_t dev;
int cmd;
caddr_t addr;
int flag;
{
- struct vnode *ttyvp = cttyvp(u.u_procp);
+ struct vnode *ttyvp = cttyvp(curproc);
if (ttyvp == NULL)
return (ENXIO);
if (cmd == TIOCNOTTY) {
if (ttyvp == NULL)
return (ENXIO);
if (cmd == TIOCNOTTY) {
- if (!SESS_LEADER(u.u_procp)) {
- u.u_procp->p_flag &= ~SCTTY;
+ if (!SESS_LEADER(curproc)) {
+ curproc->p_flag &= ~SCTTY;
return (0);
} else
return (EINVAL);
return (0);
} else
return (EINVAL);
- struct vnode *ttyvp = cttyvp(u.u_procp);
+ struct vnode *ttyvp = cttyvp(curproc);
if (ttyvp == NULL)
return (1); /* try operation to get EOF/failure */
if (ttyvp == NULL)
return (1); /* try operation to get EOF/failure */
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)vfs_bio.c 7.33 (Berkeley) %G%
+ * @(#)vfs_bio.c 7.34 (Berkeley) %G%
*/
#include "param.h"
#include "user.h"
*/
#include "param.h"
#include "user.h"
#include "buf.h"
#include "vnode.h"
#include "specdev.h"
#include "buf.h"
#include "vnode.h"
#include "specdev.h"
long secsize;
#endif SECSIZE
{
long secsize;
#endif SECSIZE
{
+ struct proc *p = curproc; /* XXX */
register struct buf *bp;
if (size == 0)
register struct buf *bp;
if (size == 0)
}
VOP_STRATEGY(bp);
trace(TR_BREADMISS, pack(vp, size), blkno);
}
VOP_STRATEGY(bp);
trace(TR_BREADMISS, pack(vp, size), blkno);
- u.u_ru.ru_inblock++; /* pay for read */
+ p->p_stats->p_ru.ru_inblock++; /* pay for read */
struct ucred *cred;
struct buf **bpp;
{
struct ucred *cred;
struct buf **bpp;
{
+ struct proc *p = curproc; /* XXX */
register struct buf *bp, *rabp;
bp = NULL;
register struct buf *bp, *rabp;
bp = NULL;
}
VOP_STRATEGY(bp);
trace(TR_BREADMISS, pack(vp, size), blkno);
}
VOP_STRATEGY(bp);
trace(TR_BREADMISS, pack(vp, size), blkno);
- u.u_ru.ru_inblock++; /* pay for read */
+ p->p_stats->p_ru.ru_inblock++; /* pay for read */
} else
trace(TR_BREADHIT, pack(vp, size), blkno);
}
} else
trace(TR_BREADHIT, pack(vp, size), blkno);
}
}
VOP_STRATEGY(rabp);
trace(TR_BREADMISSRA, pack(vp, rabsize), rablkno);
}
VOP_STRATEGY(rabp);
trace(TR_BREADMISSRA, pack(vp, rabsize), rablkno);
- u.u_ru.ru_inblock++; /* pay in advance */
+ p->p_stats->p_ru.ru_inblock++; /* pay in advance */
bwrite(bp)
register struct buf *bp;
{
bwrite(bp)
register struct buf *bp;
{
+ struct proc *p = curproc; /* XXX */
register int flag;
int s, error;
flag = bp->b_flags;
bp->b_flags &= ~(B_READ | B_DONE | B_ERROR | B_DELWRI);
if ((flag & B_DELWRI) == 0)
register int flag;
int s, error;
flag = bp->b_flags;
bp->b_flags &= ~(B_READ | B_DONE | B_ERROR | B_DELWRI);
if ((flag & B_DELWRI) == 0)
- u.u_ru.ru_oublock++; /* noone paid yet */
+ p->p_stats->p_ru.ru_oublock++; /* no one paid yet */
else
reassignbuf(bp, bp->b_vp);
trace(TR_BWRITE, pack(bp->b_vp, bp->b_bcount), bp->b_lblkno);
else
reassignbuf(bp, bp->b_vp);
trace(TR_BWRITE, pack(bp->b_vp, bp->b_bcount), bp->b_lblkno);
bdwrite(bp)
register struct buf *bp;
{
bdwrite(bp)
register struct buf *bp;
{
+ struct proc *p = curproc; /* XXX */
if ((bp->b_flags & B_DELWRI) == 0) {
bp->b_flags |= B_DELWRI;
reassignbuf(bp, bp->b_vp);
if ((bp->b_flags & B_DELWRI) == 0) {
bp->b_flags |= B_DELWRI;
reassignbuf(bp, bp->b_vp);
- u.u_ru.ru_oublock++; /* noone paid yet */
+ p->p_stats->p_ru.ru_oublock++; /* no one paid yet */
}
/*
* If this is a tape drive, the write must be initiated.
}
/*
* If this is a tape drive, the write must be initiated.
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)vfs_cluster.c 7.33 (Berkeley) %G%
+ * @(#)vfs_cluster.c 7.34 (Berkeley) %G%
*/
#include "param.h"
#include "user.h"
*/
#include "param.h"
#include "user.h"
#include "buf.h"
#include "vnode.h"
#include "specdev.h"
#include "buf.h"
#include "vnode.h"
#include "specdev.h"
long secsize;
#endif SECSIZE
{
long secsize;
#endif SECSIZE
{
+ struct proc *p = curproc; /* XXX */
register struct buf *bp;
if (size == 0)
register struct buf *bp;
if (size == 0)
}
VOP_STRATEGY(bp);
trace(TR_BREADMISS, pack(vp, size), blkno);
}
VOP_STRATEGY(bp);
trace(TR_BREADMISS, pack(vp, size), blkno);
- u.u_ru.ru_inblock++; /* pay for read */
+ p->p_stats->p_ru.ru_inblock++; /* pay for read */
struct ucred *cred;
struct buf **bpp;
{
struct ucred *cred;
struct buf **bpp;
{
+ struct proc *p = curproc; /* XXX */
register struct buf *bp, *rabp;
bp = NULL;
register struct buf *bp, *rabp;
bp = NULL;
}
VOP_STRATEGY(bp);
trace(TR_BREADMISS, pack(vp, size), blkno);
}
VOP_STRATEGY(bp);
trace(TR_BREADMISS, pack(vp, size), blkno);
- u.u_ru.ru_inblock++; /* pay for read */
+ p->p_stats->p_ru.ru_inblock++; /* pay for read */
} else
trace(TR_BREADHIT, pack(vp, size), blkno);
}
} else
trace(TR_BREADHIT, pack(vp, size), blkno);
}
}
VOP_STRATEGY(rabp);
trace(TR_BREADMISSRA, pack(vp, rabsize), rablkno);
}
VOP_STRATEGY(rabp);
trace(TR_BREADMISSRA, pack(vp, rabsize), rablkno);
- u.u_ru.ru_inblock++; /* pay in advance */
+ p->p_stats->p_ru.ru_inblock++; /* pay in advance */
bwrite(bp)
register struct buf *bp;
{
bwrite(bp)
register struct buf *bp;
{
+ struct proc *p = curproc; /* XXX */
register int flag;
int s, error;
flag = bp->b_flags;
bp->b_flags &= ~(B_READ | B_DONE | B_ERROR | B_DELWRI);
if ((flag & B_DELWRI) == 0)
register int flag;
int s, error;
flag = bp->b_flags;
bp->b_flags &= ~(B_READ | B_DONE | B_ERROR | B_DELWRI);
if ((flag & B_DELWRI) == 0)
- u.u_ru.ru_oublock++; /* noone paid yet */
+ p->p_stats->p_ru.ru_oublock++; /* no one paid yet */
else
reassignbuf(bp, bp->b_vp);
trace(TR_BWRITE, pack(bp->b_vp, bp->b_bcount), bp->b_lblkno);
else
reassignbuf(bp, bp->b_vp);
trace(TR_BWRITE, pack(bp->b_vp, bp->b_bcount), bp->b_lblkno);
bdwrite(bp)
register struct buf *bp;
{
bdwrite(bp)
register struct buf *bp;
{
+ struct proc *p = curproc; /* XXX */
if ((bp->b_flags & B_DELWRI) == 0) {
bp->b_flags |= B_DELWRI;
reassignbuf(bp, bp->b_vp);
if ((bp->b_flags & B_DELWRI) == 0) {
bp->b_flags |= B_DELWRI;
reassignbuf(bp, bp->b_vp);
- u.u_ru.ru_oublock++; /* noone paid yet */
+ p->p_stats->p_ru.ru_oublock++; /* no one paid yet */
}
/*
* If this is a tape drive, the write must be initiated.
}
/*
* If this is a tape drive, the write must be initiated.