getpwnam

Returns information about the specified user name.

Library:LibC
Classification:POSIX
Service:File and Directory I/O

Syntax

  #include <pwd.h> 
   
  struct passwd *getpwnam (
     const char   *name );
  

Parameters

name

(IN) Points to a user name, obtained from such functions as getstat and fgetstat.

Return Values

If successful, returns a pointer to a passwd structure. Otherwise, returns a NULL pointer if the ID cannot be found or an error occurs. If an error occurs, errno is also set.

Decimal

Constant

Description

105

ENOCONTEXT

The calling thread has no context.

Remarks

The pointer returned by the getpwnam points to data, which might be overwritten by another call to getpwnam. In a multi-threaded, multi-processor environment, use getpwnam_r.

See Also