ksh: build with __EXTENSIONS__ to expose confstr
[unleashed.git] / share / man / man2 / getaudit.2
blobd2c117945cb33fecc4e44658d21f2b63c4b2f8bc
1 '\" te
2 .\" Copyright (c) 2008, Sun Microsystems, Inc.  All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH GETAUDIT 2 "Mar 6, 2017"
7 .SH NAME
8 getaudit, setaudit, getaudit_addr, setaudit_addr \- get or set process audit
9 information
10 .SH SYNOPSIS
11 .LP
12 .nf
13 cc [ \fIflag\fR ... ] \fIfile\fR ... \fB-lbsm\fR [ \fIlibrary\fR ... ]
14 #include <sys/param.h>
15 #include <bsm/libbsm.h>
17 \fBint\fR \fBgetaudit\fR(\fBstruct auditinfo *\fR\fIinfo\fR);
18 .fi
20 .LP
21 .nf
22 \fBint\fR \fBsetaudit\fR(\fBstruct auditinfo *\fR\fIinfo\fR);
23 .fi
25 .LP
26 .nf
27 \fBint\fR \fBgetaudit_addr\fR(\fBstruct auditinfo_addr *\fR\fIinfo\fR, \fBint\fR \fIlength\fR);
28 .fi
30 .LP
31 .nf
32 \fBint\fR \fBsetaudit_addr\fR(\fBstruct auditinfo_addr *\fR\fIinfo\fR, \fBint\fR \fIlength\fR);
33 .fi
35 .SH DESCRIPTION
36 .LP
37 The \fBgetaudit()\fR function gets the audit \fBID\fR, the preselection mask,
38 the terminal \fBID\fR and the audit session \fBID\fR for the current process.
39 .sp
40 .LP
41 The \fBgetaudit()\fR function can fail and return an \fBE2BIG\fR errno if the
42 address field in the terminal \fBID\fR is larger than 32 bits. In this case,
43 \fBgetaudit_addr()\fR should be used.
44 .sp
45 .LP
46 The \fBsetaudit()\fR function sets the audit \fBID\fR, the preselection mask,
47 the terminal \fBID\fR and the audit session \fBID\fR for the current process.
48 .sp
49 .LP
50 The \fBgetaudit_addr()\fR function returns a variable length
51 \fBauditinfo_addr\fR structure that contains the audit \fBID\fR, the
52 preselection mask, the terminal \fBID\fR, and the audit session \fBID\fR for
53 the current process. The terminal \fBID\fR contains a size field that indicates
54 the size of the network address.
55 .sp
56 .LP
57 The \fBsetaudit_addr()\fR function sets the audit \fBID\fR, the preselection
58 mask, the terminal \fBID\fR, and  the audit session \fBID\fR for the current
59 process. The values are taken from the variable length structure
60 \fBauditinfo_addr\fR. The terminal \fBID\fR contains a size field that
61 indicates the size of the network address.
62 .sp
63 .LP
64 The \fBauditinfo\fR structure is used to pass the process audit information and
65 contains the following members:
66 .sp
67 .in +2
68 .nf
69 au_id_t     ai_auid;        /* audit user ID */
70 au_mask_t   ai_mask;        /* preselection mask */
71 au_tid_t    ai_termid;      /* terminal ID */
72 au_asid_t   ai_asid;        /* audit session ID */
73 .fi
74 .in -2
76 .sp
77 .LP
78 The \fBauditinfo_addr\fR structure is used to pass the process audit
79 information and contains the following members:
80 .sp
81 .in +2
82 .nf
83 au_id_t        ai_auid;      /* audit user ID */
84 au_mask_t      ai_mask;      /* preselection mask */
85 au_tid_addr_t  ai_termid;    /* terminal ID */
86 au_asid_t      ai_asid;      /* audit session ID */
87 .fi
88 .in -2
90 .SH RETURN VALUES
91 .LP
92 Upon successful completion, \fBgetaudit()\fR and  \fBsetaudit()\fR return
93 \fB0\fR. Otherwise, \fB\(mi1\fR is returned and \fBerrno\fR is set to indicate
94 the error.
95 .SH ERRORS
96 .LP
97 The \fBgetaudit()\fR and \fBsetaudit()\fR functions will fail if:
98 .sp
99 .ne 2
101 \fB\fBEFAULT\fR\fR
103 .RS 10n
104 The \fIinfo\fR parameter points outside the process's allocated address space.
108 .ne 2
110 \fB\fBEPERM\fR\fR
112 .RS 10n
113 The {\fBPRIV_SYS_AUDIT\fR} privilege is not asserted in the effective set of
114 the calling process.
117 .SH USAGE
119 The calling process must have the {\fBPRIV_SYS_AUDIT\fR} privilege asserted in
120 its effective set.
121 .SH ATTRIBUTES
123 See \fBattributes\fR(5) for descriptions of the following attributes:
128 box;
129 c | c
130 l | l .
131 ATTRIBUTE TYPE  ATTRIBUTE VALUE
133 Interface Stability     Stable
135 MT-Level        MT-Safe
138 .SH SEE ALSO
140 \fBaudit\fR(2), \fBattributes\fR(5)