summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_acct.c
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1997-02-10 02:22:35 +0000
committerdyson <dyson@FreeBSD.org>1997-02-10 02:22:35 +0000
commit10f666af84d48e89e4e2960415c9b616fce4077f (patch)
tree88a944de263165091f0a18abeedbaaccec532407 /sys/kern/kern_acct.c
parent0960d7e91af3428ffba89b42228d82d8afaa0389 (diff)
downloadFreeBSD-src-10f666af84d48e89e4e2960415c9b616fce4077f.zip
FreeBSD-src-10f666af84d48e89e4e2960415c9b616fce4077f.tar.gz
This is the kernel Lite/2 commit. There are some requisite userland
changes, so don't expect to be able to run the kernel as-is (very well) without the appropriate Lite/2 userland changes. The system boots and can mount UFS filesystems. Untested: ext2fs, msdosfs, NFS Known problems: Incorrect Berkeley ID strings in some files. Mount_std mounts will not work until the getfsent library routine is changed. Reviewed by: various people Submitted by: Jeffery Hsu <hsu@freebsd.org>
Diffstat (limited to 'sys/kern/kern_acct.c')
-rw-r--r--sys/kern/kern_acct.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c
index 2704347..59d0d35 100644
--- a/sys/kern/kern_acct.c
+++ b/sys/kern/kern_acct.c
@@ -49,6 +49,7 @@
#include <sys/file.h>
#include <sys/syslog.h>
#include <sys/kernel.h>
+#include <sys/sysent.h>
#include <sys/sysctl.h>
#include <sys/namei.h>
#include <sys/errno.h>
@@ -101,18 +102,15 @@ SYSCTL_INT(_kern, OID_AUTO, acct_chkfreq, CTLFLAG_RW,
* Accounting system call. Written based on the specification and
* previous implementation done by Mark Tinguely.
*/
-#ifndef _SYS_SYSPROTO_H_
-struct acct_args {
- char *path;
-};
-
-#endif
int
-acct(p, uap, retval)
- struct proc *p;
- struct acct_args *uap;
- int *retval;
+acct(a1, uap, a3)
+ struct proc *a1;
+ struct acct_args /* {
+ syscallarg(char *) path;
+ } */ *uap;
+ int *a3;
{
+ struct proc *p = curproc; /* XXX */
struct nameidata nd;
int error;
@@ -125,12 +123,13 @@ acct(p, uap, retval)
* If accounting is to be started to a file, open that file for
* writing and make sure it's a 'normal'.
*/
- if (uap->path != NULL) {
- NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, p);
+ if (SCARG(uap, path) != NULL) {
+ NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path),
+ p);
error = vn_open(&nd, FWRITE, 0);
if (error)
return (error);
- VOP_UNLOCK(nd.ni_vp);
+ VOP_UNLOCK(nd.ni_vp, 0, p);
if (nd.ni_vp->v_type != VREG) {
vn_close(nd.ni_vp, FWRITE, p->p_ucred, p);
return (EACCES);
@@ -147,7 +146,7 @@ acct(p, uap, retval)
p->p_ucred, p);
acctp = savacctp = NULLVP;
}
- if (uap->path == NULL)
+ if (SCARG(uap, path) == NULL)
return (error);
/*
@@ -228,7 +227,7 @@ acct_process(p)
/*
* Now, just write the accounting information to the file.
*/
- LEASE_CHECK(vp, p, p->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE);
return (vn_rdwr(UIO_WRITE, vp, (caddr_t)&acct, sizeof (acct),
(off_t)0, UIO_SYSSPACE, IO_APPEND|IO_UNIT, p->p_ucred,
(int *)0, p));
@@ -298,7 +297,9 @@ acctwatch(a)
savacctp = NULLVP;
log(LOG_NOTICE, "Accounting resumed\n");
}
- } else if (acctp != NULLVP) {
+ } else {
+ if (acctp == NULLVP)
+ return;
if (acctp->v_type == VBAD) {
(void) vn_close(acctp, FWRITE, NOCRED, NULL);
acctp = NULLVP;
@@ -310,7 +311,6 @@ acctwatch(a)
acctp = NULLVP;
log(LOG_NOTICE, "Accounting suspended\n");
}
- } else
- return;
+ }
timeout(acctwatch, NULL, acctchkfreq * hz);
}
OpenPOWER on IntegriCloud