2 .\" %%%LICENSE_START(PUBLIC_DOMAIN)
3 .\" This page is in the public domain. - aeb
6 .\" 2004-12-17, mtk, added description of ptsname_r() + ERRORS
8 .TH ptsname 3 (date) "Linux man-pages (unreleased)"
10 ptsname, ptsname_r \- get the name of the slave pseudoterminal
13 .RI ( libc ", " \-lc )
16 .B #include <stdlib.h>
18 .BI "char *ptsname(int " fd );
19 .BI "int ptsname_r(int " fd ", char " buf [. buflen "], size_t " buflen );
23 Feature Test Macro Requirements for glibc (see
24 .BR feature_test_macros (7)):
31 .\" || (_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED)
32 glibc 2.23 and earlier:
43 function returns the name of the slave pseudoterminal device
44 corresponding to the master referred to by the file descriptor
49 function is the reentrant equivalent of
51 It returns the name of the slave pseudoterminal device as a
52 null-terminated string in the buffer pointed to by
56 argument specifies the number of bytes available in
61 returns a pointer to a string in static storage which will be
62 overwritten by subsequent calls.
63 This pointer must not be freed.
64 On failure, NULL is returned.
69 On failure, an error number is returned to indicate the error.
70 .\" In glibc, the error number is not only returned as the return value
71 .\" but also stored in errno. But this is not true for musl libc.
79 (This error is returned only for
80 .\" glibc commit 8f0a947cf55f3b0c4ebdf06953c57eff67a22fa9
81 glibc 2.25 and earlier.)
85 does not refer to a pseudoterminal master device.
93 For an explanation of the terms used in this section, see
99 Interface Attribute Value
104 T} Thread safety MT-Unsafe race:ptsname
109 T} Thread safety MT-Safe
115 is documented on Tru64 and HP-UX,
116 but on those implementations,
117 \-1 is returned on error, with
119 set to indicate the error.
120 Avoid using this function in portable programs.
127 is a Linux extension, that is proposed for inclusion
128 .\" FIXME . for later review when Issue 8 is one day released
129 .\" http://austingroupbugs.net/tag_view_page.php?tag_id=8
130 .\" http://austingroupbugs.net/view.php?id=508
131 in the next major revision of POSIX.1 (Issue 8).
139 is part of the UNIX 98 pseudoterminal support (see
143 .BR posix_openpt (3),