Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Apr 2012 13:30:15 GMT
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/167321: [sysctl] [patch] Implement sysctl to control kernel accounting log messages (e.g. acct(2))
Message-ID:  <201204261330.q3QDUFve001599@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/167321; it has been noted by GNATS.

From: John Baldwin <jhb@freebsd.org>
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204261330.q3QDUFve001599>