getpwuid [ MPE/iX Developer's Kit Reference Manual Volume I ] MPE/iX 5.0 Documentation
MPE/iX Developer's Kit Reference Manual Volume I
getpwuid
User database access based on UID.
Syntax
#include <sys/types.h>
#include <pwd.h>
struct passwd *getpwuid(uid_t uid);
Parameters
uid A value of a user ID.
Return Values
Returns a pointer to an object of type struct passwd on success. The
return values may point to static data that is overwritten by each cell.
A null pointer is returned on error or if the requested entry is not
found.
Description
The getpwuid() function returns a pointer to an object of type struct
passwd containing an entry from the group database with a matching uid.
This structure, which is defined in <pwd.h>, includes the members shown
in the following:
pw_name User name
pw_uid User ID number
pw_gid Group ID number
pw_dir Initial working directory
pw_shell Initial User Program
Implementation Considerations
None.
Errors
If an error occurs, errno is set to one of the following values:
E2BIG CAUSE The number of bytes used by the new process image's
argument list and environment list combined is
greater than the limit of {ARG_MAX} (defined in
<limits.h>).
ACTION Reduce the size of the argument list or environment
list or both.
EACCES CAUSE One of the following:
* The calling process does not have search
permission to a component of the pathname.
* The calling process does not have execute
permission to the file.
ACTION One of the following:
* Make sure that the calling process has search
permission to all components of the pathname.
* Make sure that the calling process has execute
permission to the file.
EFAULT CAUSE The system detected a NULL or bad address in
attempting to use the pathname parameter, or the
pathname was not terminated by a null character.
ACTION Make sure that the pointer is correctly initialized.
Table 4-0. (cont.)
EIMPL CAUSE The pathname did not resolve to a valid MPE/iX file,
group, and account, or the pathname begins with two
slashes.
ACTION Specify a valid pathname as described in the pathname
parameter description.
ENAMETOOLONG CAUSE One of the following:
* The length of the pathname exceeds the
{PATH_MAX} limit (defined in the file
<limits.h>).
* A component of the pathname is longer than
{NAME_MAX} (defined in <limits.h>), and
{_POSIX_NO_TRUNC} is in effect for that
directory.
ACTION Make sure that both the component's length and the
full pathname length do not exceed the {NAME_MAX} or
{PATH_MAX} limits.
ENOENT CAUSE a component of the pathname for the executable file
does not exist, or pathname points to an empty
string.
ACTION Specify a valid pathname.
ENOEXEC CAUSE The program file does not have the NMPRG file code.
ACTION Make sure that the program file has the NMPRG file
code.
ENOMEM CAUSE The new process image requires more memory than the
system allows.
ACTION No action required. The new process image cannot be
created.
ENOTDIR CAUSE A component of the pathname is not a directory.
ACTION Specify a valid pathname.
Table 4-0. (cont.)
EPERM CAUSE One of the following:
* The calling process does not have the MPE/iX
process handling (PH) capability.
* The calling process has outstanding switches
to CM code, has set critical mode, has
outstanding NOWAITIO, or is holding an
operating system internal resource, or the
calling process is in a Procedure Exit
handler.
ACTION One of the following:
* Link the program file with the MPE/iX PH
capability.
* Do not execute execl() when the calling
process has outstanding switches to CM code,
has set critical mode, has outstanding
NOWAITIO, or is holding an operating system
internal resource, or in a Procedure Exit
handler.
ESYSERR CAUSE System error occurred when accessing a system
database.
ACTION None.
See Also
getlogin(), getpwnam(), POSIX.1
MPE/iX 5.0 Documentation