getlogin(), getlogin_r()

get login name 

Function


SYNOPSIS

#include <unistd.h>

char *getlogin(void);

int getlogin_r(char *name, size_t namesize);


DESCRIPTION

The getlogin() function returns a pointer to a string giving the user name associated with the calling process. This function is not reentrant.

The getlogin_r() function gets the user name associated with the calling process. The name is placed in the specified buffer. The size for the buffer can be obtained by calling:

size = sysconf(_SC_LOGIN_NAME_MAX);

This function is reentrant.


PARAMETERS

name 

Points to the buffer where the user name is to be placed.

namesize 

Is the size of the buffer pointed to by name.


RETURN VALUES

If successful, getlogin() returns a pointer to the name of the user of the calling process, while getlogin_r() returns 0. On failure, getlogin() returns a null pointer, while getlogin_r() returns one of the following value:

ERANGE 

The namesize parameter is not large enough to contain the user name including the trailing null character.


CONFORMANCE

POSIX.1 (1996).


MULTITHREAD SAFETY LEVEL

getlogin(): Unsafe

getlogin_r(): MT-Safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
geteuid(), getpwnam(), getpwnam_r(), getpwuid(), getpwuid_r(), getuid()


PTC MKS Toolkit 10.4 Documentation Build 39.