From owner-freebsd-current Thu Nov 18 8: 0: 0 1999 Delivered-To: freebsd-current@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 012411542D for ; Thu, 18 Nov 1999 07:59:55 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from p80-ts5.syd2.zeta.org.au (beefcake.zeta.org.au [203.26.10.12]) by mailman.zeta.org.au (8.8.7/8.8.7) with ESMTP id DAA12701; Fri, 19 Nov 1999 03:06:25 +1100 Date: Fri, 19 Nov 1999 02:59:21 +1100 (EST) From: Bruce Evans X-Sender: bde@alphplex.bde.org To: Peter Wemm Cc: Luoqi Chen , current@FreeBSD.ORG Subject: Re: init runs with console as control terminal? In-Reply-To: <19991118150110.D2A7B1CA0@overcee.netplex.com.au> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, 18 Nov 1999, Peter Wemm wrote: > Luoqi Chen wrote: > > Since sometime last month, rc5des failed to start from my rc.local. I did > > a little investigation and it turned out that rc5des was started but later > > terminated by a SIGHUP. During its brief lifetime, /dev/console was its > > control terminal. Does anyone know what was going on? > > Something is revoking /dev/console, most of the time, but it varies. > Other times, you get garbage when /etc/rc exits (when using a serial > console). /etc/rc's shell is a controlling process with control terminal /etc/console, so /dev/console is supposed to be revoked when /etc/rc's shell exits. > syslog(3) also suffers as a result of this - it closes and reopens /dev/ > console to get around it when asked to do LOG_CONS. fstat(2) on the fd to > /dev/console returns EBADF. This broke postfix too. I think you mean syslogd(8). syslog(3) writes directly to the console, so it has to open it. > Each time I raised the issue, bde told me it wasn't happening. But *something* I don't remember it. There were different problems with /dev/console being aliased with user ttys. > is revoking /dev/console, either directly or via a revoke on /dev/ttyv0: > pwroot@overcee[10:50pm]~-104# fstat | grep none > root sh 336 2 - - none - > root cron 218 0 - - none - > root cron 218 1 - - none - > root cron 218 2 - - none - > root syslogd 145 8 - - none - > root adjkerntz 40 0 - - none - > root adjkerntz 40 1 - - none - > root adjkerntz 40 2 - - none - This is almost what I'd expect. adjkerntz calls daemon() with the noclose flag set so it soon ends up with dead file descriptors instead of closed ones. Most other daemons started by /etc/rc are apparently more careful. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message