SYNOPSIS
#include <sys/types.h>
#include <pwd.h>
struct passwd *getpwnam(const char *name);
int getpwnam_r(const char *name, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result);
struct passwd *getpwuid(uid_t uid);
int getpwuid_r(uid_t uid, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result);
DESCRIPTION
The
The
The
The
The correct size for the buffer
for
size = sysconf(_SC_GETPW_R_SIZE_MAX);
PARAMETERS
- name
-
Is the name of the user to look up in the user database.
getpwnam() andgetpwnam_r() fill in the passwd structure with data about the user. - uid
-
Is the user ID of the user to look up in the user database.
getpwuid() andgetpwuid_r() fill in the passwd structure with data about the user. - pwd
-
Points to a passwd structure to be filled in.
- buffer
-
Points to a buffer where the data needed for the passwd structure members is to be placed.
- bufsize
-
Is the size of the buffer being passed.
- result
-
Is a pointer that, on success, contains the address of pwd, or, on failure, contains NULL.
RETURN VALUES
If successful,
If successful,
If an error occurs or if the requested entry is not found,
- EFAULT
-
The name, pwd, buf, or result parameter is not a valid pointer.
- EINVAL
-
The name parameter is not a valid user name, or the uid parameter is not a valid user ID.
- ERANGE
-
Insufficient storage was supplied via buffer and bufsize to contain the data to be referenced by the resulting structure.
CONFORMANCE
POSIX.1 (1996).
MULTITHREAD SAFETY LEVEL
PORTING ISSUES
Unlike UNIX platforms, there are common circumstances where
For the case of accounts where no home directory has been defined, the
default behavior is for the pw_dir returned to be an
empty string. The behavior can be changed with
the _NC_SET_PWNAME_PROFILE parameter
to
AVAILABILITY
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
- Functions:
_NutConf() ,getgrgid() ,getgrgid_r() ,getgrnam() ,getgrnam_r() ,getlogin() ,getlogin_r() ,sysconf()
- Miscellaneous:
- struct passwd
PTC MKS Toolkit 10.4 Documentation Build 39.