1getauid(2) System Calls getauid(2)
2
3
4
6 getauid, setauid - get or set user audit identity
7
9 cc [ flag ... ] file ... -lbsm -lsocket -lnsl [ library ... ]
10 #include <sys/param.h>
11 #include <bsm/libbsm.h>
12
13 int getauid(au_id_t *auid);
14
15
16 int setauid(au_id_t *auid);
17
18
20 The getauid() function returns the audit user ID for the current
21 process. This value is initially set at login time and inherited by all
22 child processes. This value does not change when the real/effective
23 user IDs change, so it can be used to identify the logged-in user even
24 when running a setuid program. The audit user ID governs audit deci‐
25 sions for a process.
26
27
28 The setauid() function sets the audit user ID for the current process.
29
31 Upon successful completion, the getauid() function returns the audit
32 user ID of the current process on success. Otherwise, it returns −1 and
33 sets errno to indicate the error.
34
35
36 Upon successful completion the setauid() function returns 0. Otherwise,
37 −1 is returned and errno is set to indicate the error.
38
40 The getauid() and setauid() functions will fail if:
41
42 EFAULT The auid argument points to an invalid address.
43
44
45 EPERM The {PRIV_SYS_AUDIT} privilege is not asserted in the effec‐
46 tive set of the calling process.
47
48
49
50 The getauid() function will fail if:
51
52 EPERM The {PRIV_PROC_AUDIT} privilege is not asserted in the effec‐
53 tive set of the calling process.
54
55
57 Only a process with appropriate privileges can successfully execute
58 these calls.
59
61 bsmconv(1M), audit(2), getaudit(2), privileges(5)
62
64 The functionality described on this manual page is available only if
65 the Solaris Auditing has been enabled. See bsmconv(1M) for more infor‐
66 mation.
67
68
69 These functions have been superseded by getaudit(2) and setaudit().
70
71
72
73SunOS 5.11 16 Apr 2008 getauid(2)