1PTSNAME(3P) POSIX Programmer's Manual PTSNAME(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 ptsname — get name of the slave pseudo-terminal device
13
15 #include <stdlib.h>
16
17 char *ptsname(int fildes);
18
20 The ptsname() function shall return the name of the slave pseudo-termi‐
21 nal device associated with a master pseudo-terminal device. The fildes
22 argument is a file descriptor that refers to the master device. The
23 ptsname() function shall return a pointer to a string containing the
24 pathname of the corresponding slave device.
25
26 The ptsname() function need not be thread-safe.
27
29 Upon successful completion, ptsname() shall return a pointer to a
30 string which is the name of the pseudo-terminal slave device. Upon
31 failure, ptsname() shall return a null pointer and may set errno. This
32 could occur if fildes is an invalid file descriptor or if the slave
33 device name does not exist in the file system.
34
35 The application shall not modify the string returned. The returned
36 pointer might be invalidated or the string content might be overwritten
37 by a subsequent call to ptsname(). The returned pointer and the string
38 content might also be invalidated if the calling thread is terminated.
39
41 The ptsname() function may fail if:
42
43 EBADF The fildes argument is not a valid file descriptor.
44
45 ENOTTY The file associated with the fildes argument is not a master
46 pseudo-terminal device.
47
48 The following sections are informative.
49
51 None.
52
54 None.
55
57 See the RATIONALE section for posix_openpt().
58
60 None.
61
63 grantpt(), open(), posix_openpt(), ttyname(), unlockpt()
64
65 The Base Definitions volume of POSIX.1‐2017, <stdlib.h>
66
68 Portions of this text are reprinted and reproduced in electronic form
69 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
70 table Operating System Interface (POSIX), The Open Group Base Specifi‐
71 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
72 Electrical and Electronics Engineers, Inc and The Open Group. In the
73 event of any discrepancy between this version and the original IEEE and
74 The Open Group Standard, the original IEEE and The Open Group Standard
75 is the referee document. The original Standard can be obtained online
76 at http://www.opengroup.org/unix/online.html .
77
78 Any typographical or formatting errors that appear in this page are
79 most likely to have been introduced during the conversion of the source
80 files to man page format. To report such errors, see https://www.ker‐
81 nel.org/doc/man-pages/reporting_bugs.html .
82
83
84
85IEEE/The Open Group 2017 PTSNAME(3P)