1 PCRED(3PROC)           Process Control Library Functions          PCRED(3PROC)
   2 
   3 NAME
   4      Pcred - obtain process credentials
   5 
   6 LIBRARY
   7      Process Control Library (libproc, -lproc)
   8 
   9 SYNOPSIS
  10      #include <libproc.h>
  11 
  12      int
  13      Pcred(struct ps_prochandle *P, prcred_t *pcrp, int ngroups);
  14 
  15 DESCRIPTION
  16      The Pcred() function obtains the credentials of the process from the
  17      handle P.
  18 
  19      The credentials are read into the buffer pointed to by pcrp.  The
  20      prcred_t type is defined in proc(4).  It contains information about the
  21      current effective, saved, and real user and group IDs.  It also allows
  22      for supplemental groups to be obtained.  The Pcred() function will read a
  23      number of supplemental groups based on the value of ngroups.  The
  24      prcred_t structure only contains the space for one supplemental group by
  25      default.  Callers should ensure that the buffer pointed to by pcrp
  26      contains enough space to include all of the required supplemental groups
  27      that are desired.
  28 
  29      Not all process handles have credential information available to them.
  30      For example, the handles that come from Pgrab_file(3PROC) have no
  31      processes associated with them and thus have no credentials associated
  32      with them.
  33 
  34 RETURN VALUES
  35      Upon successful completion, the Pcred() function returns 0 and updates
  36      the memory at pcrp with the credentials.  Otherwise, -1 is returned to
  37      indicate an error.
  38 
  39 INTERFACE STABILITY
  40      Uncommitted
  41 
  42 MT-LEVEL
  43      See LOCKING in libproc(3LIB).
  44 
  45 SEE ALSO
  46      libproc(3LIB), Psetcred(3PROC), proc(4)
  47 
  48 illumos                          May 11, 2016                          illumos