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 2017-09-15 "" "Linux Programmer's Manual"
9 ptsname, ptsname_r \- get the name of the slave pseudoterminal
11 .B #include <stdlib.h>
13 .BI "char *ptsname(int " fd ");"
15 .BI "int ptsname_r(int " fd ", char *" buf ", size_t " buflen ");"
18 Feature Test Macro Requirements for glibc (see
19 .BR feature_test_macros (7)):
27 _XOPEN_SOURCE\ >=\ 500 ||
28 (_XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED)
30 Glibc 2.23 and earlier:
40 function returns the name of the slave pseudoterminal device
41 corresponding to the master referred to by
46 function is the reentrant equivalent of
48 It returns the name of the slave pseudoterminal device as a
49 null-terminated string in the buffer pointed to by
53 argument specifies the number of bytes available in
58 returns a pointer to a string in static storage which will be
59 overwritten by subsequent calls.
60 This pointer must not be freed.
61 On failure, NULL is returned.
66 On failure, a nonzero value is returned
69 is set to indicate the error.
70 .\" In fact the errno value is also returned as the function
71 .\" result -- MTK, Dec 04
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.
94 is provided in glibc since version 2.1.
96 For an explanation of the terms used in this section, see
102 Interface Attribute Value
105 T} Thread safety MT-Unsafe race:ptsname
108 T} Thread safety MT-Safe
112 POSIX.1-2001, POSIX.1-2008.
115 is part of the UNIX 98 pseudoterminal support (see
119 is a Linux extension, that is proposed for inclusion
120 .\" FIXME . for later review when Issue 8 is one day released
121 .\" http://austingroupbugs.net/tag_view_page.php?tag_id=8
122 .\" http://austingroupbugs.net/view.php?id=508
123 in the next major revision of POSIX.1 (Issue 8).
124 A version of this function is documented on Tru64 and HP-UX, but
125 on those implementations, \-1 is returned on error, with
127 set to indicate the error.
128 Avoid using this function in portable programs.
131 .BR posix_openpt (3),