143051d27SRobert Mustacchi.\" 243051d27SRobert Mustacchi.\" This file and its contents are supplied under the terms of the 343051d27SRobert Mustacchi.\" Common Development and Distribution License ("CDDL"), version 1.0. 443051d27SRobert Mustacchi.\" You may only use this file in accordance with the terms of version 543051d27SRobert Mustacchi.\" 1.0 of the CDDL. 643051d27SRobert Mustacchi.\" 743051d27SRobert Mustacchi.\" A full copy of the text of the CDDL should have accompanied this 843051d27SRobert Mustacchi.\" source. A copy of the CDDL is also available via the Internet at 943051d27SRobert Mustacchi.\" http://www.illumos.org/license/CDDL. 1043051d27SRobert Mustacchi.\" 1143051d27SRobert Mustacchi.\" 1243051d27SRobert Mustacchi.\" Copyright 2015 Joyent, Inc. 1343051d27SRobert Mustacchi.\" 1443051d27SRobert Mustacchi.Dd May 11, 2016 1543051d27SRobert Mustacchi.Dt PCRED 3PROC 1643051d27SRobert Mustacchi.Os 1743051d27SRobert Mustacchi.Sh NAME 1843051d27SRobert Mustacchi.Nm Pcred 1943051d27SRobert Mustacchi.Nd obtain process credentials 20ab618543SJohn Levon.Sh LIBRARY 2143051d27SRobert Mustacchi.Lb libproc 22ab618543SJohn Levon.Sh SYNOPSIS 2343051d27SRobert Mustacchi.In libproc.h 2443051d27SRobert Mustacchi.Ft int 2543051d27SRobert Mustacchi.Fo Pcred 2643051d27SRobert Mustacchi.Fa "struct ps_prochandle *P" 2743051d27SRobert Mustacchi.Fa "prcred_t *pcrp" 2843051d27SRobert Mustacchi.Fa "int ngroups" 2943051d27SRobert Mustacchi.Fc 3043051d27SRobert Mustacchi.Sh DESCRIPTION 3143051d27SRobert MustacchiThe 3243051d27SRobert Mustacchi.Fn Pcred 3343051d27SRobert Mustacchifunction obtains the credentials of the process from the handle 3443051d27SRobert Mustacchi.Fa P . 3543051d27SRobert Mustacchi.Pp 3643051d27SRobert MustacchiThe credentials are read into the buffer pointed to by 3743051d27SRobert Mustacchi.Fa pcrp . 3843051d27SRobert MustacchiThe 3943051d27SRobert Mustacchi.Sy prcred_t 4043051d27SRobert Mustacchitype is defined in 41*bbf21555SRichard Lowe.Xr proc 5 . 4243051d27SRobert MustacchiIt contains information about the current effective, saved, and real 4372d3dbb9SYuri Pankovuser and group IDs. 4472d3dbb9SYuri PankovIt also allows for supplemental groups to be obtained. 4572d3dbb9SYuri PankovThe 4643051d27SRobert Mustacchi.Fn Pcred 4743051d27SRobert Mustacchifunction will read a number of supplemental groups based on the value of 4843051d27SRobert Mustacchi.Fa ngroups . 4943051d27SRobert MustacchiThe 5043051d27SRobert Mustacchi.Sy prcred_t 5143051d27SRobert Mustacchistructure only contains the space for one supplemental group by default. 5243051d27SRobert MustacchiCallers should ensure that the buffer pointed to by 5343051d27SRobert Mustacchi.Fa pcrp 5443051d27SRobert Mustacchicontains enough space to include all of the required supplemental 5543051d27SRobert Mustacchigroups that are desired. 5643051d27SRobert Mustacchi.Pp 5743051d27SRobert MustacchiNot all process handles have credential information available to them. 5843051d27SRobert MustacchiFor example, the handles that come from 5972d3dbb9SYuri Pankov.Xr Pgrab_file 3PROC 6043051d27SRobert Mustacchihave no processes associated with them and thus have no credentials 6143051d27SRobert Mustacchiassociated with them. 6243051d27SRobert Mustacchi.Sh RETURN VALUES 6343051d27SRobert MustacchiUpon successful completion, the 6443051d27SRobert Mustacchi.Fn Pcred 6543051d27SRobert Mustacchifunction returns 6643051d27SRobert Mustacchi.Sy 0 6743051d27SRobert Mustacchiand updates the memory at 6843051d27SRobert Mustacchi.Fa pcrp 6972d3dbb9SYuri Pankovwith the credentials. 7072d3dbb9SYuri PankovOtherwise, 7143051d27SRobert Mustacchi.Sy -1 7243051d27SRobert Mustacchiis returned to indicate an error. 7343051d27SRobert Mustacchi.Sh INTERFACE STABILITY 7443051d27SRobert Mustacchi.Sy Uncommitted 7543051d27SRobert Mustacchi.Sh MT-LEVEL 7643051d27SRobert MustacchiSee 7743051d27SRobert Mustacchi.Sy LOCKING 7843051d27SRobert Mustacchiin 7943051d27SRobert Mustacchi.Xr libproc 3LIB . 8043051d27SRobert Mustacchi.Sh SEE ALSO 8143051d27SRobert Mustacchi.Xr libproc 3LIB , 8243051d27SRobert Mustacchi.Xr Psetcred 3PROC , 83*bbf21555SRichard Lowe.Xr proc 5 84