getlogin

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> 
   
  char *getlogin ( void ); 
  

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.

105

ENOCONTEXT

The calling thread has no library context.

Remarks

The getlogin function returns the name associated with the create_identity function. It is not thread safe. In a multi-processor environment, use the getlogin_r function.

See Also