SCCS-vsn: sys/kern/sys_process.c 7.10
SCCS-vsn: sys/kern/kern_acct.c 7.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 7.10 (Berkeley) %G%
+ * @(#)kern_acct.c 7.11 (Berkeley) %G%
*/
#include "param.h"
#include "systm.h"
#include "time.h"
#include "proc.h"
*/
#include "param.h"
#include "systm.h"
#include "time.h"
#include "proc.h"
+#include "ioctl.h"
+#include "termios.h"
+#include "tty.h"
+#undef RETURN
+#include "syscontext.h"
#include "vnode.h"
#include "mount.h"
#include "kernel.h"
#include "acct.h"
#include "uio.h"
#include "syslog.h"
#include "vnode.h"
#include "mount.h"
#include "kernel.h"
#include "acct.h"
#include "uio.h"
#include "syslog.h"
-#include "ioctl.h"
-#include "termios.h"
-#include "tty.h"
/*
* Values associated with enabling and disabling accounting
/*
* Values associated with enabling and disabling accounting
/*
* Perform process accounting functions.
*/
/*
* Perform process accounting functions.
*/
+/* ARGSUSED */
+sysacct(p, uap, retval)
+ struct proc *p;
+ struct args {
+ char *fname;
+ } *uap;
+ int *retval;
{
register struct vnode *vp;
{
register struct vnode *vp;
- register struct a {
- char *fname;
- } *uap = (struct a *)u.u_ap;
register struct nameidata *ndp = &u.u_nd;
extern int acctwatch();
struct vnode *oacctp;
register struct nameidata *ndp = &u.u_nd;
extern int acctwatch();
struct vnode *oacctp;
- if (u.u_error = suser(u.u_cred, &u.u_acflag))
- return;
+ if (error = suser(u.u_cred, &u.u_acflag))
+ RETURN (error);
if (savacctp) {
acctp = savacctp;
savacctp = NULL;
if (savacctp) {
acctp = savacctp;
savacctp = NULL;
vrele(vp);
untimeout(acctwatch, (caddr_t)&chk);
}
vrele(vp);
untimeout(acctwatch, (caddr_t)&chk);
}
}
ndp->ni_nameiop = LOOKUP | FOLLOW;
ndp->ni_segflg = UIO_USERSPACE;
ndp->ni_dirp = uap->fname;
}
ndp->ni_nameiop = LOOKUP | FOLLOW;
ndp->ni_segflg = UIO_USERSPACE;
ndp->ni_dirp = uap->fname;
- if (u.u_error = namei(ndp))
- return;
+ if (error = namei(ndp))
+ RETURN (error);
vp = ndp->ni_vp;
if (vp->v_type != VREG) {
vp = ndp->ni_vp;
if (vp->v_type != VREG) {
}
if (vp->v_mount->mnt_flag & MNT_RDONLY) {
}
if (vp->v_mount->mnt_flag & MNT_RDONLY) {
}
oacctp = acctp;
acctp = vp;
if (oacctp)
vrele(oacctp);
acctwatch(&chk);
}
oacctp = acctp;
acctp = vp;
if (oacctp)
vrele(oacctp);
acctwatch(&chk);
/*
* On exit, write a record on the accounting file.
*/
/*
* On exit, write a record on the accounting file.
*/
+acct(p)
+ register struct proc *p;
{
register struct rusage *ru;
struct vnode *vp;
{
register struct rusage *ru;
struct vnode *vp;
int i, s;
struct acct acctbuf;
register struct acct *ap = &acctbuf;
int i, s;
struct acct acctbuf;
register struct acct *ap = &acctbuf;
- register struct proc *p = u.u_procp;
if ((vp = acctp) == NULL)
if ((vp = acctp) == NULL)
bcopy(p->p_comm, ap->ac_comm, sizeof(ap->ac_comm));
ru = &u.u_ru;
s = splclock();
bcopy(p->p_comm, ap->ac_comm, sizeof(ap->ac_comm));
ru = &u.u_ru;
s = splclock();
timevalsub(&t, &u.u_start);
ap->ac_etime = compress(t.tv_sec, t.tv_usec);
ap->ac_btime = u.u_start.tv_sec;
timevalsub(&t, &u.u_start);
ap->ac_etime = compress(t.tv_sec, t.tv_usec);
ap->ac_btime = u.u_start.tv_sec;
- ap->ac_uid = u.u_procp->p_ruid;
- ap->ac_gid = u.u_procp->p_rgid;
+ ap->ac_uid = p->p_ruid;
+ ap->ac_gid = p->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)
else
ap->ac_tty = NODEV;
ap->ac_flag = u.u_acflag;
else
ap->ac_tty = NODEV;
ap->ac_flag = u.u_acflag;
- u.u_error = vn_rdwr(UIO_WRITE, vp, (caddr_t)ap, sizeof (acctbuf),
- (off_t)0, UIO_SYSSPACE, IO_UNIT|IO_APPEND, u.u_cred, (int *)0);
+ 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));
* 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 7.9 (Berkeley) %G%
+ * @(#)sys_process.c 7.10 (Berkeley) %G%
*/
#define IPCREG
#include "param.h"
*/
#define IPCREG
#include "param.h"
#include "proc.h"
#include "vnode.h"
#include "text.h"
#include "proc.h"
#include "vnode.h"
#include "text.h"
/*
* sys-trace system call.
*/
/*
* sys-trace system call.
*/
-ptrace()
-{
- register struct proc *p;
- register struct a {
+ptrace(curp, uap, retval)
+ struct proc *curp;
+ register struct args {
int req;
int pid;
int *addr;
int data;
} *uap;
int req;
int pid;
int *addr;
int data;
} *uap;
+ int *retval;
+{
+ register struct proc *p;
- uap = (struct a *)u.u_ap;
- u.u_procp->p_flag |= STRC;
- return;
+ curp->p_flag |= STRC;
+ RETURN (0);
- if (p == 0 || p->p_stat != SSTOP || p->p_ppid != u.u_procp->p_pid ||
- !(p->p_flag & STRC)) {
- u.u_error = ESRCH;
- return;
- }
+ if (p == 0 || p->p_stat != SSTOP || p->p_ppid != curp->p_pid ||
+ !(p->p_flag & STRC))
+ RETURN (ESRCH);
while (ipc.ip_lock)
sleep((caddr_t)&ipc, IPCPRI);
ipc.ip_lock = p->p_pid;
while (ipc.ip_lock)
sleep((caddr_t)&ipc, IPCPRI);
ipc.ip_lock = p->p_pid;
setrun(p);
sleep((caddr_t)&ipc, IPCPRI);
}
setrun(p);
sleep((caddr_t)&ipc, IPCPRI);
}
- u.u_r.r_val1 = ipc.ip_data;
- if (ipc.ip_req < 0)
- u.u_error = EIO;
ipc.ip_lock = 0;
wakeup((caddr_t)&ipc);
ipc.ip_lock = 0;
wakeup((caddr_t)&ipc);
+ if (ipc.ip_req < 0)
+ RETURN (EIO);
+ RETURN (0);
}
#define PHYSOFF(p, o) \
}
#define PHYSOFF(p, o) \