home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / unix / bsd / 10192 < prev    next >
Encoding:
Text File  |  1992-12-14  |  4.1 KB  |  104 lines

  1. Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!math.fu-berlin.de!unidui!du9ds3!veit
  2. From: veit@du9ds3.fb9dv.uni-duisburg.de (Holger Veit)
  3. Newsgroups: comp.unix.bsd
  4. Subject: Re: More on pccons/XFree86 problems (keyboard hangs)
  5. Date: 14 Dec 92 17:12:57 GMT
  6. Organization: Uni-Duisburg FB9 Datenverarbeitung
  7. Lines: 90
  8. Message-ID: <veit.724353177@du9ds3>
  9. References: <1992Dec13.172900.451@ponds.uucp> <1992Dec14.115444.12691@news.tu-graz.ac.at>
  10. Reply-To: veit@du9ds3.fb9dv.uni-duisburg.de
  11. NNTP-Posting-Host: du9ds3.fb9dv.uni-duisburg.de
  12. Keywords: 386BSD X11 XFree86 console pccons
  13.  
  14. In <1992Dec14.115444.12691@news.tu-graz.ac.at> chmr@fstgds01.tu-graz.ac.at (Christoph Robitschko) writes:
  15.  
  16. >In article <1992Dec13.172900.451@ponds.uucp> rivers@ponds.uucp (Thomas David Rivers) writes:
  17. >>  Try it out yourself, inside of an X window, do a :
  18. >>
  19. >>     kill -1 `cat /var/run/syslog.pid`
  20. >>
  21. >>  and your keyboard will lock up.
  22. >>
  23. >>
  24. >>I will probably try and examine the stock pccons.c to determine where
  25. >>the problem can be corrected... but if someone has an idea/fix, feel
  26. >>free to beat me to it...
  27. >>
  28. >The problem is that the pccons driver is used in two ways: first in 
  29. >the standard way through pcopen() etc., and second as a console device
  30. >through cnopen(). 
  31. >The cn???() calls simply call the corresponding pc???() routines, which 
  32. >is OK for open(), read() and write(), but not for close(), because
  33. >the close routine is only to be called when the LAST reference to 
  34. >the device was closed. But when the last reference to the console device
  35. >is closed (as happens when you kill or SIGHUP the syslogd), cnclose()
  36. >calls pcclose(), no matter if there are any references to the pccons
  37. >device (such as the keyboard input for your shell or X server).
  38. >pcclose() then thinks there is no more reference to it and disables
  39. >keyboard input.
  40.  
  41. >One possible solution would be to modify pcclose() to only do the real
  42. >close operation if there are really no more files open on it (A sort of
  43. >reference count or reference bits for each device type is needed).
  44.  
  45. >I don't know if any of the replacement pccons (or codrv) drivers fix this.
  46.  
  47.  
  48. >                            Christoph
  49. >-- 
  50. >.signature: Connection timed out
  51.  
  52. Ok, my second followup. I have just checked my system with codrv and I didn't
  53. succeed in reproducing this effect :-). Since I do not do reference counting
  54. in codrv, there must be a different reason. I found that pcclose in *not*
  55. called on 'kill -1 syslogd'. This is because usually the pccons device is
  56. normally not used at all (e.g. by csh or x386/keyboard input), so the vnode
  57. refcount for /dev/console is quite accurate.
  58. But then, what *might* be the reason, despite the fact that codrv uses a
  59. real /dev/kbd instead of a /dev/console switched into scancode mode?
  60. I had a "keyboard hang" with an earlier, unpublished version of codrv, in this 
  61. case, however, with a crashing or  'xterm -C'. The not so obvious reason is
  62. that closing a pty that happens to have the TIOCCONS attribute does not
  63. invalidate the constty pointer. So constty-> points to an invalid
  64. struct tty, which has been marked as closed. So it is not directly the 
  65. keyboard that hangs, but the csh which has this (invalid) tty open, waits on
  66. 'ttopen' (see this with ps -axl on a connected terminal). The mandatory
  67. fix for this is the following:
  68.  
  69. *** tty_pty.c.old    Tue Oct  6 03:33:52 1992
  70. --- tty_pty.c    Tue Oct  6 03:33:33 1992
  71. ***************
  72. *** 265,270 ****
  73. --- 265,271 ----
  74.       return (0);
  75.   }
  76.     
  77. + extern struct tty *constty;    /* -hv- 06.Oct.92*/
  78.   ptcclose(dev)
  79.         dev_t dev;
  80.   {
  81. ***************
  82. *** 275,280 ****
  83. --- 276,285 ----
  84.         tp->t_state &= ~TS_CARR_ON;
  85.       tp->t_oproc = 0;        /* mark closed */
  86.       tp->t_session = 0;
  87. + /* XXX -hv- 6.Oct.92 this might prevent the "hanging console bug" with X11 */
  88. +     if (constty==tp)
  89. +         constty = 0;
  90.   }
  91.   
  92.   ptcread(dev, uio, flag)
  93.  
  94.  
  95. This fix should also work with old pccons, at least it does no harm.
  96.  
  97. Holger
  98. -- 
  99. |  |   / Dr. Holger Veit         | INTERNET: veit@du9ds3.fb9dv.uni-duisburg.de
  100. |__|  /  University of Duisburg  |
  101. |  | /   Dept. of Electr. Eng.   |          "Understand me correctly:
  102. |  |/    Inst. f. Dataprocessing |     I'm NOT the WIZARD OF OS" (Holger)
  103.