Книга: Programming with POSIX® Threads
6.5.6 Group and user database
6.5.6 Group and user database
Group database:
int getgrgid_r (gid_t gid, struct group *grp, char *buffer,
size_t bufsize, struct group **result);
int getgrnam_r (
const char *name, struct group *grp,
char *buffer, size_t bufsize,
struct group **result);
User database:
int getpwuid_r (
uid_t uid, struct passwd *pwd, char *buffer,
size_t bufsize, struct passwd **result); int getpwnam_r (
const char *name, struct passwd *pwd,
char *buffer, size_t bufsize,
struct passwd **result);
These functions store a copy of the group or user record (grp or pwd, respectively) for the specified group or user (gid, uid, or name) in a buffer designated by
the arguments buffer and bufsize. The function return value is in each case either 0 for success, or an error number (such as ERANGE when the buffer is too small) to designate an error. If the requested record is not present in the group or passwd database, the functions may return success but store the value NULL into the result pointer. If the record is found and the buffer is large enough, result becomes a pointer to the struct group or struct passwd record within buffer.
The maximum required size for buffer can be determined by calling sysconf with the argument _SC_GETGR_R_SIZE_MAX (for group data) or with the argument _SC_GETPW_R_SIZE MAX(for user data).
- Creating Users
- Информация заголовочной страницы (Database header)
- Database dialect
- Разработка приложений баз данных InterBase на Borland Delphi
- DATABASE CACHE SIZE
- Open Source Insight and Discussion
- Introduction to Microprocessors and Microcontrollers
- Chapter 6. Traversing of tables and chains
- Chapter 8. Saving and restoring large rule-sets
- Chapter 11. Iptables targets and jumps
- Chapter 5 Installing and Configuring VirtualCenter 2.0
- Chapter 15. Graphical User Interfaces for Iptables