Loading...
--- Libc/Libc-1725.40.4/util/openpty.3
+++ Libc/Libc-498/util/openpty.3
@@ -34,7 +34,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd June 17, 2025
+.Dd November 4, 1996
.Dt OPENPTY 3
.Os
.Sh NAME
@@ -45,47 +45,45 @@
.Sh SYNOPSIS
.Fd #include <util.h>
.Ft int
-.Fn openpty "int *aprimary" "int *areplica" "char *name" "struct termios *termp" "struct winsize *winp"
+.Fn openpty "int *amaster" "int *aslave" "char *name" "struct termios *termp" "struct winsize *winp"
.Ft int
.Fn login_tty "int fd"
.Ft pid_t
-.Fn forkpty "int *aprimary" "char *name" "struct termios *termp" "struct winsize *winp"
+.Fn forkpty "int *amaster" "char *name" "struct termios *termp" "struct winsize *winp"
.Sh DESCRIPTION
The
.Fn openpty ,
.Fn login_tty ,
and
.Fn forkpty
-functions manipulate ttys and pseudo-ttys.
+functions perform manipulations on ttys and pseudo-ttys.
.Pp
The
.Fn openpty
-function allocates a pseudo-tty and returns file descriptors
-for the primary and replica in
-.Fa aprimary
+function finds an available pseudo-tty and returns file descriptors
+for the master and slave in
+.Fa amaster
and
-.Fa areplica .
+.Fa aslave .
If
.Fa name
-is non-null, the pathname of the replica is stored in the buffer
-pointed to by
-.Fa name ,
-which must be at least 128 bytes.
+is non-null, the filename of the slave is returned in
+.Fa name .
If
.Fa termp
-is non-null, the terminal parameters of the replica will be set to the
+is non-null, the terminal parameters of the slave will be set to the
values in
.Fa termp .
If
.Fa winp
-is non-null, the window size of the replica will be set to the values in
+is non-null, the window size of the slave will be set to the values in
.Fa winp .
.Pp
The
.Fn login_tty
function prepares for a login on the tty
.Fa fd
-(which may be a real tty device, or the replica of a pseudo-tty as
+(which may be a real tty device, or the slave of a pseudo-tty as
returned by
.Fn openpty )
by creating a new session, making
@@ -103,20 +101,17 @@
.Fn fork ,
and
.Fn login_tty
-to creates a new process operating in a pseudo-tty.
-The file
-descriptor of the primary side of the pseudo-tty is returned in
-.Fa aprimary ,
-and the pathname of the replica is stored in the buffer pointed to by
+to creates a new process operating in a pseudo-tty. The file
+descriptor of the master side of the pseudo-tty is returned in
+.Fa amaster ,
+and the filename of the slave in
.Fa name
-if it is non-null.
-The buffer must be at least 128 bytes long.
-The
+if it is non-null. The
.Fa termp
and
.Fa winp
parameters, if non-null, will determine the terminal attributes and
-window size of the replica side of the pseudo-tty.
+window size of the slave side of the pseudo-tty.
.Sh RETURN VALUES
If a call to
.Fn openpty ,
@@ -125,8 +120,7 @@
.Fn forkpty
is not successful, -1 is returned and
.Va errno
-is set to indicate the error.
-Otherwise,
+is set to indicate the error. Otherwise,
.Fn openpty ,
.Fn login_tty ,
and the child process of
@@ -138,23 +132,9 @@
.Fn openpty
will fail if:
.Bl -tag -width Er
-.It Bq Er EAGAIN
-There are no available pseudo-ttys.
-.It Bq Er ENXIO
-The
-.Xr sysctl 3
-limit
-.Dq kern.tty.ptmx_max
-number of pseudo-terminal devices was reached.
+.It Bq Er ENOENT
+There are no available ttys.
.El
-.Pp
-The
-.Fn openpty
-function may also fail and set
-.Va errno
-for any of the errors specified for the
-.Xr open 2
-system call.
.Pp
.Fn login_tty
will fail if
@@ -169,23 +149,15 @@
.Fn fork
fails.
.Sh FILES
-.Bl -tag -width /dev/ttys[0-9][0-9][0-9] -compact
-.It Pa /dev/ptmx
-cloning pseudo-tty device
-.It Pa /dev/ttys[0-9][0-9][0-9]
-replica pseudo-tty devices
+.Bl -tag -width /dev/[pt]ty[pqrstuwxyzPQRST][0123456789abcdef] -compact
+.It Pa /dev/[pt]ty[pqrstuwxyzPQRST][0123456789abcdef]
.El
.Sh SEE ALSO
-.Xr fork 2 ,
-.Xr ptsname 3 ,
-.Xr sysctl 3
-.Sh CAVEATS
-Due to the risk of accidentally passing a too-small buffer as the
-.Fa name
-argument to the
-.Fn forkpty
-and
+.Xr fork 2
+.Sh BUGS
+The names of the virtual consoles for the i386 PCVT console driver
+conflict with what would be the seventh group of pseudo-ttys, so
.Fn openpty
-functions, it is advisable to use
-.Xr ptsname_r 3
-instead.
+skips
+.Pa /dev/[pt]tyv[0123456789abcdef]
+while looking for pseudo-ttys.