1 .\" %%%LICENSE_START(PUBLIC_DOMAIN)
2 .\" This page is in the public domain. - aeb
5 .\" 2004-12-17, mtk, added description of ptsname_r() + ERRORS
7 .TH PTSNAME 3 2021-03-22 "Linux man-pages (unreleased)"
9 ptsname, ptsname_r \- get the name of the slave pseudoterminal
12 .RI ( libc ", " \-lc )
15 .B #include <stdlib.h>
17 .BI "char *ptsname(int " fd ");"
18 .BI "int ptsname_r(int " fd ", char *" buf ", size_t " buflen ");"
22 Feature Test Macro Requirements for glibc (see
23 .BR feature_test_macros (7)):
30 .\" || (_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED)
31 Glibc 2.23 and earlier:
42 function returns the name of the slave pseudoterminal device
43 corresponding to the master referred to by the file descriptor
48 function is the reentrant equivalent of
50 It returns the name of the slave pseudoterminal device as a
51 null-terminated string in the buffer pointed to by
55 argument specifies the number of bytes available in
60 returns a pointer to a string in static storage which will be
61 overwritten by subsequent calls.
62 This pointer must not be freed.
63 On failure, NULL is returned.
68 On failure, an error number is returned to indicate the error.
69 .\" In glibc, the error number is not only returned as the return value
70 .\" but also stored in errno. But this is not true for musl libc.
78 (This error is returned only for
79 .\" glibc commit 8f0a947cf55f3b0c4ebdf06953c57eff67a22fa9
80 glibc 2.25 and earlier.)
84 does not refer to a pseudoterminal master device.
93 is provided in glibc since version 2.1.
95 For an explanation of the terms used in this section, see
103 Interface Attribute Value
106 T} Thread safety MT-Unsafe race:ptsname
109 T} Thread safety MT-Safe
117 POSIX.1-2001, POSIX.1-2008.
120 is part of the UNIX 98 pseudoterminal support (see
124 is a Linux extension, that is proposed for inclusion
125 .\" FIXME . for later review when Issue 8 is one day released
126 .\" http://austingroupbugs.net/tag_view_page.php?tag_id=8
127 .\" http://austingroupbugs.net/view.php?id=508
128 in the next major revision of POSIX.1 (Issue 8).
129 A version of this function is documented on Tru64 and HP-UX, but
130 on those implementations, \-1 is returned on error, with
132 set to indicate the error.
133 Avoid using this function in portable programs.
136 .BR posix_openpt (3),