getpw(3) Library Functions Manual getpw(3) getpw - (libc -lc) #define _GNU_SOURCE /* feature_test_macros(7) */ #include #include [[]] int getpw(uid_t uid, char *buf); getpw() uid buf. name:passwd:uid:gid:gecos:dir:shell passwd : struct passwd { char *pw_name; /* */ char *pw_passwd; /* */ uid_t pw_uid; /* */ gid_t pw_gid; /* */ char *pw_gecos; /* */ char *pw_dir; /* */ char *pw_shell; /* */ }; passwd(5). getpw() 0 -1 errno . uid getpw() -1 errno 0 buf . 0 ENOENT uid. EINVAL buf NULL. ENOMEM passwd. /etc/passwd attributes(7). +----------------------+------------------------------------+---------------------------------------------------------------------------------------------+ | | | | +----------------------+------------------------------------+---------------------------------------------------------------------------------------------+ |getpw() | | (locale) (MT-Safe) | +----------------------+------------------------------------+---------------------------------------------------------------------------------------------+ . SVr2. getpw() buf . getpwuid(3). endpwent(3), fgetpwent(3), getpwent(3), getpwnam(3), getpwuid(3), putpwent(3), setpwent(3), passwd(5) 3 . . : . 6.18 8 2026 getpw(3)