| Author |
Best way to check when pty slave has closed?
|
|
| Boltar 2007-11-22, 1:23 pm |
| HI
I've got a program that spawns of a child and the parent and child
communicate via a pty master-slave pair. Problem is , when the child
closes the slave pty file descriptor no notification comes through the
the parent - it carries on sitting in select() on the master fd.
Is there a way to check for when the slave has been closed (on linux)?
Thanks for any help
B2003
| |
| Casper H.S. Dik 2007-11-22, 1:23 pm |
| Boltar <boltar2003@yahoo.co.uk> writes:
>I've got a program that spawns of a child and the parent and child
>communicate via a pty master-slave pair. Problem is , when the child
>closes the slave pty file descriptor no notification comes through the
>the parent - it carries on sitting in select() on the master fd.
>Is there a way to check for when the slave has been closed (on linux)?
Does the parent keep a filedescriptor pointing to the slave side open?
Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
| |
| Boltar 2007-11-22, 1:23 pm |
| On Nov 22, 4:17 pm, Casper H.S. Dik <Casper....@Sun.COM> wrote:
> Boltar <boltar2...@yahoo.co.uk> writes:
>
> Does the parent keep a filedescriptor pointing to the slave side open?
Yes it does. Should it close it?
B2003
| |
| Rainer Weikusat 2007-11-22, 1:23 pm |
| Boltar <boltar2003@yahoo.co.uk> writes:
> On Nov 22, 4:17 pm, Casper H.S. Dik <Casper....@Sun.COM> wrote:
>
> Yes it does. Should it close it?
As long as input would still be possible from the slave, ie there
exists an open descriptor, the master will not see an EOF.
| |
| Casper H.S. Dik 2007-11-22, 1:23 pm |
| Boltar <boltar2003@yahoo.co.uk> writes:
>On Nov 22, 4:17 pm, Casper H.S. Dik <Casper....@Sun.COM> wrote:
[vbcol=seagreen]
>Yes it does. Should it close it?
Yes; the parent will only be notified of a close if the last slave
file descriptor is closed.
Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
| |
| Boltar 2007-11-22, 1:23 pm |
| On Nov 22, 5:45 pm, Casper H.S. Dik <Casper....@Sun.COM> wrote:
>
> Yes; the parent will only be notified of a close if the last slave
> file descriptor is closed.
Works now. Thanks
B2003
|
|
|
|