(libc.info.gz) Lookup User
Info Catalog
(libc.info.gz) User Data Structure
(libc.info.gz) User Database
(libc.info.gz) Scanning All Users
30.13.2 Looking Up One User
---------------------------
You can search the system user database for information about a specific
user using 'getpwuid' or 'getpwnam'. These functions are declared in
'pwd.h'.
-- Function: struct passwd * getpwuid (uid_t UID)
Preliminary: | MT-Unsafe race:pwuid locale | AS-Unsafe dlopen
plugin heap lock | AC-Unsafe corrupt lock fd mem | POSIX
Safety Concepts.
This function returns a pointer to a statically-allocated structure
containing information about the user whose user ID is UID. This
structure may be overwritten on subsequent calls to 'getpwuid'.
A null pointer value indicates there is no user in the data base
with user ID UID.
-- Function: int getpwuid_r (uid_t UID, struct passwd *RESULT_BUF, char
*BUFFER, size_t BUFLEN, struct passwd **RESULT)
Preliminary: | MT-Safe locale | AS-Unsafe dlopen plugin heap lock |
AC-Unsafe corrupt lock fd mem | POSIX Safety Concepts.
This function is similar to 'getpwuid' in that it returns
information about the user whose user ID is UID. However, it fills
the user supplied structure pointed to by RESULT_BUF with the
information instead of using a static buffer. The first BUFLEN
bytes of the additional buffer pointed to by BUFFER are used to
contain additional information, normally strings which are pointed
to by the elements of the result structure.
If a user with ID UID is found, the pointer returned in RESULT
points to the record which contains the wanted data (i.e., RESULT
contains the value RESULT_BUF). If no user is found or if an error
occurred, the pointer returned in RESULT is a null pointer. The
function returns zero or an error code. If the buffer BUFFER is
too small to contain all the needed information, the error code
'ERANGE' is returned and ERRNO is set to 'ERANGE'.
-- Function: struct passwd * getpwnam (const char *NAME)
Preliminary: | MT-Unsafe race:pwnam locale | AS-Unsafe dlopen
plugin heap lock | AC-Unsafe corrupt lock fd mem | POSIX
Safety Concepts.
This function returns a pointer to a statically-allocated structure
containing information about the user whose user name is NAME.
This structure may be overwritten on subsequent calls to
'getpwnam'.
A null pointer return indicates there is no user named NAME.
-- Function: int getpwnam_r (const char *NAME, struct passwd
*RESULT_BUF, char *BUFFER, size_t BUFLEN, struct passwd
**RESULT)
Preliminary: | MT-Safe locale | AS-Unsafe dlopen plugin heap lock |
AC-Unsafe corrupt lock fd mem | POSIX Safety Concepts.
This function is similar to 'getpwnam' in that is returns
information about the user whose user name is NAME. However, like
'getpwuid_r', it fills the user supplied buffers in RESULT_BUF and
BUFFER with the information instead of using a static buffer.
The return values are the same as for 'getpwuid_r'.
Info Catalog
(libc.info.gz) User Data Structure
(libc.info.gz) User Database
(libc.info.gz) Scanning All Users
automatically generated by
info2html