*BSD News Article 14754


Return to BSD News archive

Newsgroups: comp.os.386bsd.bugs
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!howland.reston.ans.net!newsserver.jvnc.net!gmd.de!mururoa!veit
From: veit@mururoa.gmd.de (Holger Veit)
Subject: Re: Patch for hanging console
Message-ID: <1993Apr20.115301.2477@gmd.de>
Sender: veit@mururoa (Holger Veit)
Nntp-Posting-Host: mururoa
Organization: GMD, Sankt Augustin, Germany
References: <1qttvcINNno2@fstgds01.tu-graz.ac.at> <1993Apr19.224208.27016@cs.few.eur.nl>
Date: Tue, 20 Apr 1993 11:53:01 GMT
Lines: 66

In article <1993Apr19.224208.27016@cs.few.eur.nl>, pk@cs.few.eur.nl (Paul Kranenburg) writes:
|> In <1qttvcINNno2@fstgds01.tu-graz.ac.at> chmr@edvz.tu-graz.ac.at (Christoph Robitschko) writes:
|> 
|> >This patch fixes the hanging console problem. The problem was that the console
|> >can be accessed through two drivers (major device numbers), so the
|> >reference count on the vnode does not represent the actual use count
|> >of the console device. Because of this, the device close routine can be
|> >called even though the device is still open through the other major number,
|> >such hanging the device.
|> 
|> >To see the problem:
|> > [...]
|> 
|> >My fix creates a temporary vnode for the device where the console is 
|> >mapped to, and keeps a reference on it as long as /dev/console is open.

Device drivers shouldn't know about the upper representation layer. If this happens
to be changed some day (as it was with the "select patch"), several side
effects will have to be considered. Just for completeness: I don't believe
that the vnode representation will be changed soon.
A more simple solution might be a counter in the driver which counts the 
several successful open and close calls to it, and does its cleanup when the
counter reaches zero.
 
|> It seems a rather convoluted solution to this particular problem. This
|> whole "/dev/vga" business was a quick hack in the first place, but since
|> there are a whole bunch of XFree servers out there based on it, I'm afraid
|> w're stuck with it for the remaining lifetime of the .1 release.
|> 
|> The terminal-, keyboard translation- and framebuffer-functions of the
|> current pccons driver must be decoupled, providing separate interfaces
|> for each (say, /dev/kbd, /dev/fb, etc).

I agree completely here.
BTW:-) : This is exactly the way "codrv" was concepted although the
decoupling could be made more strong than it is in this code. But of course
there are a number of "improved pccons" variants out there that do not 
follow this strategy. This code of course requires such vnode hacking :-(.
Another special feature of the "improved drivers" is that they pass
non-ascii information (scan codes) through the tty channel, which causes
interesting effects when the channel is in "scan code mode" and another process
grabs it, expecting ascii. Many of the "hanging-console-after-end-of-X11" 
problems have to do with that indirectly (some were due to bugs in pts/ptclose,
others due to closing the /dev/console multiplexer device, however).

|> Meanwhile, since the X server only requires one ioctl() function and
|> the device map routine, things should work fine by making another entry
|> in cdevsw for just this purpose having only these two entries and setting
|> the others to 'nulldev' or 'nodev' as appropriate. Call this entry '/dev/vga',
|> the original /dev/vga (dev 12,0) can disappear from /dev.

This is nearly the way it was done in "codrv", with the slight difference that
/dev/vga is a minor device of the whole console system (/dev/kbd is the other).
 
|> -pk
|> 
|> 
|> -pk

-- 
         Dr. Holger Veit                   | INTERNET: Holger.Veit@gmd.de
|  |   / GMD-SET German National Research  | Phone: (+49) 2241 14 2448
|__|  /  Center for Computer Science       | Fax:   (+49) 2241 14 2342
|  | /   P.O. Box 13 16                    |    Three lines Signature space
|  |/    Schloss Birlinghoven              |    available for rent. Nearly
         DW-5205 St. Augustin, Germany     |    unused, good conditions