PCRED(3PROC) Process Control Library Functions PCRED(3PROC)

NAME


Pcred - obtain process credentials

LIBRARY


Process Control Library (libproc, -lproc)

SYNOPSIS


#include <libproc.h>

int
Pcred(struct ps_prochandle *P, prcred_t *pcrp, int ngroups);

DESCRIPTION


The Pcred() function obtains the credentials of the process from the handle
P.

The credentials are read into the buffer pointed to by pcrp. The prcred_t
type is defined in proc(5). It contains information about the current
effective, saved, and real user and group IDs. It also allows for
supplemental groups to be obtained. The Pcred() function will read a
number of supplemental groups based on the value of ngroups. The prcred_t
structure only contains the space for one supplemental group by default.
Callers should ensure that the buffer pointed to by pcrp contains enough
space to include all of the required supplemental groups that are desired.

Not all process handles have credential information available to them. For
example, the handles that come from Pgrab_file(3PROC) have no processes
associated with them and thus have no credentials associated with them.

RETURN VALUES


Upon successful completion, the Pcred() function returns 0 and updates the
memory at pcrp with the credentials. Otherwise, -1 is returned to indicate
an error.

INTERFACE STABILITY


Uncommitted

MT-LEVEL
See LOCKING in libproc(3LIB).

SEE ALSO


libproc(3LIB), Psetcred(3PROC), proc(5)

illumos May 11, 2016 illumos