Yes, I was looking for the SUS API to create a pty master/slave pair, i.e.
int fd_master, fd_slave;
char *slave; ...
fd_master = open("/dev/ptmx", O_RDWR);
grantpt(fd_master);
unlockpt(fd_master);
slave = ptsname(fd_master);
fd_slave = open(slave, O_RDWR);

Now when I created the master, how to I pass the slave to a shell?
Just dup(fd_slave) for stdin, stdout, stderr and pass it to
fork()/exec()? Or do I have to use open()? Or just open once and pass
the same fd for stdin, stdout, stderr to the shell?

Olga

On Wed, Mar 24, 2010 at 1:10 AM, Edward Pilatowicz
<edward.pilatowicz at sun.com> wrote:
> On Wed, Mar 24, 2010 at 12:57:40AM +0100, ????? ???????????? wrote:
>> I am looking for an example for the user land pty/pseudo-terminal API
>> to implement custom master/slaves (without setid). Does anyone have
>> pointers?
>>
>
> i'm not totally sure i understand the question, but it sounds like your
> asking for pointers to the open("/dev/ptmx"), grantpt(3c), ptsname(3C),
> unlockpt(3C), posix interfaces.
>
> ed
>



-- 
      ,   _                                    _   ,
     { \/`o;====-    Olga Kryzhanovska   -====;o`\/ }
.----'-/`-/     olga.kryzhanovska at gmail.com   \-`\-'----.
 `'-..-| /     Solaris/BSD//C/C++ programmer   \ |-..-'`
      /\/\                                     /\/\
      `--`                                      `--`

Reply via email to