Expore kern.acct_configured, a sysctl that reflects the configured/

unconfigured state of the kernel accounting system.  This is used by
the accounting privilege regression test to determine whether
accounting is in use and will be disrupted by the regression test.

Sponsored by:	nCircle Network Security, Inc.
Obtained from:	TrustedBSD Project
MFC after:	1 month
This commit is contained in:
rwatson 2006-09-17 11:00:36 +00:00
parent 7bfa9047b1
commit cc2c7c1920

View File

@ -94,6 +94,7 @@ static int acct_disable(struct thread *);
* acct_sx protects against changes to the active vnode and credentials
* while accounting records are being committed to disk.
*/
static int acct_configured;
static int acct_suspended;
static struct vnode *acct_vp;
static struct ucred *acct_cred;
@ -146,6 +147,9 @@ SYSCTL_PROC(_kern, OID_AUTO, acct_chkfreq, CTLTYPE_INT|CTLFLAG_RW,
&acctchkfreq, 0, sysctl_acct_chkfreq, "I",
"frequency for checking the free space");
SYSCTL_INT(_kern, OID_AUTO, acct_configured, CTLFLAG_RD, &acct_configured, 0,
"Accounting configured or not");
SYSCTL_INT(_kern, OID_AUTO, acct_suspended, CTLFLAG_RD, &acct_suspended, 0,
"Accounting suspended or not");
@ -252,6 +256,7 @@ acct(struct thread *td, struct acct_args *uap)
(void) vn_close(acct_vp, acct_flags, acct_cred, td);
VFS_UNLOCK_GIANT(vfslocked);
crfree(acct_cred);
acct_configured = 0;
acct_vp = NULL;
acct_cred = NULL;
acct_flags = 0;
@ -260,6 +265,7 @@ acct(struct thread *td, struct acct_args *uap)
return (error);
}
}
acct_configured = 1;
sx_xunlock(&acct_sx);
log(LOG_NOTICE, "Accounting enabled\n");
return (error);
@ -277,6 +283,7 @@ acct_disable(struct thread *td)
sx_assert(&acct_sx, SX_XLOCKED);
error = vn_close(acct_vp, acct_flags, acct_cred, td);
crfree(acct_cred);
acct_configured = 0;
acct_vp = NULL;
acct_cred = NULL;
acct_flags = 0;