*BSD News Article 8857


Return to BSD News archive

Newsgroups: comp.unix.bsd
Path: sserve!manuel.anu.edu.au!munnari.oz.au!spool.mu.edu!wupost!newsfeed.rice.edu!rice!news.Rice.edu!rich
From: rich@Rice.edu (& Murphey)
Subject: Re: More on pccons/XFree86 problems (keyboard hangs)
In-Reply-To: chmr@fstgds01.tu-graz.ac.at's message of Mon, 14 Dec 92 11:54:44 GMT
Message-ID: <RICH.92Dec14095633@superego.Rice.edu>
Sender: news@rice.edu (News)
Reply-To: Rich@rice.edu
Organization: Department of Electrical and Computer Engineering, Rice
	University
References: <1992Dec13.172900.451@ponds.uucp> <1992Dec14.115444.12691@news.tu-graz.ac.at>
Date: Mon, 14 Dec 1992 15:56:33 GMT
Lines: 55

>>>>> In article <1992Dec14.115444.12691@news.tu-graz.ac.at>, chmr@fstgds01.tu-graz.ac.at (Christoph Robitschko) writes:
Christoph> In article <1992Dec13.172900.451@ponds.uucp> rivers@ponds.uucp (Thomas David Rivers) writes:
>  Try it out yourself, inside of an X window, do a :
>
>     kill -1 `cat /var/run/syslog.pid`
>
>  and your keyboard will lock up.
>
>
>I will probably try and examine the stock pccons.c to determine where
>the problem can be corrected... but if someone has an idea/fix, feel
>free to beat me to it...
>
Christoph> The problem is that the pccons driver is used in two ways: first in 
Christoph> the standard way through pcopen() etc., and second as a console device
Christoph> through cnopen(). 
Christoph> The cn???() calls simply call the corresponding pc???() routines, which 
Christoph> is OK for open(), read() and write(), but not for close(), because
Christoph> the close routine is only to be called when the LAST reference to 
Christoph> the device was closed. But when the last reference to the console device
Christoph> is closed (as happens when you kill or SIGHUP the syslogd), cnclose()
Christoph> calls pcclose(), no matter if there are any references to the pccons
Christoph> device (such as the keyboard input for your shell or X server).
Christoph> pcclose() then thinks there is no more reference to it and disables
Christoph> keyboard input.

Christoph> One possible solution would be to modify pcclose() to only do the real
Christoph> close operation if there are really no more files open on it (A sort of
Christoph> reference count or reference bits for each device type is needed).

Another solution might be to ignore the close while the X server is
running:

diff -cb pccons.c~ pccons.c
*** pccons.c~	Mon Dec 14 09:07:08 1992
--- pccons.c	Mon Dec 14 09:07:52 1992
***************
*** 241,246 ****
--- 241,250 ----
  	int flag, mode;
  	struct proc *p;
  {
+ #ifdef XSERVER
+ 	if (pc_xmode)
+ 		return (0);
+ #endif /* XSERVER */
  	(*linesw[pccons.t_line].l_close)(&pccons, flag);
  	ttyclose(&pccons);
  	return(0);


Christoph> I don't know if any of the replacement pccons (or codrv) drivers fix this.

codrv does fix this and should be supported in the next XFree86
release.  Rich