1 /* 2 * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _PWD_H_ 6 #define _PWD_H_ 7 8 9 #include <sys/types.h> 10 11 #ifdef __cplusplus 12 extern "C" { 13 #endif 14 15 struct passwd { 16 char *pw_name; 17 char *pw_passwd; 18 uid_t pw_uid; 19 gid_t pw_gid; 20 char *pw_dir; 21 char *pw_shell; 22 char *pw_gecos; 23 }; 24 25 /* traverse the user password database */ 26 extern struct passwd *getpwent(void); 27 extern int getpwent_r(struct passwd* pwbuf, char* buf, size_t buflen, 28 struct passwd** pwbufp); 29 extern void setpwent(void); 30 extern void endpwent(void); 31 32 /* search the user password database */ 33 extern struct passwd *getpwnam(const char *name); 34 extern int getpwnam_r(const char *name, struct passwd *passwd, char *buffer, 35 size_t bufferSize, struct passwd **result); 36 extern struct passwd *getpwuid(uid_t uid); 37 extern int getpwuid_r(uid_t uid, struct passwd *passwd, char *buffer, 38 size_t bufferSize, struct passwd **result); 39 40 #ifdef __cplusplus 41 } 42 #endif 43 44 #endif /* _PWD_H_ */ 45