summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorнаб <nabijaczleweli@nabijaczleweli.xyz>2023-07-18 01:31:17 +0200
committerAlejandro Colomar <alx@kernel.org>2023-07-18 13:33:57 +0200
commit114ed1505678640c456533d8e2b4436a52afc7f4 (patch)
treecf74ccf52a99c358f01d68e94c82a228fdae6bdf
parent7f19730b07068ba871da501f498f06d26530882a (diff)
grantpt.3: It's a no-op on modern glibc and other UNIXes; HISTORYise
FreeBSD, OpenBSD, and Linux (/dev/ptmx) do all intialisation in open(2), and grantpt(3) is a no-op (that checks whether the fd is a pty, except on musl). The illumos gate and NetBSD do a ioctl (and, indeed, illumos-gate commit facf4a8d7b59fde89a8662b4f4c73a758e6c402c ("PSARC/2003/246 Filesystem Driven Device Naming"), which kills pt_chmod, notes that it's been "6464196 bfu should remove pt_chmod, obsoleted by /dev filesystem"). glibc 2.33 completely kills BSD PTY support on Linux (Debian hasn't configured with them on any architecture since 2007: https://bugs.debian.org/338404 and even earlier on some arches; they're really just trivia under Linux ‒ this may be better served stuffed into HISTORY as an explainer for the SIGCHLD thing, since regardless of the "version", the behaviour is well-defined and consistent). There really aren't many cohesive "versions" of this ‒ indeed, so long as grantpt(3) exists it behaves precisely as described here ‒ inasmuch as different systems, historically, had different ptys, and thus different implementations. These are all but trivia. Cc: Jakub Wilk <jwilk@jwilk.net> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r--man3/grantpt.322
1 files changed, 10 insertions, 12 deletions
diff --git a/man3/grantpt.3 b/man3/grantpt.3
index a19172a3e..949f70de9 100644
--- a/man3/grantpt.3
+++ b/man3/grantpt.3
@@ -83,18 +83,6 @@ T} Thread safety MT-Safe locale
.hy
.ad
.sp 1
-.SH VERSIONS
-Many systems implement this function via a set-user-ID helper binary
-called "pt_chown".
-On Linux systems with a devpts filesystem (present since Linux 2.2),
-the kernel normally sets the correct ownership and permissions
-for the pseudoterminal slave when the master is opened
-.RB ( posix_openpt (3)),
-so that nothing must be done by
-.BR grantpt ().
-Thus, no such helper binary is required
-(and indeed it is configured to be absent during the
-glibc build that is typical on many systems).
.SH STANDARDS
POSIX.1-2008.
.SH HISTORY
@@ -103,6 +91,16 @@ POSIX.1-2001.
.PP
This is part of the UNIX 98 pseudoterminal support, see
.BR pts (4).
+.PP
+Historical systems implemented this function via a set-user-ID helper binary
+called "pt_chown".
+glibc on Linux before glibc 2.33 could do so as well,
+in order to support configurations with only BSD pseudoterminals;
+this support has been removed.
+On modern systems this is either a no-op
+\[em]with permissions configured on pty allocation, as is the case on Linux\[em]
+or an
+.BR ioctl (2).
.SH SEE ALSO
.BR open (2),
.BR posix_openpt (3),