Feature #5386
openimplement openpty(3C), forkpty(3C), and login_tty(3C)
0%
Description
Other systems have openpty() and forkpty() functions to make dealing with pty's considerably easier and more foolproof than they are for us.
The way it must be done on illumos is basically to implement whichever of those two routines you want, completely, and yourself. This should not be.
A correct implementation of each (and anything related I don't know of) should be in libc.
Related issues
Updated by Joshua M. Clulow almost 2 years ago
- Assignee set to Joshua M. Clulow
- Tags deleted (
needs-triage)
Updated by Joshua M. Clulow almost 2 years ago
Platform Survey¶
I don't believe these interfaces appear in any published UNIX standard. They do, however, appear on OpenBSD, FreeBSD, Mac OS X, Oracle Solaris, and Linux systems:
int openpty(int *, int *, char *, struct termios *, struct winsize *); int forkpty(int *, int *, char *, struct termios *, struct winsize *); int login_tty(int);
OpenBSD offers some additional interfaces in this family:
int getptmfd(void); int fdopenpty(int, int *, int *, char *, struct termios *, struct winsize *); int fdforkpty(int, int *, char *, struct termios *, struct winsize *);
They seem somewhat predicated on having a file descriptor that represents a management device. What we have is, instead, a cloning device: you open it and the act of opening it is what gets you a pseudo terminal pair. As it isn't exactly clear how these would work for us, and they don't seem to be widely available otherwise, so I am going to leave them out.
These routines will go directly in the C library. The header situation is something of a mess; each platform has made a slightly different choice, and we don't have the pty.h
header that Linux (and only Linux) is using here. What we do have is termios.h
, which you will need for struct termios
anyway, so that seems as good a place as any -- and is the choice that Oracle have made as well.
Updated by Joshua M. Clulow almost 2 years ago
- Subject changed from want openpty(), forkpty(), etc. to implement openpty(3C), forkpty(3C), and login_tty(3C)
Updated by Joshua M. Clulow 11 months ago
- Related to Feature #13994: align pseudo-terminal terminology with POSIX added
Updated by Joshua M. Clulow 6 months ago
- Has duplicate Feature #9041: implement forkpty added
Updated by Joshua M. Clulow 5 months ago
- Related to Feature #14249: pseudo-terminal nomenclature should reflect POSIX added
Updated by Joshua M. Clulow 5 months ago
- Related to Bug #6995: ioctl I_PUSH on a pty ignores O_NOCTTY and acquires it as controlling terminal added