xref: /illumos-gate/usr/src/man/man3proc/proc_get_cred.3proc (revision 2a613b5974ae49c8b068a3998ff554f8c6f0f593)
1.\"
2.\" This file and its contents are supplied under the terms of the
3.\" Common Development and Distribution License ("CDDL"), version 1.0.
4.\" You may only use this file in accordance with the terms of version
5.\" 1.0 of the CDDL.
6.\"
7.\" A full copy of the text of the CDDL should have accompanied this
8.\" source.  A copy of the CDDL is also available via the Internet at
9.\" http://www.illumos.org/license/CDDL.
10.\"
11.\"
12.\" Copyright 2015 Joyent, Inc.
13.\"
14.Dd May 11, 2016
15.Dt PROG_GET_CRED 3PROC
16.Os
17.Sh NAME
18.Nm proc_get_cred
19.Nd get process credentials
20.Sh SYNOPSIS
21.Lb libproc
22.In libproc.h
23.Ft int
24.Fo proc_get_cred
25.Fa "pid_t proc"
26.Fa "prcred_t *credp"
27.Fa "int ngroups"
28.Fc
29.Sh DESCRIPTION
30The
31.Fn proc_get_cred
32function is a convenient way to read the /proc cred file for the process
33.Fa proc .
34.Pp
35Up to
36.Fa ngroups
37supplemental groups will be read and written into
38.Fa credp
39in addition to the normal information.
40If
41.Fa ngroups
42is more than one, than it is up to the caller to have allocated enough
43space for
44.Fa credp .
45Callers could allocate it, using an expression similar to:
46.Pp
47.Dl credp = malloc(sizeof (prcred_t) + (ngroups - 1) * sizeof (gid_t));
48.Pp
49The definition of the
50.Sy prcred_t
51structure may be found in
52.Xr proc 4 .
53.Sh RETURN VALUES
54Upon successful completion, the
55.Fn proc_get_cred
56function returns
57.Sy 0 .
58Otherwise,
59.Sy -1
60is returned to indicate an error occurred.
61.Sh INTERFACE STABILITY
62.Sy Uncommitted
63.Sh MT-LEVEL
64.Sy MT-Safe
65.Sh SEE ALSO
66.Xr libproc 3LIB ,
67.Xr proc 4
68