The getpwuid function searches the user database for an entry
with the specified uid. The function returns the first user entry
in the database with a pw_uid member of the passwd structure that
matches the uid argument.
The passwd structure is defined in the <pwd.h> header file as
follows:
pw_name The user's login name.
pw_uid The numerical user ID.
pw_gid The numerical group ID.
pw_dir The home directory of the user.
pw_shell The initial program for the user.
NOTE
All information generated by the getpwuid function is stored
in a per-thread static area and is overwritten on subsequent
calls to the function.
The getpwuid_r function is the reentrant version of getpwuid.
The getpwuid_r function updates the passwd structure pointed to
by pwd and stores a pointer to that structure at the location
pointed to by result. The structure will contain an entry from
the user database with a matching uid. Storage referenced by the
structure is allocated from the memory provided with the buffer
argument, which is bufsize characters in size. The maximum size
needed for this buffer can be determined with the _SC_GETPW_R_
SIZE_MAX parameter of the sysconf function. On error or if the
requested entry is not found, a NULL pointer is returned at the
location pointed to by result.
Applications wishing to check for error situations should set
errno to 0 before calling getpwuid. If getpwuid returns a NULL
pointer and errno is nonzero, an error occurred.
See also getuid to know how UIC is represented.