xref: /illumos-gate/usr/src/man/man3proc/proc_get_priv.3proc (revision e3ae4b35c024af1196582063ecee3ab79367227d)
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 November 27, 2023
15.Dt PROC_GET_PRIV 3PROC
16.Os
17.Sh NAME
18.Nm proc_get_priv ,
19.Nm proc_free_priv
20.Nd get process privileges
21.Sh LIBRARY
22.Lb libproc
23.Sh SYNOPSIS
24.In libproc.h
25.Ft "prpriv_t *"
26.Fo proc_get_priv
27.Fa "pid_t pid"
28.Fc
29.Ft void
30.Fo proc_free_priv
31.Fa "prpriv_t *prp"
32.Fc
33.Sh DESCRIPTION
34The
35.Fn proc_get_priv
36function is a convenient way to read the /proc privilege file for the
37process
38.Fa pid .
39The
40.Fn proc_get_priv
41function takes care of allocating memory for the privilege set and
42ensures that it is large enough to hold all of the privilege sets.
43The definition of the
44.Sy prpriv_t
45structure may be found in
46.Xr proc 5 .
47.Pp
48The
49.Fn proc_free_priv
50function releases the memory that was allocated by a call to
51.Fn proc_get_priv .
52It is safe to pass the
53.Dv NULL
54pointer in as
55.Fa prp ,
56the function will simply return without taking any action in that case.
57.Sh RETURN VALUES
58Upon successful completion, the
59.Fn proc_get_priv
60function returns a pointer to an allocated
61.Sy prpriv_t
62with the privileges of
63.Fa pid .
64Otherwise,
65.Dv NULL
66is returned to indicate an error occurred.
67.Sh INTERFACE STABILITY
68.Sy Uncommitted
69.Sh MT-LEVEL
70.Sy MT-Safe
71.Sh SEE ALSO
72.Xr libproc 3LIB ,
73.Xr proc 5
74