mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-13 10:02:38 +00:00
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:
parent
781dd9ae05
commit
101581b082
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=162370
@ -94,6 +94,7 @@ static int acct_disable(struct thread *);
|
|||||||
* acct_sx protects against changes to the active vnode and credentials
|
* acct_sx protects against changes to the active vnode and credentials
|
||||||
* while accounting records are being committed to disk.
|
* while accounting records are being committed to disk.
|
||||||
*/
|
*/
|
||||||
|
static int acct_configured;
|
||||||
static int acct_suspended;
|
static int acct_suspended;
|
||||||
static struct vnode *acct_vp;
|
static struct vnode *acct_vp;
|
||||||
static struct ucred *acct_cred;
|
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",
|
&acctchkfreq, 0, sysctl_acct_chkfreq, "I",
|
||||||
"frequency for checking the free space");
|
"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,
|
SYSCTL_INT(_kern, OID_AUTO, acct_suspended, CTLFLAG_RD, &acct_suspended, 0,
|
||||||
"Accounting suspended or not");
|
"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);
|
(void) vn_close(acct_vp, acct_flags, acct_cred, td);
|
||||||
VFS_UNLOCK_GIANT(vfslocked);
|
VFS_UNLOCK_GIANT(vfslocked);
|
||||||
crfree(acct_cred);
|
crfree(acct_cred);
|
||||||
|
acct_configured = 0;
|
||||||
acct_vp = NULL;
|
acct_vp = NULL;
|
||||||
acct_cred = NULL;
|
acct_cred = NULL;
|
||||||
acct_flags = 0;
|
acct_flags = 0;
|
||||||
@ -260,6 +265,7 @@ acct(struct thread *td, struct acct_args *uap)
|
|||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
acct_configured = 1;
|
||||||
sx_xunlock(&acct_sx);
|
sx_xunlock(&acct_sx);
|
||||||
log(LOG_NOTICE, "Accounting enabled\n");
|
log(LOG_NOTICE, "Accounting enabled\n");
|
||||||
return (error);
|
return (error);
|
||||||
@ -277,6 +283,7 @@ acct_disable(struct thread *td)
|
|||||||
sx_assert(&acct_sx, SX_XLOCKED);
|
sx_assert(&acct_sx, SX_XLOCKED);
|
||||||
error = vn_close(acct_vp, acct_flags, acct_cred, td);
|
error = vn_close(acct_vp, acct_flags, acct_cred, td);
|
||||||
crfree(acct_cred);
|
crfree(acct_cred);
|
||||||
|
acct_configured = 0;
|
||||||
acct_vp = NULL;
|
acct_vp = NULL;
|
||||||
acct_cred = NULL;
|
acct_cred = NULL;
|
||||||
acct_flags = 0;
|
acct_flags = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user