From owner-freebsd-arch@FreeBSD.ORG Sun May 28 07:32:20 2006 Return-Path: X-Original-To: arch@freebsd.org Delivered-To: freebsd-arch@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B820716CB03 for ; Sun, 28 May 2006 07:16:26 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0C1E943D46 for ; Sun, 28 May 2006 07:16:25 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost.village.org [IPv6:::1] (may be forged)) by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id k4S7FFbQ082802; Sun, 28 May 2006 01:15:16 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Sun, 28 May 2006 01:15:18 -0600 (MDT) Message-Id: <20060528.011518.1306332021.imp@bsdimp.com> To: phk@phk.freebsd.dk From: "M. Warner Losh" In-Reply-To: <16029.1148764704@critter.freebsd.dk> References: <16029.1148764704@critter.freebsd.dk> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: arch@freebsd.org Subject: Re: A sort of plan for consoles in FreeBSD X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 May 2006 07:32:48 -0000 In message: <16029.1148764704@critter.freebsd.dk> Poul-Henning Kamp writes: : 4. The /dev/console device in multi-user mode. : Emergency output device for critical messages. Who is generating these messages? Are these for the programs that open /dev/console and spit out 'oh shit' messages? If so, why not make /dev/console a pipe that syslogd listens to? #3 can be solved by using a different name. Hmmm, I guess it would have to be a special kind of pipe where all writers go to the same readers since you'd want the output from #2 to go down this pipe as well. : I would like to redefine the semantics of "/dev/console" as follows: : if any console-consumers like xconsole(8) are active : send output to all console-consumers. : else if a controlling terminal is available : send output to controlling terminal (that is /dev/tty) : else : send output to syslogd, as if generated by printf(9). : (but do not actually output to low-level console) Assuming that this is for #4 /dev/console, that's fine. If you are talking about #2 or #3, then we have problems. The problem that I have with it being just /dev/tty is that the program opened /dev/console to tell the world about it, rather than just using fprintf(stderr,). What does that gain you? Things like syslog already log to stderr as well as /dev/console (when told to do both). This would remove most syslog messages from the logs if they were from programs with controlling ttys (all nondaemons). : If xconsole(8) or similar programs are run, or if syslogd(8) is : told to record all console output, they will get what they expect. : Alternatively, we try to send the message to the relevant user and : if that fails (for daemons) we log it in syslog. I'm not sure that I see the point of sending it to the actual user. Things like syslog already have an option to print to stderr as well as /dev/console. I think that muddies the waters. : This also involves number #3 from the list because today /sbin/init : opens /dev/console for single user mode and /etc/rc. But /sbin/init : can use any tty device so adding the necessary code to make the : low-level console communicate the relevant tty name to /sbin/init, : possibly making it overridable from the loader with a hint, will : take care of that. Indeed, it would. : Comments, ideas, suggestions etc welcome Warner