Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Apr 2012 12:00:40 GMT
From:      Jeremy Chadwick <jdc@koitsu.org>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/167321: Implement sysctl to control kernel accounting log messages (e.g. acct(2))
Message-ID:  <201204261200.q3QC0eJO018689@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: Jeremy Chadwick <jdc@koitsu.org>
To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org
Cc:  
Subject: Re: kern/167321: Implement sysctl to control kernel accounting log
 messages (e.g. acct(2))
Date: Thu, 26 Apr 2012 05:00:08 -0700

 Proposed patch is attached, as well as available at the below URL.
 Please note I HAVE NOT tested this, but it seems simple enough.
 
 http://jdc.koitsu.org/freebsd/167321/
 
 Patch written for RELENG_8, may/may not patch cleanly on others.
 
 -- 
 | Jeremy Chadwick                                   jdc@koitsu.org |
 | UNIX Systems Administrator                http://jdc.koitsu.org/ |
 | Mountain View, CA, US                                            |
 | Making life hard for others since 1977.             PGP 4BD6C0CB |
 
 --- SNIP ---
 
 --- src/sys/kern/kern_acct.c.orig	2009-08-03 01:13:06.000000000 -0700
 +++ src/sys/kern/kern_acct.c	2012-04-26 04:53:31.428339406 -0700
 @@ -146,6 +146,9 @@
  #define	ACCT_RUNNING	1	/* Accounting kthread is running. */
  #define	ACCT_EXITREQ	2	/* Accounting kthread should exit. */
  
 +/* sysctl variable used for controlling non-critical log() calls */
 +static int		 acct_logging = 1;
 +
  /*
   * Values associated with enabling and disabling accounting
   */
 @@ -188,6 +191,9 @@
  SYSCTL_INT(_kern, OID_AUTO, acct_suspended, CTLFLAG_RD, &acct_suspended, 0,
  	"Accounting suspended or not");
  
 +SYSCTL_INT(_kern, OID_AUTO, acct_logging, CTLFLAG_RW, &acct_logging, 0
 +	"Log non-critical accounting messages");
 +
  /*
   * Accounting system call.  Written based on the specification and previous
   * implementation done by Mark Tinguely.
 @@ -299,7 +305,8 @@
  	}
  	acct_configured = 1;
  	sx_xunlock(&acct_sx);
 -	log(LOG_NOTICE, "Accounting enabled\n");
 +	if (acct_logging)
 +		log(LOG_NOTICE, "Accounting enabled\n");
  	return (error);
  }
  
 @@ -319,7 +326,8 @@
  	acct_vp = NULL;
  	acct_cred = NULL;
  	acct_flags = 0;
 -	log(LOG_NOTICE, "Accounting disabled\n");
 +	if (acct_logging)
 +		log(LOG_NOTICE, "Accounting disabled\n");
  	return (error);
  }
  
 @@ -593,13 +601,15 @@
  		if (sb.f_bavail > (int64_t)(acctresume * sb.f_blocks /
  		    100)) {
  			acct_suspended = 0;
 -			log(LOG_NOTICE, "Accounting resumed\n");
 +			if (acct_logging)
 +				log(LOG_NOTICE, "Accounting resumed\n");
  		}
  	} else {
  		if (sb.f_bavail <= (int64_t)(acctsuspend * sb.f_blocks /
  		    100)) {
  			acct_suspended = 1;
 -			log(LOG_NOTICE, "Accounting suspended\n");
 +			if (acct_logging)
 +				log(LOG_NOTICE, "Accounting suspended\n");
  		}
  	}
  }



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