From owner-freebsd-audit Sun Feb 17 9:37:18 2002 Delivered-To: freebsd-audit@freebsd.org Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id 3213837B402 for ; Sun, 17 Feb 2002 09:37:15 -0800 (PST) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 17 Feb 2002 17:37:14 +0000 (GMT) To: audit@freebsd.org Cc: Chris Johnson , Brian McDonald Subject: Syslog hangong on console. X-Request-Do: Date: Sun, 17 Feb 2002 17:37:13 +0000 From: David Malone Message-ID: <200202171737.aa59770@salmon.maths.tcd.ie> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG There have been several complaints over the years of syslogd getting stuck and then processes hanging as they try to syslog to the console. I haven't been able to reproduce syslogd hanging, but the following patch makes the problem less critical by avoiding the hang if someone calls syslog(3) and it can't talk to syslogd. This means that you can at least su and try to sort out the problem. Can anyone see any problems with this patch? (The comment dates from the CSRG days, when the console hanging would have been somewhat more serious than now, when some bloke at the co-lo might just have tipped scroll-lock...) David. Index: syslog.c =================================================================== RCS file: /cvs/FreeBSD-CVS/src/lib/libc/gen/syslog.c,v retrieving revision 1.24 diff -u -r1.24 syslog.c --- syslog.c 1 Feb 2002 01:32:19 -0000 1.24 +++ syslog.c 8 Feb 2002 21:05:17 -0000 @@ -255,12 +255,12 @@ return; /* - * Output the message to the console; don't worry about blocking, - * if console blocks everything will. Make sure the error reported - * is the one from the syslogd failure. + * Output the message to the console; try not to block + * as a blocking console should not stop other processes. + * Make sure the error reported is the one from the syslogd failure. */ if (LogStat & LOG_CONS && - (fd = _open(_PATH_CONSOLE, O_WRONLY, 0)) >= 0) { + (fd = _open(_PATH_CONSOLE, O_WRONLY|O_NONBLOCK, 0)) >= 0) { struct iovec iov[2]; struct iovec *v = iov; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message