ptsname(3C)
NAME
ptsname − get the name of a slave pty
SYNOPSIS
char *ptsname(int fildes);
Remarks:
ptsname() is useful only on systems that follow the insf(1M) naming conventions for ptys.
DESCRIPTION
The passed parameter, fildes, is a file descriptor of an opened master pty. ptsname() generates the name of the slave pty corresponding to this master pty. This means that their minor numbers will be the same.
RETURN VALUE
Upon successful completion, ptsname() returns a string containing the the full path name of a slave pty. Otherwise, a NULL pointer is returned. The return value may point to static data which is overwritten with each call to ptsname(), so it should be copied if it is to be saved.
ERRORS
ptsname() fails and returns a NULL pointer under the following conditions:
• File descriptor does not refer to an open master pty.
• Request falls outside pty name-space.
• Pty device naming conventions have not been followed.
• ptsname() failed to find a match.
EXAMPLES
The following example gets the path of a slave pty corresponding to a master pty obtained through a pty clone open.
int fd_master;
char *path;
...
fd_master = open("/dev/ptym/clone", O_RDONLY);
path = ptsname(fd_master);
AUTHOR
ptsname() was developed by HP.
SEE ALSO
Hewlett-Packard Company — HP-UX Release 9.0: August 1992