[haiku-bugs] Re: [Haiku] #5076: cat /dev/urandom hangs the terminal after a while

  • From: "bonefish" <trac@xxxxxxxxxxxx>
  • Date: Fri, 11 Jun 2010 21:11:57 -0000

#5076: cat /dev/urandom hangs the terminal after a while
-------------------------+--------------------------------------------------
 Reporter:  jackburton   |       Owner:  bonefish      
     Type:  bug          |      Status:  new           
 Priority:  normal       |   Milestone:  R1            
Component:  Drivers/TTY  |     Version:  R1/Development
 Keywords:  gcc4 hybrid  |   Blockedby:                
    Patch:  0            |    Platform:  All           
 Blocking:               |  
-------------------------+--------------------------------------------------

Comment(by bonefish):

 Replying to [comment:11 jackburton]:
 > Replying to [comment:10 bonefish]:
 > > Replying to [comment:8 jackburton]:
 > > > Looking at the linux tty layer I found that they expose a reduced
 available buffer to the tty drivers, so that there is always enough room
 to handle cases like this.
 > >
 > > Can you explain how that is supposed to work?
 >
 > Some comments ago you wrote: "This would also solve the second issue,
 that in echo mode writes from the Terminal are echoed back to the TTY
 master, whose buffer could already be full. ".
 > If the TTY master buffer reserved some space to handle echo and control
 characters (by exposing a smaller buffer to drivers), its buffer will
 never fill up completely, so it won't deadlock.

 The driver would be the pseudo terminal (i.e. the master side) and
 exposing smaller buffers to it cannot possibly help it writing more. So
 assuming the client side is supposed to see a smaller buffer, this might
 help with the echo case. Also assuming that the control codes are
 processed out of order -- which I believe they shouldn't -- the main
 problem, issue one, remains: cat never reads from the terminal, so the
 buffer is bound to run full eventually, regardless of how big it is. It
 would be interesting how Linux respectively the terminal programs solve
 that.

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/5076#comment:12>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: