SCCS-vsn: sys/kern/kern_acct.c 6.9
SCCS-vsn: sys/kern/kern_fork.c 6.8
SCCS-vsn: sys/kern/sys_generic.c 6.14
SCCS-vsn: sys/kern/sys_process.c 6.6
SCCS-vsn: sys/kern/tty_subr.c 6.11
* 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 6.8 (Berkeley) %G%
+ * @(#)kern_acct.c 6.9 (Berkeley) %G%
ndp->ni_segflg = UIO_USERSPACE;
ndp->ni_dirp = uap->fname;
ip = namei(ndp);
ndp->ni_segflg = UIO_USERSPACE;
ndp->ni_dirp = uap->fname;
ip = namei(ndp);
- if((ip->i_mode & IFMT) != IFREG) {
+ if ((ip->i_mode&IFMT) != IFREG) {
u.u_error = EACCES;
iput(ip);
return;
u.u_error = EACCES;
iput(ip);
return;
else
ap->ac_mem = 0;
ap->ac_mem >>= CLSIZELOG2;
else
ap->ac_mem = 0;
ap->ac_mem >>= CLSIZELOG2;
- ap->ac_io = compress(ru->ru_inblock + ru->ru_oublock, 0);
+ ap->ac_io = compress(ru->ru_inblock + ru->ru_oublock, (long)0);
if (u.u_ttyp)
ap->ac_tty = u.u_ttyd;
else
if (u.u_ttyp)
ap->ac_tty = u.u_ttyd;
else
* 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_fork.c 6.7 (Berkeley) %G%
+ * @(#)kern_fork.c 6.8 (Berkeley) %G%
*/
#include "../machine/reg.h"
*/
#include "../machine/reg.h"
/*
* Make child runnable and add to run queue.
*/
/*
* Make child runnable and add to run queue.
*/
rpp->p_stat = SRUN;
setrq(rpp);
(void) spl0();
rpp->p_stat = SRUN;
setrq(rpp);
(void) spl0();
* 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.
*
- * @(#)sys_generic.c 6.13 (Berkeley) %G%
+ * @(#)sys_generic.c 6.14 (Berkeley) %G%
int s, ncoll, ni;
label_t lqsave;
int s, ncoll, ni;
label_t lqsave;
- bzero(ibits, sizeof(ibits));
- bzero(obits, sizeof(obits));
+ bzero((caddr_t)ibits, sizeof(ibits));
+ bzero((caddr_t)obits, sizeof(obits));
if (uap->nd > NOFILE)
uap->nd = NOFILE; /* forgiving, if slightly wrong */
ni = howmany(uap->nd, NFDBITS);
if (uap->nd > NOFILE)
uap->nd = NOFILE; /* forgiving, if slightly wrong */
ni = howmany(uap->nd, NFDBITS);
#define getbits(name, x) \
if (uap->name) { \
u.u_error = copyin((caddr_t)uap->name, (caddr_t)&ibits[x], \
#define getbits(name, x) \
if (uap->name) { \
u.u_error = copyin((caddr_t)uap->name, (caddr_t)&ibits[x], \
- ni * sizeof(fd_mask)); \
+ (unsigned)(ni * sizeof(fd_mask))); \
if (u.u_error) \
goto done; \
}
if (u.u_error) \
goto done; \
}
#define putbits(name, x) \
if (uap->name) { \
int error = copyout((caddr_t)&obits[x], (caddr_t)uap->name, \
#define putbits(name, x) \
if (uap->name) { \
int error = copyout((caddr_t)&obits[x], (caddr_t)uap->name, \
- ni * sizeof(fd_mask)); \
+ (unsigned)(ni * sizeof(fd_mask))); \
if (error) \
u.u_error = error; \
}
if (error) \
u.u_error = error; \
}
* 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.
*
- * @(#)sys_process.c 6.5 (Berkeley) %G%
+ * @(#)sys_process.c 6.6 (Berkeley) %G%
*/
#include "../machine/reg.h"
*/
#include "../machine/reg.h"
#include "vm.h"
#include "buf.h"
#include "acct.h"
#include "vm.h"
#include "buf.h"
#include "acct.h"
/*
* Priority for tracing
/*
* Priority for tracing
#define NIPCREG 16
int ipcreg[NIPCREG] =
{R0,R1,R2,R3,R4,R5,R6,R7,R8,R9,R10,R11,AP,FP,SP,PC};
#define NIPCREG 16
int ipcreg[NIPCREG] =
{R0,R1,R2,R3,R4,R5,R6,R7,R8,R9,R10,R11,AP,FP,SP,PC};
ipc.ip_req = 0;
switch (i) {
ipc.ip_req = 0;
switch (i) {
- /* read user I */
- case 1:
+ case PT_READ_I: /* read the child's text space */
if (!useracc((caddr_t)ipc.ip_addr, 4, B_READ))
goto error;
ipc.ip_data = fuiword((caddr_t)ipc.ip_addr);
break;
if (!useracc((caddr_t)ipc.ip_addr, 4, B_READ))
goto error;
ipc.ip_data = fuiword((caddr_t)ipc.ip_addr);
break;
- /* read user D */
- case 2:
+ case PT_READ_D: /* read the child's data space */
if (!useracc((caddr_t)ipc.ip_addr, 4, B_READ))
goto error;
ipc.ip_data = fuword((caddr_t)ipc.ip_addr);
break;
if (!useracc((caddr_t)ipc.ip_addr, 4, B_READ))
goto error;
ipc.ip_data = fuword((caddr_t)ipc.ip_addr);
break;
+ case PT_READ_U: /* read the child's u. */
i = (int)ipc.ip_addr;
if (i<0 || i >= ctob(UPAGES))
goto error;
ipc.ip_data = *(int *)PHYSOFF(&u, i);
break;
i = (int)ipc.ip_addr;
if (i<0 || i >= ctob(UPAGES))
goto error;
ipc.ip_data = *(int *)PHYSOFF(&u, i);
break;
- /* write user I */
- /* Must set up to allow writing */
- case 4:
+ case PT_WRITE_I: /* write the child's text space */
/*
* If text, must assure exclusive use
*/
/*
* If text, must assure exclusive use
*/
xp->x_flag |= XWRIT;
break;
xp->x_flag |= XWRIT;
break;
- /* write user D */
- case 5:
+ case PT_WRITE_D: /* write the child's data space */
if (suword((caddr_t)ipc.ip_addr, 0) < 0)
goto error;
(void) suword((caddr_t)ipc.ip_addr, ipc.ip_data);
break;
if (suword((caddr_t)ipc.ip_addr, 0) < 0)
goto error;
(void) suword((caddr_t)ipc.ip_addr, ipc.ip_data);
break;
- /* write u */
- case 6:
+ case PT_WRITE_U: /* write the child's u. */
i = (int)ipc.ip_addr;
p = (int *)PHYSOFF(&u, i);
for (i=0; i<NIPCREG; i++)
i = (int)ipc.ip_addr;
p = (int *)PHYSOFF(&u, i);
for (i=0; i<NIPCREG; i++)
- /* set signal and continue */
- /* one version causes a trace-trap */
- case 9:
- case 7:
+ case PT_STEP: /* single step the child */
+ case PT_CONTINUE: /* continue the child */
if ((int)ipc.ip_addr != 1)
u.u_ar0[PC] = (int)ipc.ip_addr;
if ((unsigned)ipc.ip_data > NSIG)
goto error;
u.u_procp->p_cursig = ipc.ip_data; /* see issig */
if ((int)ipc.ip_addr != 1)
u.u_ar0[PC] = (int)ipc.ip_addr;
if ((unsigned)ipc.ip_data > NSIG)
goto error;
u.u_procp->p_cursig = ipc.ip_data; /* see issig */
u.u_ar0[PS] |= PSL_T;
wakeup((caddr_t)&ipc);
return (1);
u.u_ar0[PS] |= PSL_T;
wakeup((caddr_t)&ipc);
return (1);
- /* force exit */
- case 8:
+ case PT_KILL: /* kill the child process */
wakeup((caddr_t)&ipc);
exit(u.u_procp->p_cursig);
wakeup((caddr_t)&ipc);
exit(u.u_procp->p_cursig);
* 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 6.10 (Berkeley) %G%
+ * @(#)tty_subr.c 6.11 (Berkeley) %G%
c = *p->c_cf++ & 0377;
if (--p->c_cc<=0) {
bp = (struct cblock *)(p->c_cf-1);
c = *p->c_cf++ & 0377;
if (--p->c_cc<=0) {
bp = (struct cblock *)(p->c_cf-1);
- bp = (struct cblock *) ((int)bp & ~CROUND);
+ bp = (struct cblock *)((int)bp & ~CROUND);
p->c_cf = NULL;
p->c_cl = NULL;
bp->c_next = cfreelist;
p->c_cf = NULL;
p->c_cl = NULL;
bp->c_next = cfreelist;
s = spltty();
if (q->c_cc <= 0) {
q->c_cc = 0;
q->c_cf = q->c_cl = NULL;
splx(s);
s = spltty();
if (q->c_cc <= 0) {
q->c_cc = 0;
q->c_cf = q->c_cl = NULL;
splx(s);
- nc = sizeof(struct cblock) - ((int)q->c_cf & CROUND);
+ nc = sizeof (struct cblock) - ((int)q->c_cf & CROUND);
nc = MIN(nc, cc);
nc = MIN(nc, q->c_cc);
(void) bcopy(q->c_cf, cp, (unsigned)nc);
nc = MIN(nc, cc);
nc = MIN(nc, q->c_cc);
(void) bcopy(q->c_cf, cp, (unsigned)nc);
/*
* Flush cc bytes from q.
*/
/*
* Flush cc bytes from q.
*/
int rem, s;
s = spltty();
int rem, s;
s = spltty();
while (cc>0 && q->c_cc) {
bp = (struct cblock *)((int)q->c_cf & ~CROUND);
if ((int)bp == (((int)q->c_cl-1) & ~CROUND)) {
while (cc>0 && q->c_cc) {
bp = (struct cblock *)((int)q->c_cf & ~CROUND);
if ((int)bp == (((int)q->c_cl-1) & ~CROUND)) {
if ((cp = p->c_cl) == NULL || p->c_cc < 0 ) {
if ((bp = cfreelist) == NULL) {
splx(s);
if ((cp = p->c_cl) == NULL || p->c_cc < 0 ) {
if ((bp = cfreelist) == NULL) {
splx(s);
}
cfreelist = bp->c_next;
cfreecount -= CBSIZE;
}
cfreelist = bp->c_next;
cfreecount -= CBSIZE;
bp = (struct cblock *)cp - 1;
if ((bp->c_next = cfreelist) == NULL) {
splx(s);
bp = (struct cblock *)cp - 1;
if ((bp->c_next = cfreelist) == NULL) {
splx(s);
}
bp = bp->c_next;
cfreelist = bp->c_next;
}
bp = bp->c_next;
cfreelist = bp->c_next;
p->c_cc++;
p->c_cl = cp;
splx(s);
p->c_cc++;
p->c_cl = cp;
splx(s);
/*
* copy buffer to clist.
* return number of bytes not transfered.
/*
* copy buffer to clist.
* return number of bytes not transfered.
acc = cc;
s = spltty();
if ((cq = q->c_cl) == NULL || q->c_cc < 0) {
acc = cc;
s = spltty();
if ((cq = q->c_cl) == NULL || q->c_cc < 0) {
while (cc) {
if (((int)cq & CROUND) == 0) {
while (cc) {
if (((int)cq & CROUND) == 0) {
- bp = (struct cblock *) cq - 1;
+ bp = (struct cblock *)cq - 1;
if ((bp->c_next = cfreelist) == NULL)
goto out;
bp = bp->c_next;
if ((bp->c_next = cfreelist) == NULL)
goto out;
bp = bp->c_next;
bp->c_next = NULL;
cq = bp->c_info;
}
bp->c_next = NULL;
cq = bp->c_info;
}
- nc = MIN(cc, sizeof(struct cblock) - ((int)cq & CROUND));
+ nc = MIN(cc, sizeof (struct cblock) - ((int)cq & CROUND));
(void) bcopy(cp, cq, (unsigned)nc);
cp += nc;
cq += nc;
(void) bcopy(cp, cq, (unsigned)nc);
cp += nc;
cq += nc;
- * Integer (short) get/put
- * using clists
+ * Integer (short) get/put using clists.
+ * Note dependency on byte order.
*/
typedef u_short word_t;
*/
typedef u_short word_t;
return(-1);
if (p->c_cc & 01) {
c = getc(p);
return(-1);
if (p->c_cc & 01) {
c = getc(p);
- return(c | (getc(p)<<8));
+#if defined(vax)
+ return (c | (getc(p)<<8));
+#else
+ return (getc(p) | (c<<8));
+#endif
c = *((word_t *)p->c_cf);
c = *((word_t *)p->c_cf);
- p->c_cf += sizeof(word_t);
- p->c_cc -= sizeof(word_t);
+#else
+ c = (((u_char *)p->c_cf)[1] << 8) | ((u_char *)p->c_cf)[0];
+#endif
+ p->c_cf += sizeof (word_t);
+ p->c_cc -= sizeof (word_t);
if (p->c_cc <= 0) {
bp = (struct cblock *)(p->c_cf-1);
if (p->c_cc <= 0) {
bp = (struct cblock *)(p->c_cf-1);
- bp = (struct cblock *) ((int)bp & ~CROUND);
+ bp = (struct cblock *)((int)bp & ~CROUND);
p->c_cf = NULL;
p->c_cl = NULL;
bp->c_next = cfreelist;
p->c_cf = NULL;
p->c_cl = NULL;
bp->c_next = cfreelist;
return(-1);
}
if (p->c_cc & 01) {
return(-1);
}
if (p->c_cc & 01) {
(void) putc(c, p);
(void) putc(c>>8, p);
(void) putc(c, p);
(void) putc(c>>8, p);
+#else
+ (void) putc(c>>8, p);
+ (void) putc(c, p);
+#endif
} else {
if ((cp = p->c_cl) == NULL || p->c_cc < 0 ) {
if ((bp = cfreelist) == NULL) {
} else {
if ((cp = p->c_cl) == NULL || p->c_cc < 0 ) {
if ((bp = cfreelist) == NULL) {
bp->c_next = NULL;
cp = bp->c_info;
}
bp->c_next = NULL;
cp = bp->c_info;
}
- p->c_cl = cp + sizeof(word_t);
- p->c_cc += sizeof(word_t);
+#else
+ ((u_char *)cp)[0] = c>>8;
+ ((u_char *)cp)[1] = c;
+#endif
+ p->c_cl = cp + sizeof (word_t);
+ p->c_cc += sizeof (word_t);