Subject: accton starts unwanted acctd (#416) Index: usr.sbin/accton/accton.c 2.11BSD Description: accton(8) will erroneously start a second acctd(8) running. The second instance of acctd(8) attempts to open /dev/acctlog and receives an EBUSY error (which is syslog'd) and then exits. Repeat-By: In the /usr/adm/daily script the accounting files are rotated and accton(8) is used to start accounting to a newly created file. In /usr/adm/daemonlog an error of the form: acctd[6678]: open(/dev/acctlog) errno: 16 is produced each night: Fix: accton(8) posts a SIGHUP signal to the currently running acctd(8) process. If this succeeds then there is no need to start acctd(8) running again - the start of a new acctd(8) process should only be done if the posting of the signal fails. The error is annoying but harmless because the second acctd(8) exits as soon as it gets the EBUSY (16) error (/dev/acctlog is an exclusive open device). The fix is a simple two line "else exit(0);". The added commentary makes the patch a little bigger ;-) To install the patch simply cut where indicated and save to a file (/tmp/416). Then: patch -p0 < /tmp/416 cd /usr/src/usr.sbin/accton make make install make clean As always this and previous updates to 2.11BSD are available via anonymous FTP to either FTP.IIPO.GTEGSC.COM or MOE.2BSD.COM in the directory /pub/2.11BSD. ---------------------------cut here------------------------ *** /usr/src/usr.sbin/accton/accton.c.old Fri Feb 19 15:21:19 1999 --- /usr/src/usr.sbin/accton/accton.c Wed May 5 20:04:37 1999 *************** *** 1,7 **** /* * Steven Schultz - sms@moe.2bsd.com * ! * @(#)accton.c 1.0 (2.11BSD) 1999/2/10 * * accton - enable/disable process accounting. */ --- 1,7 ---- /* * Steven Schultz - sms@moe.2bsd.com * ! * @(#)accton.c 1.1 (2.11BSD) 1999/5/5 * * accton - enable/disable process accounting. */ *************** *** 170,175 **** --- 170,181 ---- errx(1, "%s content out of bound(30000>pid>3)", pidfile); fclose(fp); + /* + * If the signal can be successfully posted to the process then do not + * attempt to start another instance of acctd (it will fail but syslog + * an annoying error message). If the signal can not be posted but the + * acctd process does not exist then go start it. Otherwise complain. + */ if (kill(pid, SIGHUP) < 0) { if (errno != ESRCH) *************** *** 176,181 **** --- 182,189 ---- err(1, "%d from %s bogus value", pid, pidfile); /* process no longer exists, fall thru and start it */ } + else + exit(0); } pid = vfork(); switch (pid) *** /VERSION.old Thu Apr 29 19:45:43 1999 --- /VERSION Wed May 5 20:00:29 1999 *************** *** 1,5 **** ! Current Patch Level: 415 ! Date: April 29, 1999 2.11 BSD ============ --- 1,5 ---- ! Current Patch Level: 416 ! Date: May 5, 1999 2.11 BSD ============