Your Browser is not longer supported
Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...
{{viewport.spaceProperty.prod}}
getpwnam_r - get user name (thread-safe)
&pagelevel(4)&pagelevel
Syntax | #include <sys/types.h> #include <pwd.h> int getpwnam_r(const char *nam, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result); |
Description | The getpwnam_r() and getpwuid_r() functions update the passwd structure pointed to by pwd and store a pointer to this structure at the address pointed to by result. The structure contains the entry from the user catalog whose pw_name or pw_uid component matches nam or uid, respectively. The passwd structure found in the user catalog is copied to the memory area of length bufsize passed in the parameter buffer. The maximum size required for this buffer can be determined via the sysconf() parameter {_SC_GETPW_R_SIZE_MAX} . |
Return val. | 0 if successful. Otherwise errno is set to indicate the error. |
Errors | The getpwnam_r() and getpwuid_r() fail if: |
ERANGE
| The memory area pointed to by buffer of length bufsize is not large enough to hold the data pointed to by the resulting group structure. |
Notes | If an error occurs or if the requested entry is not found, a null pointer is returned in the address pointed to by result. |
See also | getpwnam(), getpwuid(), pwd(), types() .
|