[ale] Recieving SIGSTOP on a tty

Chris Fowler cfowler at outpostsentinel.com
Tue Apr 23 17:26:56 EDT 2002


Help,

I'm running into an interesting issue where a program that I'm running over
telentd may recieve the following
signals form the kernel.

-- SIGTTOU (Stopped (tty output)) ---
--- SIGTTOU (Stopped (tty output)) ---
ioctl(0, 0x5402, {B9600 opost isig -icanon -echo ...}) = ? ERESTARTSYS (To
be restarted)

The ioclty it is failing on is trying to set the tty in raw mode.  I placed
the following
code in my program

printf("TTY Owner: %d Us: %d\n", tcgetpgrp(0), getpid());

Output:
TTY Owner: 57 Us: 57

So clearly my program is the processgroup leader.   So why is it recieving a
SIGSTOP from
kernel 2.4.17?


My login.c does not exec the shell before without a fork.  So login is
running
on the tty and is in a wait() waiting for the shell to terminate.

I have this code in login


        if(pid)
        {

                if(setpgid(pid, pid) < 0)
                        perror("setpgid!");

                if(tcsetpgrp(0, pid) < 0)
                        perror("tcsetpgrp!");
        }

I should "give" the tty to the child which then just execl("/bin/sh",
"/bin/sh", 0);

The shell also use tcetpgrp() to give the child (my program) the tty.  Am I
doing something
wrong here?  What is strange is that my program does not always get SIGSTOP.
Only sometimes.

It ususally gets it if I log in immediately and try to run my program.

Thanks,
Chris


---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
sent to listmaster at ale dot org.






More information about the Ale mailing list