Signals to child processes

Signals to child processes

Post by Adrian Maria » Thu, 16 Apr 1992 08:15:13



I have a program which is running a telnet as a child process (a
pipe).  If I hit ^Z (sending SIGTSTP to the parent), the child telnet
receives some signal which causes it to lose its connection.

If I hit ^Z when using telnet directly, it is tramsmitted to the
remote host which then drops the connection, but if I use ^] to get to
the telnet prompt first, I can suspend the telnet without problems.  
How can I duplicate this behavior when the telnet is running as the
child?

 
 
 

Signals to child processes

Post by Adrian Maria » Fri, 17 Apr 1992 13:12:35



>I have a program which is running a telnet as a child process (a
>pipe).  If I hit ^Z (sending SIGTSTP to the parent), the child telnet
>receives some signal which causes it to lose its connection.
>If I hit ^Z when using telnet directly, it is tramsmitted to the
>remote host which then drops the connection, but if I use ^] to get to
>the telnet prompt first, I can suspend the telnet without problems.  
>How can I duplicate this behavior when the telnet is running as the
>child?

I determined that when I press ^Z, SIGTSTP is being sent to both
parent and child.  The child telnet is catching the signal and
translating it into a ^Z character which it sends to the remote host.
The remote host then cuts the connection.  

I have tried to determine what sends SIGTSTP to the child with no
success.  I tried trapping various signals in the parent, but the
child ALWAYS received the SIGTSTP.  Is it even possible to prevent
this from happening?

 
 
 

Signals to child processes

Post by Joachim Barts » Fri, 17 Apr 1992 23:13:25


I guess telnet modifies the stty parameters so no input processing
is done for ^Z (if online). Suspending telnet should work if *your*
program sends the SIGTSTP to telnet.
- switch off input processing for ^Z
- if u read a ^Z, signal to telnet
or
- catch the signal and send this signal to your child.
--
 ----------------------------------------------------------------------------

 Systems Engineering Department - Bilfinger+Berger AG, Mannheim, Germany
 "Information is the greatest weapon of power to the modern wizard"
 
 
 

1. signal() inside child process doesn't work??

Hello all,
       Below is a C program I tried on a RH Linux 6.0 machine
and compiled using a gcc compiler.The version of the gcc is
2.96
     The output of the program is as follows
"Parent exiting" after some few seconds.

     I tried the same program on an HP-UX 10.20 machine.The output
of the program was:
  signal is received by child
  parent exiting                 (after a few seconds)

     I couldn't understand what could be the problem?

#include <stdio.h>
#include <signal.h>

void abc();
int main(void)
{
   int pid;
   pid = fork();
   if(pid == 0)
   {
      signal(SIGINT,abc);
      sleep(1);
   }
   if (pid > 0 )
   {
      kill(pid,SIGINT);
      sleep(5);
      printf("parent exiting\n");
   }
   return 0;
void abc()
{
   printf("signal is received by child\n");

Thanks
Karthik

2. get full pathname of current script

3. Signals from child process can't interrupt wait() from parent?

4. Specifying config file for startx??

5. Signals/Parent/child process

6. IDE Controller under Debian Linux

7. smail failed to reap child process: No child processes

8. Exporting file systems to Suns

9. Getting a child and child's child process-id

10. how to kill a child process that runs other children processes

11. Getting a child and child's child process-id

12. Child process signalled - termsig 12

13. How to set up signal handling in UNIX to kill a daemon process and children