Standards / Extensions | C or C++ | Dependencies |
---|---|---|
Single UNIX Specification, Version 2 |
both | OS/390 V2R8 |
#define _XOPEN_SOURCE 500
#include <unistd.h>
int getlogin_r(char *name, size_t namesize);
The getlogin_r() function puts the name associated by the login activity with the control terminal of the current 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 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.
If successful, getlogin_r() returns 0.