summaryrefslogtreecommitdiff
path: root/sys/kern/kern_acct.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_acct.c')
-rw-r--r--sys/kern/kern_acct.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c
index 54ff5542ad5..92555cc28a2 100644
--- a/sys/kern/kern_acct.c
+++ b/sys/kern/kern_acct.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_acct.c,v 1.8 2000/03/23 11:26:28 art Exp $ */
+/* $OpenBSD: kern_acct.c,v 1.9 2000/05/05 08:38:23 art Exp $ */
/* $NetBSD: kern_acct.c,v 1.42 1996/02/04 02:15:12 christos Exp $ */
/*-
@@ -168,6 +168,8 @@ acct_process(p)
struct timeval ut, st, tmp;
int s, t;
struct vnode *vp;
+ struct plimit *oplim = NULL;
+ int error;
/* If accounting isn't enabled, don't bother */
vp = acctp;
@@ -175,6 +177,16 @@ acct_process(p)
return (0);
/*
+ * Raise the file limit so that accounting can't be stopped by the
+ * user. (XXX - we should think about the cpu limit too).
+ */
+ if (p->p_limit->p_refcnt > 1) {
+ oplim = p->p_limit;
+ p->p_limit = limcopy(p->p_limit);
+ }
+ p->p_rlimit[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;
+
+ /*
* Get process accounting information.
*/
@@ -222,8 +234,15 @@ acct_process(p)
* Now, just write the accounting information to the file.
*/
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, NULL, p));
+ error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&acct, sizeof (acct),
+ (off_t)0, UIO_SYSSPACE, IO_APPEND|IO_UNIT, p->p_ucred, NULL, p);
+
+ if (oplim) {
+ limfree(p->p_limit);
+ p->p_limit = oplim;
+ }
+
+ return error;
}
/*