Thread View: comp.unix.sys5.r3
2 messages
2 total messages
Started by Colonel Panic
Thu, 18 Mar 1993 07:01
ptys: how to get name of slave with SCO ptmx driver?
Author: Colonel Panic
Date: Thu, 18 Mar 1993 07:01
Date: Thu, 18 Mar 1993 07:01
25 lines
1979 bytes
1979 bytes
I'm trying to make use of the pty driver in SCO 3.2v4.0, but
they don't say in the ptmx man page how you find out the name of
the parent and/or slave that you've been assigned.
In SVR4, you determine this using the ptsname() call.
In AIX, you use ttyname() against the open master handle, and it returns
you the pathname of the assigned slave.
SCO doesn't seem to have a ptsname() call, and calling ttyname()
against an open master device seems to return NULL.
So, what *is* a workable method with SCO? The man pages don't say.
Perhaps the STREAMS printed manual says, but we don't seem to have
any STREAMS doc in either of our "complete" sets of manuals.
Any advice appreciated. Thanks in advance. Followups to comp.unix.sys5.r3,
please, as we don't get the biz.sco.* groups here.
--
Alan Denney aland@informix.com {pyramid|uunet}!infmx!aland
Disclaimer: Poster under influence of 1,3,7-trimethylxanthine
Qvfpynvzre: Zl ubirepensg vf shyy bs rryf.
"What's the use of somebody who doesn't wonder? It's the hallmark
of our species that we are continually wondering what is going on."
- John Dobson, S.F. Sidewalk Astronomers
Re: ptys: how to get name of slave with SCO ptmx driver?
Author: Colonel Panic
Date: Wed, 24 Mar 1993 21:55
Date: Wed, 24 Mar 1993 21:55
54 lines
3194 bytes
3194 bytes
Thanks to those who replied re: SCO pty support. Henry's posting below is
short and sweet:
In article <1993Mar19.012717.285@netcom.com> vancleef@netcom.com (Henry van Cleef) writes:
>master_fd=open("dev/ptmx",....);
>grantpt(master_fd);
>unlockpt(master_fd);
>slave_name=ptsname(master_fd);
>
>slave_name is char *.
>
>Note that this is not a "pty driver" but a STREAMS pipe type driver.
>You can push ldterm and ptem modules on one end to get a line discipline
>for a pseudo-tty. Stevens "Unix Network Programming" gives a complete
>example.
>
>The functions you need are in libpt.a You will need to link with that
>lib.
In other words, the methodology seems identical to the documented method
for SVR4 except for the separate library (/usr/lib/libpt.a).
I am still getting occasional failures (-4 return value) from grantpt()
in SCO. Retrying the failing grantpt() has worked in every case. I also
had the same problem on NCR SVR4, so I'll just live with the workaround.
Return values for grantpt() are not documented even in the SVR4 book.
Also beware: grantpt() calls or forks some other program; if you are
handling SIGCHLD/SIGCLD, this will trigger your signal handler.
The grantpt()/unlockpt() combo opens the master and assigns the slave
but does not open the slave. ptsname() gives you the pathname for the
assigned slave (on AIX, use ttyname() instead). Eventually, when you
open the slave, you need to push ptem and ldterm using ioctl() (except
on AIX. Ain't portability fun.).
Thanks also to Dave Gurr and Chris Schulz at SCO who replied via email.
Dave indicated that the lack of doc for these pty calls is a "shortcoming
that is being addressed".
libpt.a also exists on ISC and AT&T SVR3.2, so I'm guessing that this
methodology should work on Intel-based SVR3.2 in general.
>Hank van Cleef vancleef@netcom.com vancleef@tmn.com Andover, Mass.
--
Alan Denney aland@informix.com {pyramid|uunet}!infmx!aland
Disclaimer: Poster under influence of 1,3,7-trimethylxanthine
Qvfpynvzre: Zl ubirepensg vf shyy bs rryf.
"The mist clung to the mountain the same way a thirteen-year-old girl clings
to her boyfriend, although the mountain wasn't thinking about "getting lucky."
(1990 Bulwer-Lytton Fiction Contest entry)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads