GETLOGIN(3,L) AIX Technical Reference GETLOGIN(3,L) ------------------------------------------------------------------------------- getlogin PURPOSE Gets the user's login name. LIBRARY Standard C Library (libc.a) SYNTAX char *getlogin ( ) DESCRIPTION The getlogin subroutine returns a pointer to the login name as found in the process's user info area as returned by getuinfo. Use the getlogin subroutine in conjunction with the getpwnam subroutine to locate the correct password file entry when the same user ID is shared by several login names. If the getlogin subroutine is called within a process that is not attached to a terminal, it returns a NULL pointer. The correct procedure for determining the login name is to call cuserid, or to call getlogin and if it fails, then to call getpwuid. If the login name is not found, getlogin returns a NULL pointer. Warning: The getlogin subroutine returns a pointer to a static area that is overwritten by successive calls. ERROR CONDITIONS The getlogin subroutine fails if one or more of the following are true: EMFILE Too many file descriptors are in use by this process. ENFILE The system file table is full. ENXIO The calling process has no controlling terminal. RELATED INFORMATION In this book: "cuserid," "getgrent, getgrgid, getgrnam, setgrent, endgrent," "getpwent, getpwuid, getpwnam, setpwent, endpwent," and "getuinfo." Processed November 7, 1990 GETLOGIN(3,L) 1