[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: /dev/console switching: the continuing saga

From: David Walter
Subject: Re: /dev/console switching: the continuing saga
Date: Wed, 20 Nov 2002 09:23:37 -0500
User-agent: Gnus/5.090007 (Oort Gnus v0.07) XEmacs/21.4 (Honest Recruiter, hurd-i386-debian)

It turns out that there is another issue (at least one).

I've been wondering about this in a different context, and hopefully
the following makes sense.

In hurd/init/init.c the hardware device is opened.

      || device_open (device_master, D_WRITE, "console", &consdev))

But when multiuser mode is initiated there is no close and reopen in
the init of it's standard io devices, afaict.

Instead term uses:

  err = device_open_request (device_master, phys_reply,
                             D_READ | D_WRITE, tty_arg);

Okay. So why the problem?

I've been noticing that if the initial term process running on console
isn't killed console output doesn't change to the new device.

If process 7 is killed (/hurd/term /dev/console ...) then there is a
lost resource.

Also, processes  that cause output  to  the /dev/console seem  to hang
until 7 has been killed and restarted then the options reset.

I'm  assuming that both  of  these are  a  result of init keeping  the
device open, rather than using  the translated node as it's roundezous
point (/dev/console).

If this makes sense, it looks like init needs to open /dev/console for
its standard io device _after_ the rest of the system translators have
been started and the terminal device has been started.

I have  tried  this, and it works,   yet this is still  an  incomplete
solution as /hurd/proc opens   the _device_ and  /hurd/{auth,exec} are
using  proc's (? or more  likely as they  are children of init init's)
idea of std{in,out,err}.

This isn't so simply fixed as the translator hasn't started yet on
/dev/console so {proc,exec,auth} can't just open /dev/console.

I don't see any clear solution to this problem short of a call back to
frob the stdio for {proc,exec,auth} once init has finished the startup.

The following does seem to work for init, but it is too late in the
game to fixup proc,exec & auth.

Index: init.c
RCS file: /cvsroot/hurd/hurd/init/init.c,v
retrieving revision 1.129
diff --unified -w -i -r1.129 init.c
--- init.c      8 May 2002 09:20:38 -0000       1.129
+++ init.c      20 Nov 2002 14:17:41 -0000
@@ -1070,6 +1070,8 @@
       return -1;
+  stdin  =          fopen ("/dev/console", "r");
+  stdout = stderr = fopen ("/dev/console", "w");
   return 0;

pub  1024D/DC92AE30 2002-02-26 David Walter <dwalter@syr.edu>
fingerprint = 50A0 E513 732D 1D0F BD26  C84E A8DD 9D80 DC92 AE30
sub  2048g/51023582 2002-02-26

reply via email to

[Prev in Thread] Current Thread [Next in Thread]