[Previous] [Contents] [Next]

getlogin_r()

Get the user name associated with the calling process

Synopsis:

#include <unistd.h>

int getlogin_r( char* name, 
                size_t namesize );

Library:

libc

Description:

If _POSIX_THREAD_SAFE_FUNCTIONS is defined, the getlogin_r() function puts the login name of the user associated with the calling process in the character array pointed to by name. 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 _POSIX_LOGIN_NAME_MAX.

If 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.

Returns:

EOK
Success.
ERANGE
Insufficient storage was supplied via the name and namesize to contain the user's name.

Classification:

POSIX 1003.1

Safety:
Cancellation point Yes
Interrupt handler No
Signal handler No
Thread Yes

See also:

getlogin(), getpwnam(), getpwnam_r(), getpwuid(), getpwuid_r()


[Previous] [Contents] [Next]