1priv_set(3C) Standard C Library Functions priv_set(3C)
2
3
4
6 priv_set, priv_ineffect - change privilege sets and check whether priv‐
7 ileges are set
8
10 #include <priv.h>
11
12 int priv_set(priv_op_t op, priv_ptype_t which...);
13
14
15 boolean_t priv_ineffect(const char *priv);
16
17
19 The priv_set() function is a convenient wrapper for the setppriv(2)
20 function. It takes three or more arguments. The operation argument, op,
21 can be one of PRIV_OFF, PRIV_ON or PRIV_SET. The which argument is the
22 name of the privilege set to change. The third argument is a list of
23 zero or more privilege names terminated with a null pointer. If which
24 is the special pseudo set PRIV_ALLSETS, the operation should be applied
25 to all privilege sets.
26
27
28 The specified privileges are converted to a binary privilege set and
29 setppriv() is called with the same op and which arguments. When called
30 with PRIV_ALLSETS as the value for the which argument, setppriv() is
31 called for each set in turn, aborting on the first failed call.
32
33
34 The priv_ineffect() function is a conventient wrapper for the getp‐
35 priv(2) function. The priv argument specifies the name of the privilege
36 for which this function checks its presence in the effective set.
37
39 Upon successful completion, priv_set() return 0. Otherwise, -1 is
40 returned and errno is set to indicate the error.
41
42
43 If priv is a valid privilege that is a member of the effective set,
44 priv_ineffect() returns B_TRUE. Otherwise, it returns B_FALSE and sets
45 errno to incicate the error.
46
48 The priv_set() function will fail if:
49
50 EINVAL The value of op or which is out of range.
51
52
53 ENOMEM Insufficient memory was allocated.
54
55
56 EPERM The application attempted to add privileges to PRIV_LIMIT or
57 PRIV_PERMITTED, or the application attempted to add privi‐
58 leges to PRIV_INHERITABLE or PRIV_EFFECTIVE that were not in
59 PRIV_PERMITTED.
60
61
62
63 The priv_ineffect() function will fail if:
64
65 EINVAL The privilege specified by priv is invalid.
66
67
68 ENOMEM Insufficient memory was allocated.
69
70
72 See attributes(5) for descriptions of the following attributes:
73
74
75
76
77 ┌─────────────────────────────┬─────────────────────────────┐
78 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
79 ├─────────────────────────────┼─────────────────────────────┤
80 │Interface Stability │Evolving │
81 ├─────────────────────────────┼─────────────────────────────┤
82 │MT-Level │MT-Safe │
83 └─────────────────────────────┴─────────────────────────────┘
84
86 setppriv(2), priv_str_to_set(3C), attributes(5), privileges(5)
87
88
89
90SunOS 5.11 25 Sep 2003 priv_set(3C)