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

NAME


proc_get_cred - get process credentials

SYNOPSIS


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

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

DESCRIPTION


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(4).

RETURN VALUES


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

INTERFACE STABILITY


Uncommitted

MT-LEVEL
MT-Safe

SEE ALSO


libproc(3LIB), proc(4)

illumos May 11, 2016 illumos