ptsname(3) Library Functions Manual ptsname(3) ptsname, ptsname_r - - C (libc, -lc) #include char *ptsname(int fd); int ptsname_r(size_t size; int fd, char buf[size], size_t size); glibc (. feature_test_macros(7)): ptsname(): glibc 2.24: _XOPEN_SOURCE >= 500 glibc 2.23 : _XOPEN_SOURCE ptsname_r(): _GNU_SOURCE The ptsname() function returns the name of the slave pseudoterminal device corresponding to the master referred to by the file descriptor fd. The ptsname_r() function is the reentrant equivalent of ptsname(). It returns the name of the slave pseudoterminal device as a null-terminated string in the buffer pointed to by buf. The size argument specifies the number of bytes available in buf. ptsname() , . . NULL. On success, ptsname_r() returns 0. On failure, an error number is returned to indicate the error. EINVAL ( ptsname_r()) buf NULL ( glibc 2.25 ). ENOTTY fd -. ERANGE ( ptsname_r()) buf . attributes(7). +----------------------------+----------------------------------------------------------+--------------------------+ | | | | +----------------------------+----------------------------------------------------------+--------------------------+ |ptsname() | | MT-Unsafe race:ptsname | +----------------------------+----------------------------------------------------------+--------------------------+ |ptsname_r() | | MT-Safe | +----------------------------+----------------------------------------------------------+--------------------------+ A version of ptsname_r() is documented on Tru64, HP-UX, and FreeBSD, but on those implementations, -1 is returned on error, with errno set to indicate the error. Avoid using this function in portable programs. ptsname(): POSIX.1-2008. ptsname_r(): POSIX.1-2024. ptsname(): POSIX.1-2001. glibc 2.1. ptsname() - UNIX 98 ( pts(4)). ptsname_r(): GNU. grantpt(3), posix_openpt(3), ttyname(3), unlockpt(3), pts(4), pty(7) () Alexey, Azamat Hackimov , kogamatranslator49 , Darima Kogan , Max Is , Yuri Kozlov ; GNU (GNU General Public License - GPL, 3 ) , - . - , , () () () <>. Linux 6.17 29 2025 . ptsname(3)