ptsname(3) [netbsd man page]
PTSNAME(3) BSD Library Functions Manual PTSNAME(3) NAME
ptsname -- get the pathname of the slave pseudo-terminal device LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <stdlib.h> char * ptsname(int masterfd); DESCRIPTION
The ptsname() function returns the pathname of the slave pseudo-terminal device that corresponds to the master pseudo-terminal device associ- ated with masterfd. The ptsname() function is not reentrant or thread-safe. RETURN VALUES
If successful, ptsname() returns a pointer to a nul-terminated string containing the pathname of the slave pseudo-terminal device. If an error occurs ptsname() will return NULL and errno is set to indicate the error. ERRORS
The ptsname() function will fail if: [EACCESS] the corresponding pseudo-terminal device could not be accessed. [EBADF] masterfd is not a valid descriptor. [EINVAL] masterfd is not associated with a master pseudo-terminal device. NOTES
The error returns of ptsname() are a NetBSD extension. The ptsname() function is equivalent to: struct ptmget pm; return ioctl(masterfd, TIOCPTSNAME, &pm) == -1 ? NULL : pm.ps; SEE ALSO
ioctl(2), grantpt(3), posix_openpt(3), unlockpt(3) STANDARDS
The ptsname() function conforms to IEEE Std 1003.1-2001 (``POSIX.1''). Its first release was in X/Open Portability Guide Issue 4, Version 2 (``XPG4.2''). BSD
May 25, 2004 BSD
Check Out this Related Man Page
ptsname(3C) Standard C Library Functions ptsname(3C) NAME
ptsname - get name of the slave pseudo-terminal device SYNOPSIS
#include <stdlib.h> char *ptsname(int fildes); DESCRIPTION
The ptsname() function returns the name of the slave pseudo-terminal device associated with a master pseudo-terminal device. fildes is a file descriptor returned from a successful open of the master device. ptsname() returns a pointer to a string containing the null-termi- nated path name of the slave device of the form /dev/pts/N, where N is a non-negative integer. RETURN VALUES
Upon successful completion, the function ptsname() returns a pointer to a string which is the name of the pseudo-terminal slave device. This value points to a static data area that is overwritten by each call to ptsname(). Upon failure, ptsname() returns NULL. This could occur if fildes is an invalid file descriptor or if the slave device name does not exist in the file system. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Safe | +-----------------------------+-----------------------------+ SEE ALSO
open(2), grantpt(3C), ttyname(3C), unlockpt(3C), attributes(5), standards(5) STREAMS Programming Guide SunOS 5.10 14 Aug 2002 ptsname(3C)