HPlogo MPE/iX Developer's Kit Reference Manual Volume I: HP 3000 MPE/iX Computer Systems > Chapter 4  POSIX/iX Library Function Descriptions

getpwuid

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

User database access based on UID.

Syntax

   #include <sys/types.h>

   #include <pwd.h> 

   struct passwd *getpwuid(uid_t uid);

Parameters

uid

A value of a user ID.

Return Values

Returns a pointer to an object of type struct passwd on success. The return values may point to static data that is overwritten by each cell.

A null pointer is returned on error or if the requested entry is not found.

Description

The getpwuid() function returns a pointer to an object of type struct passwd containing an entry from the group database with a matching uid or name. This structure, which is defined in <pwd.h>, includes the members shown in the following:

pw_name

User name

pw_uid

User ID number

pw_gid

Group ID number

pw_dir

Initial working directory

pw_shell

Initial User Program

Implementation Considerations

None.

Errors

If an error occurs, errno is set to one of the following values:

EFAULTCAUSE The system detected a NULL or bad address when attempting to allocate or access a struct passwd buffer.
 ACTION Report circumstances to HP
EINVALCAUSE the UID parameter is invalid. No matching entry was found in the passwd buffer.
 ACTION Specify a valid UID.
ESYSERRCAUSE The system detected an unexpected error.
 ACTION Report circumstances to HP.

See Also

getlogin(), getpwnam() POSIX.1

Feedback to webmaster