ttyname_r()

get path name of terminal (reentrant) 

Function


SYNOPSIS

#include <unistd.h>

char *ttyname_r(int fildes, char *name, size_t namesize);


DESCRIPTION

The ttyname_r() function stores the null-terminated path name of the terminal associated with the file descriptor fildes in the buffer name. The buffer should have space for the name and the terminating null character. The maximum length of the terminal name is TTY_NAME_MAX.


PARAMETERS

fildes 

Is the file descriptor that associates with the string containing the null-terminated path name of the terminal.

name 

Is the buffer to receive the path name.

namesize 

Is the length of name.


RETURN VALUES

On success, ttyname_r() returns 0. On error one of the following values is returned:

EBADF 

fildes is not a valid file descriptor.

ENOTTY 

fildes does not refer to a terminate device.

ERANGE 

The value of namesize is smaller than the length of the string to be returned, including the terminating null character.


CONFORMANCE

POSIX.1 (1996).


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

ttyname_r() sets name to /dev/tty/nnn, where nnn is the process group ID.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
ctermid(), isatty(), ttyname()


PTC MKS Toolkit 10.5 Documentation Build 40.