Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
ttyname(3) OSS Library Calls Reference Manual
NAME
ttyname - Gets the name of a terminal
LIBRARY
G-series native OSS processes: /G/system/sysnn/zossfsrl
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zossfdll |
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/yossfdll |
SYNOPSIS
#include <unistd.h>
char *ttyname(
int filedes);
PARAMETERS
filedes Specifies an open file descriptor.
DESCRIPTION
The ttyname( ) function gets the name of a terminal. It returns a pointer to a string containing
the null-terminated pathname of the terminal device associated with the filedes parameter. If the
file descriptor is invalid, the errno variable is set to the value of [EBADF].
RETURN VALUES
The ttyname( ) function returns a pointer to a string, which is static data that is overwritten by
each call. A null pointer is returned if either of the following is true:
• The filedes parameter does not describe a terminal device.
• The filedes parameter points to a file on a remote HP NonStop server node but communi-
cation with the node has been lost.
ERRORS
If any of the following conditions occurs, the ttyname( ) function sets errno to the corresponding
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.
RELATED INFORMATION
Miscellaneous: filename(5).
STANDARDS CONFORMANCE
The POSIX standards leave some features to the implementing vendor to define. The following
features are affected in the HP implementation:
• The ttyname( ) function returns errno values for various conditions.
7−68 Hewlett-Packard Company 527187-017