summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_acct.c
diff options
context:
space:
mode:
authordillon <dillon@FreeBSD.org>2001-09-01 03:04:31 +0000
committerdillon <dillon@FreeBSD.org>2001-09-01 03:04:31 +0000
commitd1a6cbe1d59ffdd8715479fc5ceb20e567812005 (patch)
tree6e2be2d0ad774719f30ae9d248628c0f48614db6 /sys/kern/kern_acct.c
parent5610a6ae63a163468769d8b1400a386115b53ddf (diff)
downloadFreeBSD-src-d1a6cbe1d59ffdd8715479fc5ceb20e567812005.zip
FreeBSD-src-d1a6cbe1d59ffdd8715479fc5ceb20e567812005.tar.gz
Pushdown Giant for acct(), kqueue(), kevent(), execve(), fork(),
vfork(), rfork(), jail().
Diffstat (limited to 'sys/kern/kern_acct.c')
-rw-r--r--sys/kern/kern_acct.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c
index 9d93224..9a2ebab 100644
--- a/sys/kern/kern_acct.c
+++ b/sys/kern/kern_acct.c
@@ -106,6 +106,8 @@ SYSCTL_INT(_kern, OID_AUTO, acct_chkfreq, CTLFLAG_RW,
/*
* Accounting system call. Written based on the specification and
* previous implementation done by Mark Tinguely.
+ *
+ * MPSAFE
*/
int
acct(a1, uap)
@@ -118,10 +120,12 @@ acct(a1, uap)
struct nameidata nd;
int error, flags;
+ mtx_lock(&Giant);
+
/* Make sure that the caller is root. */
error = suser(p);
if (error)
- return (error);
+ goto done2;
/*
* If accounting is to be started to a file, open that file for
@@ -133,12 +137,13 @@ acct(a1, uap)
flags = FWRITE;
error = vn_open(&nd, &flags, 0);
if (error)
- return (error);
+ goto done2;
NDFREE(&nd, NDF_ONLY_PNBUF);
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);
+ error = EACCES;
+ goto done2;
}
}
@@ -153,7 +158,7 @@ acct(a1, uap)
acctp = savacctp = NULLVP;
}
if (SCARG(uap, path) == NULL)
- return (error);
+ goto done2;
/*
* Save the new accounting file vnode, and schedule the new
@@ -162,6 +167,8 @@ acct(a1, uap)
acctp = nd.ni_vp;
callout_init(&acctwatch_callout, 0);
acctwatch(NULL);
+done2:
+ mtx_unlock(&Giant);
return (error);
}
OpenPOWER on IntegriCloud