Open System Services System Calls Reference Manual (G06.28+)
System Functions (t) ttyname_r(2)
NAME
ttyname_r - Gets the name of a terminal (reentrant)
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
[#include <unistd.h>]
#include <spthread.h>
int ttyname_r (
int filedes,
char *name,
size_t namesize
);
PARAMETERS
filedes Specifies an open file descriptor.
name Points to the buffer to receive the pathname.
namesize Specifies the length of name passed in bytes.
DESCRIPTION
The ttyname_r( ) function is the reentrant version of the ttyname() function.
The ttyname_r( ) function stores the null-terminated pathname of the terminal associated with
the file descriptor filedes in the character array referenced by the name parameter. The array is
namesize characters long and should have space for the pathname and the terminating null char-
acter. The maximum length of the terminal name is TTY_NAME_MAX.
RETURN VALUES
Upon successful completion, the ttyname_r() function returns 0 (zero). Otherwise, an error
number is returned to indicate the error and errno is set. See the ERRORS subsection of this
reference page for the possible values returned.
ERRORS
If any of the following conditions occurs, the ttyname_r() function sets errno to the correspond-
ing value:
[EBADF] The filedes parameter is not a valid file descriptor.
[EISGUARDIAN]
The value used for the filedes parameter is appropriate only in the Guardian
environment.
[ENOCRE] The function was called from a process that is not using the Common Run-Time
Environment (CRE).
[ENOMEM] Static memory is not available to complete the function call.
[ENOTTY] The file associated with filedes is not a terminal.
[ERANGE] The value of namesize is smaller than the length of the string to be returned
including the terminating null character.
527186-005 Hewlett-Packard Company 8−73