home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / unix / bsd / 11152 < prev    next >
Encoding:
Text File  |  1993-01-12  |  2.0 KB  |  72 lines

  1. Newsgroups: comp.unix.bsd
  2. Path: sparky!uunet!gatech!usenet.ins.cwru.edu!agate!tfs.com!julian
  3. From: julian@tfs.com (Julian Elischer)
  4. Subject: patch for 386bsd pty code
  5. Message-ID: <1993Jan12.063114.17100@tfs.com>
  6. Organization: Trw Financial Systems
  7. Date: Tue, 12 Jan 1993 06:31:14 GMT
  8. Lines: 62
  9.  
  10. I have tracked down the problem that causes over 50% of the
  11. crashes on ref.tfs.com
  12. These are the crashes where ref still appears to be alive.
  13. (i.e. you can still ping it)
  14. [!! UNFORTUNATLY I AM UNABLE TO TEST IT AT THIS TIME!!!]
  15.  
  16. Two processes each write to the same pty
  17. in a special case, each sleeps waiting on the output queue.  
  18. Unfortunatly, the pty code sleeps and wakes up on this same address
  19. because the sub-field it sleeps on is the first in the output
  20. queue structure, and thus has the same address as the queue
  21. as a whole.
  22. The solution is to make the pty code sleep and wakeup
  23. on another sub-field of the structure.
  24.  
  25. The result of the confusion is that the two processes
  26. writing to the pty simply keep waking each other up
  27. (at high priority, and then going to sleep themselves at 
  28. high priority) As a result, all other work on the processor
  29. comes to a stop.
  30.  
  31. the following patch  should fix the problem
  32.  
  33. *** tty_pty.c.pl3    Mon Jan 11 22:11:25 1993
  34. --- tty_pty.c    Mon Jan 11 22:15:24 1993
  35. ***************
  36. *** 234,240 ****
  37.               pti->pt_selr = 0;
  38.               pti->pt_flags &= ~PF_RCOLL;
  39.           }
  40. !         wakeup((caddr_t)&tp->t_out.rb_hd);
  41.       }
  42.       if (flag & FWRITE) {
  43.           if (pti->pt_selw) {
  44. --- 234,240 ----
  45.               pti->pt_selr = 0;
  46.               pti->pt_flags &= ~PF_RCOLL;
  47.           }
  48. !         wakeup((caddr_t)&tp->t_out.rb_tl);
  49.       }
  50.       if (flag & FWRITE) {
  51.           if (pti->pt_selw) {
  52. ***************
  53. *** 334,340 ****
  54.               return (0);    /* EOF */
  55.           if (flag & IO_NDELAY)
  56.               return (EWOULDBLOCK);
  57. !         if (error = tsleep((caddr_t)&tp->t_out.rb_hd, TTIPRI | PCATCH,
  58.               ttyin, 0))
  59.               return (error);
  60.       }
  61. --- 334,340 ----
  62.               return (0);    /* EOF */
  63.           if (flag & IO_NDELAY)
  64.               return (EWOULDBLOCK);
  65. !         if (error = tsleep((caddr_t)&tp->t_out.rb_tl, TTIPRI | PCATCH,
  66.               ttyin, 0))
  67.               return (error);
  68.       }
  69.  
  70. ----
  71.  
  72.