Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Nov 1999 02:59:21 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Peter Wemm <peter@netplex.com.au>
Cc:        Luoqi Chen <luoqi@watermarkgroup.com>, current@FreeBSD.ORG
Subject:   Re: init runs with console as control terminal? 
Message-ID:  <Pine.BSF.4.10.9911190232190.3063-100000@alphplex.bde.org>
In-Reply-To: <19991118150110.D2A7B1CA0@overcee.netplex.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.9911190232190.3063-100000>