struct passwd *getpwuid(uid_t uid); int getpwuid_r(uid_t uid, struct passwd *pwbuf, char *buf, size_t buflen, struct passwd **pwbufp); The getpwuid() function returns a pointer to a structure containing the broken-out fields of the record in the password database that matches the user ID uid.