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

get process credentials

Process Control Library (libproc, -lproc)
#include <libproc.h>

proc_get_cred(pid_t proc, prcred_t *credp, int ngroups);

The proc_get_cred() function is a convenient way to read the /proc cred file for the process proc.

Up to ngroups supplemental groups will be read and written into credp in addition to the normal information. If ngroups is more than one, than it is up to the caller to have allocated enough space for credp. Callers could allocate it, using an expression similar to:

credp = malloc(sizeof (prcred_t) + (ngroups - 1) * sizeof (gid_t));

The definition of the prcred_t structure may be found in proc(5).

Upon successful completion, the proc_get_cred() function returns 0. Otherwise, -1 is returned to indicate an error occurred.



libproc(3LIB), proc(5)
May 11, 2016 OmniOS