getlogin_r

Returns the name of the logged in user associated with the current thread.

Library:LibC
Classification:Other
Service:General C Services

Syntax

  #include <unistd.h> 
   
  int  getlogin_r (
     char    *name,
     size_t   namesize );
  

Parameters

name

(OUT) Points to the name of the logged in user.

namesize

(IN) Specifies the size of the name buffer.

Return Values

If successful, returns the a non-null pointer to the user name or a null pointer it the user's name cannot be found. Otherwise, retuns -1 and sets errno to indicate the error.

Decimal

Constant

Description

10

ENFILE

The maximum number of allowale files are currently open in the system.

14

ERANGE

The value of namesize is too small for the returned name string plus a null terminating character.

105

ENOCONTEXT

The calling thread has no library context.

Remarks

The getlogin_r function returns the name associated with the create_identity function. It is thread safe and can be safely used in a multi-processor environment.

See Also