Main index | Section 3 | 日本語 | Options |
#include <pwd.h>
#include <grp.h>
The group_from_gid() function returns the group name associated with the argument gid. The group name is cached so that multiple calls with the same gid do not require additional calls to getgrgid(3). If there is no group associated with the gid, a pointer is returned to a string representation of the gid, unless the argument nogroup is non-zero, in which case a NULL pointer is returned.
The uid_from_user() function returns the uid associated with the argument name. The uid is cached so that multiple calls with the same name do not require additional calls to getpwnam(3). If there is no uid associated with the name, the uid_from_user() function returns -1; otherwise it stores the uid at the location pointed to by uid and returns 0.
The gid_from_group() function returns the gid associated with the argument name. The gid is cached so that multiple calls with the same name do not require additional calls to getgrnam(3). If there is no gid associated with the name, the gid_from_group() function returns -1; otherwise it stores the gid at the location pointed to by gid and returns 0.
The pwcache_userdb() function changes the user database access routines which user_from_uid() and uid_from_user() call to search for users. The caches are flushed and the existing endpwent() method is called before switching to the new routines. getpwnam and getpwuid must be provided, and setpassent and endpwent may be NULL pointers.
The pwcache_groupdb() function changes the group database access routines which group_from_gid() and gid_from_group() call to search for groups. The caches are flushed and the existing endgrent() method is called before switching to the new routines. getgrnam and getgrgid must be provided, and setgroupent and endgrent may be NULL pointers.
The uid_from_user() and gid_from_group() functions first appeared in NetBSD
The pwcache_userdb() and pwcache_groupdb() functions first appeared in NetBSD and FreeBSD 10.0 .
PWCACHE (3) | May 5, 2020 |
Main index | Section 3 | 日本語 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
“ | The most horrifying thing about Unix is that, no matter how many times you hit yourself over the head with it, you never quite manage to lose consciousness. It just goes on and on. | ” |
— Patrick Sobalvarro |