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

proc_get_credget process credentials

Process Control Library (libproc, -lproc)

#include <libproc.h>

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

The () 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 structure may be found in proc(5).

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

libproc(3LIB), proc(5)

November 27, 2023 OmniOS