Re: how does a pts for child process get set?
- From: Rainer Weikusat <rweikusat@xxxxxxxxxxx>
- Date: Wed, 28 Apr 2010 14:18:13 +0200
Joel Fernandes <agnel.joel@xxxxxxxxx> writes:
On Apr 25, 11:26 pm, Rainer Weikusat <rweiku...@xxxxxxxxxxx> wrote:
[...]
The process which opened the slave pty (either parent or child) called
the ptsname(3)-routine to determine the name of the 'inferior device'
corresponding to the existing file descriptor for the master half of
the pty.
Hi, Thanks a lot for your message.
I am bit confused about ptsname. Once the parent opens the master ptty
file (ptmx).. how does the child process get access to this fd? I
thought this is how it worked:
1. parent opens the /dev/ptmx file
2. calls ptsname on the master fd
3. forks
4. opens name returned by ptsname
5. execs image of child
So the opening of the slave (pts) file has to be done by the parent
itself. right?
'Parent' usually refers to the process which calls 'fork' and 'child' to
the process created by fork. Except if the FD_CLOEXEC flag
is set for a file descriptor, the program executed by the exec-call
inherits all open file descriptors and consequently, the program which
is executed could open theoretically the slave pty
itself. Practically, there must be code to implement this and the
executed program would need to know which descriptor number
corresponds to the pty master, so this won't usually happen.
.
- References:
- how does a pts for child process get set?
- From: Joel Fernandes
- Re: how does a pts for child process get set?
- From: Rainer Weikusat
- Re: how does a pts for child process get set?
- From: Joel Fernandes
- how does a pts for child process get set?
- Prev by Date: Re: Block Device Driver
- Next by Date: gcc3.4.6 compatibility with libgcc_s.so.1 and libstdc++ library
- Previous by thread: Re: how does a pts for child process get set?
- Next by thread: Re: how does a pts for child process get set?
- Index(es):
Relevant Pages
|