Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

OSS Library Calls (a - d) ctermid(3)
NAME
ctermid - Generates the pathname for the controlling 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 <stdio.h>
char *ctermid(
char *s);
PARAMETERS
s Indicates where to store the returned pathname. If the s parameter is a null
pointer, the pathname is stored in an internal static area and the address is
returned. The next call to the ctermid() function overwrites the contents of the
internal static area.
If the s parameter is not a null pointer, it points to a character array of at least
L_ctermid bytes. The symbolic constant L_ctermid is defined in the stdio.h
header file and has a value greater than 0 (zero). The pathname is placed in this
array and the value of the s parameter is returned.
DESCRIPTION
The ctermid() function generates the pathname to the controlling terminal for the current pro-
cess and stores it in a string.
The ctermid() function differs from the ttyname( ) function in that the ttyname( ) function is
supplied a file descriptor and returns the actual name of the terminal associated with that file
descriptor, while the ctermid( ) function returns a string (/dev/tty) that refers to the controlling
terminal if used as a pathname. ctermid( ) returns a pathname, which can be used in the open( )
function to access the controlling terminal (if a controlling terminal exists). The existence of a
controlling terminal is checked in open( ). The ttyname( ) function returns the pathname of a ter-
minal type file descriptor.
RETURN VALUES
The ctermid() function returns the address of the generated pathname. Otherwise, a null string
is returned. Access to a pathname returned by the ctermid( ) function is not guaranteed.
For Guardian TNS or accelerated processes, a null pathname is returned and errno is set to
[ENOTOSS].
ERRORS
If any of the following conditions occur, the ctermid( ) function sets errno to the corresponding
value:
[ENOMEM] A null pointer was passed and static memory was not available to complete the
request.
[ENOTOSS] The program has called a function that can be called only from an OSS process
or from a Guardian native process.
527187-017 Hewlett-Packard Company 1165