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 Programmer's Manual"
9 ptsname, ptsname_r \- get the name of the slave pseudoterminal
12 .B #include <stdlib.h>
14 .BI "char *ptsname(int " fd ");"
15 .BI "int ptsname_r(int " fd ", char *" buf ", size_t " buflen ");"
19 Feature Test Macro Requirements for glibc (see
20 .BR feature_test_macros (7)):
27 .\" || (_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED)
28 Glibc 2.23 and earlier:
39 function returns the name of the slave pseudoterminal device
40 corresponding to the master referred to by the file descriptor
45 function is the reentrant equivalent of
47 It returns the name of the slave pseudoterminal device as a
48 null-terminated string in the buffer pointed to by
52 argument specifies the number of bytes available in
57 returns a pointer to a string in static storage which will be
58 overwritten by subsequent calls.
59 This pointer must not be freed.
60 On failure, NULL is returned.
65 On failure, an error number is returned to indicate the error.
66 .\" In glibc, the error number is not only returned as the return value
67 .\" but also stored in errno. But this is not true for musl libc.
75 (This error is returned only for
76 .\" glibc commit 8f0a947cf55f3b0c4ebdf06953c57eff67a22fa9
77 glibc 2.25 and earlier.)
81 does not refer to a pseudoterminal master device.
90 is provided in glibc since version 2.1.
92 For an explanation of the terms used in this section, see
100 Interface Attribute Value
103 T} Thread safety MT-Unsafe race:ptsname
106 T} Thread safety MT-Safe
113 POSIX.1-2001, POSIX.1-2008.
116 is part of the UNIX 98 pseudoterminal support (see
120 is a Linux extension, that is proposed for inclusion
121 .\" FIXME . for later review when Issue 8 is one day released
122 .\" http://austingroupbugs.net/tag_view_page.php?tag_id=8
123 .\" http://austingroupbugs.net/view.php?id=508
124 in the next major revision of POSIX.1 (Issue 8).
125 A version of this function is documented on Tru64 and HP-UX, but
126 on those implementations, \-1 is returned on error, with
128 set to indicate the error.
129 Avoid using this function in portable programs.
132 .BR posix_openpt (3),