[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SIGTTOU handling

From: cerise
Subject: SIGTTOU handling
Date: Sun, 11 Nov 2007 21:56:11 -0800
User-agent: Mutt/1.5.13 (2006-08-11)


I'm having some trouble with bash -- it doesn't seem
to be a problem with bash, but rather in my understanding
of how job control works.  This seemed like a pretty good
place to start looking for the sort of help I need on this.

At present, I'm writing what I call a terminal repeater.
It allocates a unix socket and a pty.  It forks and the
parent process becomes a pretty typical server connection
which monitors for connections to the unix socket and
writes to the pty.  When a write occurs to the pty, the 
parent process repeats that write to each of the 
connections to the unix socket.  Using this method, the
exact screen contents can be duplicated to a number of

I had some difficulties getting job control working at
first.  I found that having the child process do a 
setpgrp() before forking to the bash instance made the
error message about disabling job control go away.

The problem for which I'm seeking help deals with the
way bash handles the SIGTTOU signal.  I can duplicate
the problem by typing "less /etc/passwd &".

When I do this under a normal bash process, I get:
$ less /etc/passwd &
[1] 28054

[1]+  Stopped                 less /etc/passwd

When I launch this under my repeater, I get:
$ less /etc/passwd &
[1] 28473

[1]+  Stopped(SIGTTOU)        less /etc/passwd

Under a normal bash process, I can then foreground
it and everything works the way it ought to.  However,
if I try to foreground it under the bash process running
on top of my repeater, I get:
$ fg
less /etc/passwd

[1]+  Stopped(SIGTTOU)        less /etc/passwd

My assumption is that I'm not setting up something 
correctly before running my execl to bash because I'm
not seeing similar behavior in bash on either side.

Can someone provide a hint to this end?  My deepest
thanks for your time and any advice you might be
able to provide.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]