kern/167321: [sysctl] [patch] Implement sysctl to control
kernel accounting log messages (e.g. acct(2))
John Baldwin
jhb at freebsd.org
Thu Apr 26 13:30:15 UTC 2012
The following reply was made to PR kern/167321; it has been noted by GNATS.
From: John Baldwin <jhb at freebsd.org>
To: bug-followup at freebsd.org,
jdc at koitsu.org
Cc: dougb at freebsd.org
Subject: Re: kern/167321: [sysctl] [patch] Implement sysctl to control kernel accounting log messages (e.g. acct(2))
Date: Thu, 26 Apr 2012 09:30:01 -0400
Hmm, reading the rc.d script and the kernel code, it is not clear to me why
you are seeing "Accounting disabled" messages at all. You should be seeing
two "Accounting enabled" messages, but no disabled. However, it seems that
the 'rotate_log' command in /etc/rc.d/accounting can be simplified. The
kernel doesn't care about the pathname, so it doesn't need to have accton re-
run when the file is renamed from its temporary filename to it's full name.
You could then update the acct() system call to not log the message when
accounting is switched from one file to another atomically. I think these two
changes will address your problem while preserving the useful logging:
Index: etc/rc.d/accounting
===================================================================
--- etc/rc.d/accounting (revision 234685)
+++ etc/rc.d/accounting (working copy)
@@ -65,9 +65,7 @@
mv ${accounting_file} ${accounting_file}.0
if checkyesno accounting_enable; then
- ln $_file ${accounting_file##*/}
- ${accounting_command} ${accounting_file}
- unlink $_file
+ mv $_file ${accounting_file}
fi
}
Index: sys/kern/kern_acct.c
===================================================================
--- sys/kern/kern_acct.c (revision 234685)
+++ sys/kern/kern_acct.c (working copy)
@@ -297,9 +297,11 @@
return (error);
}
}
- acct_configured = 1;
+ if (!acct_configured) {
+ acct_configured = 1;
+ log(LOG_NOTICE, "Accounting enabled\n");
+ }
sx_xunlock(&acct_sx);
- log(LOG_NOTICE, "Accounting enabled\n");
return (error);
}
--
John Baldwin
More information about the freebsd-bugs
mailing list