]>
Commit | Line | Data |
---|---|---|
2d6c6dd1 | 1 | .\" %%%LICENSE_START(PUBLIC_DOMAIN) |
fea681da | 2 | .\" This page is in the public domain. - aeb |
2d6c6dd1 | 3 | .\" %%%LICENSE_END |
fea681da | 4 | .\" |
72897648 MK |
5 | .\" 2004-12-17, mtk, added description of ptsname_r() + ERRORS |
6 | .\" | |
4b8c67d9 | 7 | .TH PTSNAME 3 2017-09-15 "" "Linux Programmer's Manual" |
fea681da | 8 | .SH NAME |
b218b023 | 9 | ptsname, ptsname_r \- get the name of the slave pseudoterminal |
fea681da | 10 | .SH SYNOPSIS |
fea681da | 11 | .B #include <stdlib.h> |
68e4db0a | 12 | .PP |
fea681da | 13 | .BI "char *ptsname(int " fd ");" |
72897648 | 14 | .br |
55fbb69b | 15 | .BI "int ptsname_r(int " fd ", char *" buf ", size_t " buflen ");" |
c2ba3716 FT |
16 | .PP |
17 | .in -4n | |
18 | Feature Test Macro Requirements for glibc (see | |
19 | .BR feature_test_macros (7)): | |
20 | .in | |
21 | .PP | |
22 | .ad l | |
23 | .BR ptsname (): | |
24 | .br | |
25 | .RS 4 | |
26 | Since glibc 2.24: | |
27 | _XOPEN_SOURCE\ >=\ 500 || | |
28 | (_XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED) | |
29 | .br | |
30 | Glibc 2.23 and earlier: | |
31 | _XOPEN_SOURCE | |
32 | .RE | |
33 | .PP | |
34 | .BR ptsname_r (): | |
35 | _GNU_SOURCE | |
36 | .ad | |
fea681da MK |
37 | .SH DESCRIPTION |
38 | The | |
39 | .BR ptsname () | |
b218b023 | 40 | function returns the name of the slave pseudoterminal device |
72897648 | 41 | corresponding to the master referred to by |
fea681da | 42 | .IR fd . |
847e0d88 | 43 | .PP |
72897648 MK |
44 | The |
45 | .BR ptsname_r () | |
46 | function is the reentrant equivalent of | |
47 | .BR ptsname (). | |
b218b023 | 48 | It returns the name of the slave pseudoterminal device as a |
72897648 MK |
49 | null-terminated string in the buffer pointed to by |
50 | .IR buf . | |
51 | The | |
52 | .I buflen | |
53 | argument specifies the number of bytes available in | |
54 | .IR buf . | |
47297adb | 55 | .SH RETURN VALUE |
72897648 | 56 | On success, |
fea681da | 57 | .BR ptsname () |
72897648 MK |
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. | |
b437fdd9 | 61 | On failure, NULL is returned. |
847e0d88 | 62 | .PP |
72897648 MK |
63 | On success, |
64 | .BR ptsname_r () | |
65 | returns 0. | |
c7094399 | 66 | On failure, a nonzero value is returned |
72897648 MK |
67 | and |
68 | .I errno | |
69 | is set to indicate the error. | |
70 | .\" In fact the errno value is also returned as the function | |
71 | .\" result -- MTK, Dec 04 | |
72 | .SH ERRORS | |
73 | .TP | |
74 | .B EINVAL | |
75 | .RB ( ptsname_r () | |
76 | only) | |
77 | .I buf | |
78 | is NULL. | |
7676eafe MK |
79 | (This error is returned only for |
80 | .\" glibc commit 8f0a947cf55f3b0c4ebdf06953c57eff67a22fa9 | |
81 | glibc 2.25 and earlier.) | |
72897648 MK |
82 | .TP |
83 | .B ENOTTY | |
84 | .I fd | |
b218b023 | 85 | does not refer to a pseudoterminal master device. |
72897648 MK |
86 | .TP |
87 | .B ERANGE | |
88 | .RB ( ptsname_r () | |
89 | only) | |
90 | .I buf | |
91 | is too small. | |
c343e74c MK |
92 | .SH VERSIONS |
93 | .BR ptsname () | |
94 | is provided in glibc since version 2.1. | |
1d94efa5 | 95 | .SH ATTRIBUTES |
447d472c PH |
96 | For an explanation of the terms used in this section, see |
97 | .BR attributes (7). | |
98 | .TS | |
99 | allbox; | |
100 | lb lb lb | |
101 | l l l. | |
102 | Interface Attribute Value | |
103 | T{ | |
1d94efa5 | 104 | .BR ptsname () |
f13ba82a | 105 | T} Thread safety MT-Unsafe race:ptsname |
447d472c | 106 | T{ |
1d94efa5 | 107 | .BR ptsname_r () |
447d472c PH |
108 | T} Thread safety MT-Safe |
109 | .TE | |
47297adb | 110 | .SH CONFORMING TO |
b0786370 MK |
111 | .BR ptsname (): |
112 | POSIX.1-2001, POSIX.1-2008. | |
847e0d88 | 113 | .PP |
72897648 | 114 | .BR ptsname () |
b218b023 | 115 | is part of the UNIX 98 pseudoterminal support (see |
72897648 | 116 | .BR pts (4)). |
847e0d88 | 117 | .PP |
704a18f0 | 118 | .BR ptsname_r () |
97d8fd29 MK |
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). | |
85eb6f28 | 124 | A version of this function is documented on Tru64 and HP-UX, but |
8729177b | 125 | on those implementations, \-1 is returned on error, with |
72897648 MK |
126 | .I errno |
127 | set to indicate the error. | |
128 | Avoid using this function in portable programs. | |
47297adb | 129 | .SH SEE ALSO |
fea681da | 130 | .BR grantpt (3), |
a856c2ea | 131 | .BR posix_openpt (3), |
fea681da | 132 | .BR ttyname (3), |
a856c2ea | 133 | .BR unlockpt (3), |
88ab292b MK |
134 | .BR pts (4), |
135 | .BR pty (7) |