Open System Services System Calls Reference Manual (G06.28+, H06.05+)

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 ledes,
char *name,
size_t namesize
);
PARAMETERS
filedes Species an open le descriptor.
name Points to the buffer to receive the pathname.
namesize Species 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 le descriptor ledes 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. For the possible values returned, see the
ERRORS subsection of this reference page.
ERRORS
If any of these conditions occur, the ttyname_r() function sets errno to the corresponding value:
[EBADF] The ledes parameter is not a valid le descriptor.
[EISGUARDIAN]
The value used for the ledes 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 le associated with ledes 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-007 Hewlett-Packard Company 873