From the man page description of the -R flag: When a daemon does exe- cute newsyslog with the -R option, it should make sure all of the log files are closed before calling newsyslog, and then it should re-open the files after newsyslog returns. Usually the calling process will also want to specify the -s option, so newsyslog will not send a signal to the very process which called it to force the rotate. Skipping the signal step will also mean that newsyslog will return faster, since newsyslog normally waits a few seconds after any signal that is sent. After going through the signal work list, during which do_sigwork() is called and essentially does nothing because -s and -R were specified on the command line, newsyslog will sleep for 10 seconds as the (verbose) code says: "Pause 10 seconds to allow daemon(s) to close log file(s)". However, the man page verbiage for -R (and -s) seems quite clear that this sleep() is unnecessary because the daemon was expected to have already closed the log file before calling newsyslog. I submit that the sleep should be eliminated in at least the case where -R and -s have been specified and possibly also in the case where only -s was specified (if there were no signal sent, how is the daemon supposed to know to close (and reopen) the log file?).
Patch available at: https://reviews.freebsd.org/D6727
A commit references this bug: Author: vangyzen Date: Mon Jun 6 22:54:08 UTC 2016 New revision: 301532 URL: https://svnweb.freebsd.org/changeset/base/301532 Log: newsyslog: Eliminate unnecessary sleep(10) when -R and -s are specified After going through the signal work list, during which do_sigwork() is called and essentially does nothing because -s and -R were specified on the command line, newsyslog will sleep for 10 seconds as the (verbose) code says: "Pause 10 seconds to allow daemon(s) to close log file(s)". However, the man page verbiage for -R (and -s) seems quite clear that this sleep() is unnecessary because the daemon was expected to have already closed the log file before calling newsyslog. PR: 210020 Submitted by: David A. Bright <david_a_bright@dell.com> MFC after: 1 week Sponsored by: Dell Inc. Differential Revision: https://reviews.freebsd.org/D6727 Changes: head/usr.sbin/newsyslog/newsyslog.c
Already committed.
A commit references this bug: Author: vangyzen Date: Wed Jun 15 14:11:49 UTC 2016 New revision: 301926 URL: https://svnweb.freebsd.org/changeset/base/301926 Log: MFC r301532 newsyslog: Eliminate unnecessary sleep(10) when -R and -s are specified After going through the signal work list, during which do_sigwork() is called and essentially does nothing because -s and -R were specified on the command line, newsyslog will sleep for 10 seconds as the (verbose) code says: "Pause 10 seconds to allow daemon(s) to close log file(s)". However, the man page verbiage for -R (and -s) seems quite clear that this sleep() is unnecessary because the daemon was expected to have already closed the log file before calling newsyslog. PR: 210020 Submitted by: David A. Bright <david_a_bright@dell.com> Sponsored by: Dell Inc. Changes: _U stable/10/ stable/10/usr.sbin/newsyslog/newsyslog.c
A commit references this bug: Author: vangyzen Date: Wed Jun 15 14:12:22 UTC 2016 New revision: 301927 URL: https://svnweb.freebsd.org/changeset/base/301927 Log: MFC r301532 newsyslog: Eliminate unnecessary sleep(10) when -R and -s are specified After going through the signal work list, during which do_sigwork() is called and essentially does nothing because -s and -R were specified on the command line, newsyslog will sleep for 10 seconds as the (verbose) code says: "Pause 10 seconds to allow daemon(s) to close log file(s)". However, the man page verbiage for -R (and -s) seems quite clear that this sleep() is unnecessary because the daemon was expected to have already closed the log file before calling newsyslog. PR: 210020 Submitted by: David A. Bright <david_a_bright@dell.com> Sponsored by: Dell Inc. Changes: _U stable/9/usr.sbin/newsyslog/ stable/9/usr.sbin/newsyslog/newsyslog.c