Reads the current process credentials.
Security Library (libc.a)
#include <usersec.h>
char **getpcred ( Which)
int Which;
The getpcred subroutine reads the specified process security credentials and returns a pointer to a NULL terminated array of pointers in allocated memory. Each pointer in the array points to a string containing an attribute/value pair in allocated memory. It's the responsibility of the caller to free each individual string as well as the array of pointers.
Item | Description |
---|---|
Which | Specifies which credentials are read. This parameter is a
bit mask and can contain one or more of the following values, as defined
in the usersec.h file:
|
When successful, the getpcred subroutine returns a pointer to a NULL terminated array of string pointers containing the requested values. If the getpcred subroutine is unsuccessful, a NULL pointer is returned and the errno global variable is set to indicate the error.
The getpcred subroutine fails if either of the following are true:
Item | Description |
---|---|
EINVAL | The Which parameter contains invalid credentials requests. |
EPERM | The process does not have the proper authority to retrieve the requested credentials. |
Other errors can also be set by any subroutines invoked by the getpcred subroutine.