getpwent(3) Library Functions Manual getpwent(3) getpwent, setpwent, endpwent - LIBRARY Standard C library (libc, -lc) #include #include struct passwd *getpwent(void); void setpwent(void); void endpwent(void); glibc (. feature_test_macros(7)): getpwent(), setpwent(), endpwent(): _XOPEN_SOURCE >= 500 || /* glibc >= 2.19: */ _DEFAULT_SOURCE || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE getpwent() , (, /etc/passwd, NIS LDAP). getpwent() ; . setpwent() . endpwent() . 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). The getpwent() function returns a pointer to a passwd structure, or NULL if there are no more entries or an error occurred. If an error occurs, errno is set to indicate the error. If one wants to check errno after the call, it should be set to zero before the call. getpwent(), getpwnam(3) getpwuid(3) ( free(3)). EINTR ; . signal(7). EIO -. EMFILE . ENFILE . ENOMEM passwd. ERANGE . /etc/passwd , attributes(7). +----------------------------+----------------------------------------------------------+--------------------------+ | | | | +----------------------------+----------------------------------------------------------+--------------------------+ |getpwent() | | MT-Unsafe race:pwent | | | | race:pwentbuf locale | +----------------------------+----------------------------------------------------------+--------------------------+ |setpwent(), endpwent() | | MT-Unsafe race:pwent | | | | locale | +----------------------------+----------------------------------------------------------+--------------------------+ pwent race:pwgent , setpwent(), getpwent() endpwent(), . The pw_gecos field is not specified in POSIX, but is present on most implementations. POSIX.1-2008. POSIX.1-2001, SVr4, 4.3BSD. . fgetpwent(3), getpw(3), getpwent_r(3), getpwnam(3), getpwuid(3), putpwent(3), passwd(5) Azamat Hackimov , Dmitry Bolkhovskikh , Vladislav , Yuri Kozlov ; GNU 3 , . . , , . Linux man-pages 6.06 31 2023 . getpwent(3)