Your Browser is not longer supported
Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...
{{viewport.spaceProperty.prod}}
getlogin_r - get login name (thread-safe)
&pagelevel(4)&pagelevel
Syntax | #include <unistd.h> int getlogin_r(char * name, size_t namesize); |
Description
The getlogin()
function writes the user name of the calling process (which corresponds
| to the login name of the calling process) in the data area pointed to by name. The data area is namesize characters long and should be large enough for the name and the terminating null character. The maximum size of the login name is {LOGIN_NAME_MAX} . If getlogin() is successful, then name points to the name that the user logged in under, even if there are several login names with the same user ID. |
Return val. | 0 Error number | if successful. otherwise. |
Errors | The getlogin_r() function fails if: |
ERANGE | The value of namesize is smaller than the length of the login name found including the terminating null character. |
See also | getlogin() , getpwnam_r() , getpwuid_r() . |