The getlogin function returns the login name of the user associated with the current session. If getlogin returns a non- null pointer, then that pointer points to the name that the user logged in under, even if there are several login names with the same user ID. The getlogin_r function is the reentrant version of getlogin. Upon successful completion, getlogin_r returns 0 and puts the name associated by the login activity with the controlling 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.