7964 Want usba hcdi manual pages
[unleashed.git] / usr / src / man / man3proc / proc_get_cred.3proc
blobdbdb08c379416c289eb140847f8a7175ba9a1600
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
30 The
31 .Fn proc_get_cred
32 function is a convenient way to read the /proc cred file for the process
33 .Fa proc .
34 .Pp
35 Up to
36 .Fa ngroups
37 supplemental groups will be read and written into
38 .Fa credp
39 in addition to the normal information. If
40 .Fa ngroups
41 is more than one, than it is up to the caller to have allocated enough
42 space for
43 .Fa credp .
44 Callers could allocate it, using an expression similar to:
45 .Pp
46 .Dl credp = malloc(sizeof (prcred_t) + (ngroups - 1) * sizeof (gid_t));
47 .Pp
48 The definition of the
49 .Sy prcred_t
50 structure may be found in
51 .Xr proc 4 .
52 .Sh RETURN VALUES
53 Upon successful completion, the
54 .Fn proc_get_cred
55 function returns
56 .Sy 0 .
57 Otherwise,
58 .Sy -1
59 is returned to indicate an error occurred.
60 .Sh INTERFACE STABILITY
61 .Sy Uncommitted
62 .Sh MT-LEVEL
63 .Sy MT-Safe
64 .Sh SEE ALSO
65 .Xr libproc 3LIB ,
66 .Xr proc 4