PTYs with V.4

Ian G Batten igb at fulcrum.bt.co.uk
Fri Jan 25 04:28:55 AEST 1991


I'm trying to port a program which uses the BSD pty mechanism in a
fashion akin to telnet to V.4.  [[ The application is the ISODE 6.0 VT
daemon ]]

I get a master side by opening /dev/ptmx, call unlockpt on the result,
ptsname on the result and finally open the result of the ptsopen.
That's my slave.  Then I push (in order) ptem, ldterm and ttcompat
streams modules.

The call TIOCGETP then fails EINVAL.

Bearing in mind I know precious little about streams, can anyone suggest
if I've made an obvious boob or if there are any places I would be
adviced to start looking for the problem?


Outline of the code:

	p = open ("/dev/ptmx", 2);
	cp = ptsname (p);
	unlockpt (p);
	t = open(cp, 2);
	if ((ioctl (t, I_PUSH, "ptem") < 0) ||
	    (ioctl (t, I_PUSH, "ldterm") < 0) ||
	    (ioctl (t, I_PUSH, "ttcompat") < 0))
	  fatalperror (f, "stream push", errno);

	if (ioctl(t, TIOCGETP, (char*)&b) == -1) {
		perror("ioctl (TIOCGETP)");
		adios(NULLCP, "ioctl failed (TIOCGETP)");
	}  <== fails here

ian



More information about the Comp.unix.questions mailing list