Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

ttyslot - find entry of current user in utmp file

&pagelevel(4)&pagelevel

Syntax

#include <stdlib.h>

int ttyslot (void); 

Description

ttyslot() returns the index of the current user’s entry in the/var/adm/utmp file.

The entry for the current user is an entry for which the utline structure element matches
the name of a terminal in/dev that is linked to the standard input, standard output or error
output (0, 1 or 2).

The returned index is an integer which represents the record number of the entry in the
/var/adm/utmp file. The index 0 is returned for the first record.

ttyslot() is not thread-safe.

Return val.

Index of the entry


if successful.

-1

if an error occurred during the search for the terminal name, or if none of the
file descriptors 0, 1 or 2 was assigned to a terminal.

Notes

ttyslot() will not be supported in the next version of the X/Open standard. 

See also

endutxent(), ttyname(), stdlib.h.