Open System Services System Calls Reference Manual (G06.28+)
getlogin_r(2) OSS System Calls Reference Manual
NAME
getlogin_r - Gets login name (reentrant)
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
#include <spthread.h>
int getlogin_r (
char *name,
size_t namesize
);
PARAMETERS
name Points to the buffer where the login name is stored.
namesize Specifies the size of the buffer passed in bytes.
DESCRIPTION
The getlogin_r() function is the reentrant version of the getlogin() function.
The getlogin_r() function puts the name associated by the login activity with the controlling ter-
minal of the current process in the character array pointed to by the name parameter. The array is
namesize characters long and should have space for the name and the terminating null character.
The maximum size of the login name is LOGIN_NAME_MAX.
If the call to getlogin_r() is successful, name points to the name the user used at login, even if
there are several login names with the same user ID.
The login name can be a username or a user alias.
The name is normally associated with a login shell at the time a session is created, and it is inher-
ited by all processes descended from the login shell. (This is true even if some of those processes
assume another user ID.)
RETURN VALUES
If the call completes successfully, the getlogin_r() function returns 0 (zero). Otherwise, an error
number is returned to indicate the error.
If any of the following conditions occurs, the getlogin_r( ) function returns the corresponding
value:
[ERANGE] The value of the namesize parameter is smaller than the length of the string to be
returned, including the terminating null character.
ERRORS
No error values are returned. The getlogin_r() function does not set the errno variable.
RELATED INFORMATION
Functions: geteuid(2), getlogin(2), getuid(2).
STANDARDS CONFORMANCE
This function is an extension to the UNIX98 specification. Interfaces documented on this refer-
ence page conform to the following industry standards:
• IEEE Std 1003.1c-1995, POSIX System Application Program Interface
The use of the header file spthread.h is an HP exception to the POSIX standard.
3−62 Hewlett-Packard Company 527186-005