From owner-freebsd-bugs@FreeBSD.ORG Thu Apr 26 13:30:15 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 537D81065672 for ; Thu, 26 Apr 2012 13:30:15 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 3DDA38FC0A for ; Thu, 26 Apr 2012 13:30:15 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q3QDUFSL001602 for ; Thu, 26 Apr 2012 13:30:15 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q3QDUFve001599; Thu, 26 Apr 2012 13:30:15 GMT (envelope-from gnats) Date: Thu, 26 Apr 2012 13:30:15 GMT Message-Id: <201204261330.q3QDUFve001599@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: John Baldwin Cc: Subject: Re: kern/167321: [sysctl] [patch] Implement sysctl to control kernel accounting log messages (e.g. acct(2)) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: John Baldwin List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Apr 2012 13:30:15 -0000 The following reply was made to PR kern/167321; it has been noted by GNATS. From: John Baldwin To: bug-followup@freebsd.org, jdc@koitsu.org Cc: dougb@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