|
Home > Archive > Unix Programming > November 2007 > How do I pass signals to a slave pty in linux?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How do I pass signals to a slave pty in linux?
|
|
| Boltar 2007-11-20, 7:29 pm |
| Hi
I'm writing an app thats going to fork-exec processes and dup2 the
child stdio to a slave pty. I know how to pass the window size change
from the master pty using ioctl() but how do I pass any standard
signals the parent process receives to the child process via the
master-slave link? eg SIGHUP , SIGINT
This is for linux , I realise theres a lot of variation between *nix's
in pty handling.
Thanks for any help
B2003
| |
| Boltar 2007-11-20, 7:29 pm |
| On Nov 20, 8:14 pm, Boltar <boltar2...@yahoo.co.uk> wrote:
> Hi
>
> I'm writing an app thats going to fork-exec processes and dup2 the
> child stdio to a slave pty. I know how to pass the window size change
> from the master pty using ioctl() but how do I pass any standard
> signals the parent process receives to the child process via the
> master-slave link? eg SIGHUP , SIGINT
Just realised I was being thick , I can simply use kill(). Doh.
B2003
| |
| Rainer Weikusat 2007-11-21, 7:32 am |
| Boltar <boltar2003@yahoo.co.uk> writes:
> I'm writing an app thats going to fork-exec processes and dup2 the
> child stdio to a slave pty. I know how to pass the window size change
> from the master pty using ioctl() but how do I pass any standard
> signals the parent process receives to the child process via the
> master-slave link? eg SIGHUP , SIGINT
These are actually signals from two different categories. One would be
'keyboard-generated signals usually used for process control' (INT,
QUIT, TSTP). These are associated with specific character codes (=>
termios(3)) and posted by the terminal driver in the kernel if the
terminal is appropriately configured when it encounters one of this
characters. The way to make them take effect in the child reading
from the slave pty is to configure the the terminal the parent reads
from to treat the control characters as ordinary data and pass
them as such as input to the slave pty. The terminal driver will then
post the signals to the child.
SIGHUP is generated by the system if a 'hangup' occurs on the
controlling terminal of some process (presumably, this originally
meant that whoever dialed into the modem associated with a remote
terminal link hung up the phone, ie terminated the connection). The
controlling pty for the child is the slave end of the pseudo terminal
an if the master is closed, for instance, because the last process
having open terminates, a SIGHUP should be generated for the child.
|
|
|
|
|