The getpwnam function searches the user database for an entry with the specified name. The function returns the first user entry in the database with the pw_name member of the passwd structure that matches the name 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 getpwnam function is stored in a per-thread static area and is overwritten on subsequent calls to the function. The getpwnam_r function is the reentrant version of getpwnam. The getpwnam_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 that matches the specified name. Storage referenced by the structure is allocated from the memory provided with the buffer argument, which is bufsize characters in length. 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 getpwnam. If getpwnam returns a NULL pointer and errno is nonzero, an error occurred.