authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-12-21 03:52:48+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-12-21 03:54:17+01:00
logb27bdd5af0976d0b94819d6dda557d0dbb8f0d98
tree65aab9d9e4310feeb0acff512f852d32161d55d0
parent442592855c655f20b8b51db9ac75e17485c4e685

libc: add back freebsd bsm headers

Accidentally removed in #30135.

8 files changed, 2143 insertions(+), 0 deletions(-)

lib/libc/include/generic-freebsd/bsm/audit.h created+345
......@@ -0,0 +1,345 @@
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 2005-2009 Apple Inc.
5 * Copyright (c) 2016 Robert N. M. Watson
6 * All rights reserved.
7 *
8 * Portions of this software were developed by BAE Systems, the University of
9 * Cambridge Computer Laboratory, and Memorial University under DARPA/AFRL
10 * contract FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent
11 * Computing (TC) research program.
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 *
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 * 3. Neither the name of Apple Inc. ("Apple") nor the names of
23 * its contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
27 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
30 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
33 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 */
37
38#ifndef _BSM_AUDIT_H
39#define _BSM_AUDIT_H
40
41#include <sys/param.h>
42#include <sys/types.h>
43
44#define AUDIT_RECORD_MAGIC 0x828a0f1b
45#define MAX_AUDIT_RECORDS 20
46#define MAXAUDITDATA (0x8000 - 1)
47#define MAX_AUDIT_RECORD_SIZE MAXAUDITDATA
48#define MIN_AUDIT_FILE_SIZE (512 * 1024)
49
50/*
51 * Minimum noumber of free blocks on the filesystem containing the audit
52 * log necessary to avoid a hard log rotation. DO NOT SET THIS VALUE TO 0
53 * as the kernel does an unsigned compare, plus we want to leave a few blocks
54 * free so userspace can terminate the log, etc.
55 */
56#define AUDIT_HARD_LIMIT_FREE_BLOCKS 4
57
58/*
59 * Triggers for the audit daemon.
60 */
61#define AUDIT_TRIGGER_MIN 1
62#define AUDIT_TRIGGER_LOW_SPACE 1 /* Below low watermark. */
63#define AUDIT_TRIGGER_ROTATE_KERNEL 2 /* Kernel requests rotate. */
64#define AUDIT_TRIGGER_READ_FILE 3 /* Re-read config file. */
65#define AUDIT_TRIGGER_CLOSE_AND_DIE 4 /* Terminate audit. */
66#define AUDIT_TRIGGER_NO_SPACE 5 /* Below min free space. */
67#define AUDIT_TRIGGER_ROTATE_USER 6 /* User requests rotate. */
68#define AUDIT_TRIGGER_INITIALIZE 7 /* User initialize of auditd. */
69#define AUDIT_TRIGGER_EXPIRE_TRAILS 8 /* User expiration of trails. */
70#define AUDIT_TRIGGER_MAX 8
71
72/*
73 * The special device filename (FreeBSD).
74 */
75#define AUDITDEV_FILENAME "audit"
76#define AUDIT_TRIGGER_FILE ("/dev/" AUDITDEV_FILENAME)
77
78/*
79 * Pre-defined audit IDs
80 */
81#define AU_DEFAUDITID (uid_t)(-1)
82#define AU_DEFAUDITSID 0
83#define AU_ASSIGN_ASID -1
84
85/*
86 * IPC types.
87 */
88#define AT_IPC_MSG ((u_char)1) /* Message IPC id. */
89#define AT_IPC_SEM ((u_char)2) /* Semaphore IPC id. */
90#define AT_IPC_SHM ((u_char)3) /* Shared mem IPC id. */
91
92/*
93 * Audit conditions.
94 */
95#define AUC_UNSET 0
96#define AUC_AUDITING 1
97#define AUC_NOAUDIT 2
98#define AUC_DISABLED -1
99
100/*
101 * auditon(2) commands.
102 */
103#define A_OLDGETPOLICY 2
104#define A_OLDSETPOLICY 3
105#define A_GETKMASK 4
106#define A_SETKMASK 5
107#define A_OLDGETQCTRL 6
108#define A_OLDSETQCTRL 7
109#define A_GETCWD 8
110#define A_GETCAR 9
111#define A_GETSTAT 12
112#define A_SETSTAT 13
113#define A_SETUMASK 14
114#define A_SETSMASK 15
115#define A_OLDGETCOND 20
116#define A_OLDSETCOND 21
117#define A_GETCLASS 22
118#define A_SETCLASS 23
119#define A_GETPINFO 24
120#define A_SETPMASK 25
121#define A_SETFSIZE 26
122#define A_GETFSIZE 27
123#define A_GETPINFO_ADDR 28
124#define A_GETKAUDIT 29
125#define A_SETKAUDIT 30
126#define A_SENDTRIGGER 31
127#define A_GETSINFO_ADDR 32
128#define A_GETPOLICY 33
129#define A_SETPOLICY 34
130#define A_GETQCTRL 35
131#define A_SETQCTRL 36
132#define A_GETCOND 37
133#define A_SETCOND 38
134#define A_GETEVENT 39 /* Get audit event-to-name mapping. */
135#define A_SETEVENT 40 /* Set audit event-to-name mapping. */
136
137/*
138 * Audit policy controls.
139 */
140#define AUDIT_CNT 0x0001
141#define AUDIT_AHLT 0x0002
142#define AUDIT_ARGV 0x0004
143#define AUDIT_ARGE 0x0008
144#define AUDIT_SEQ 0x0010
145#define AUDIT_WINDATA 0x0020
146#define AUDIT_USER 0x0040
147#define AUDIT_GROUP 0x0080
148#define AUDIT_TRAIL 0x0100
149#define AUDIT_PATH 0x0200
150#define AUDIT_SCNT 0x0400
151#define AUDIT_PUBLIC 0x0800
152#define AUDIT_ZONENAME 0x1000
153#define AUDIT_PERZONE 0x2000
154
155/*
156 * Default audit queue control parameters.
157 */
158#define AQ_HIWATER 100
159#define AQ_MAXHIGH 10000
160#define AQ_LOWATER 10
161#define AQ_BUFSZ MAXAUDITDATA
162#define AQ_MAXBUFSZ 1048576
163
164/*
165 * Default minimum percentage free space on file system.
166 */
167#define AU_FS_MINFREE 20
168
169/*
170 * Type definitions used indicating the length of variable length addresses
171 * in tokens containing addresses, such as header fields.
172 */
173#define AU_IPv4 4
174#define AU_IPv6 16
175
176__BEGIN_DECLS
177
178typedef uid_t au_id_t;
179typedef pid_t au_asid_t;
180typedef u_int16_t au_event_t;
181typedef u_int16_t au_emod_t;
182typedef u_int32_t au_class_t;
183typedef u_int64_t au_asflgs_t __attribute__ ((aligned (8)));
184
185struct au_tid {
186 u_int32_t port; /* XXX dev_t compatibility */
187 u_int32_t machine;
188};
189typedef struct au_tid au_tid_t;
190
191struct au_tid_addr {
192 u_int32_t at_port; /* XXX dev_t compatibility */
193 u_int32_t at_type;
194 u_int32_t at_addr[4];
195};
196typedef struct au_tid_addr au_tid_addr_t;
197
198struct au_mask {
199 unsigned int am_success; /* Success bits. */
200 unsigned int am_failure; /* Failure bits. */
201};
202typedef struct au_mask au_mask_t;
203
204struct auditinfo {
205 au_id_t ai_auid; /* Audit user ID. */
206 au_mask_t ai_mask; /* Audit masks. */
207 au_tid_t ai_termid; /* Terminal ID. */
208 au_asid_t ai_asid; /* Audit session ID. */
209};
210typedef struct auditinfo auditinfo_t;
211
212struct auditinfo_addr {
213 au_id_t ai_auid; /* Audit user ID. */
214 au_mask_t ai_mask; /* Audit masks. */
215 au_tid_addr_t ai_termid; /* Terminal ID. */
216 au_asid_t ai_asid; /* Audit session ID. */
217 au_asflgs_t ai_flags; /* Audit session flags. */
218};
219typedef struct auditinfo_addr auditinfo_addr_t;
220
221struct auditpinfo {
222 pid_t ap_pid; /* ID of target process. */
223 au_id_t ap_auid; /* Audit user ID. */
224 au_mask_t ap_mask; /* Audit masks. */
225 au_tid_t ap_termid; /* Terminal ID. */
226 au_asid_t ap_asid; /* Audit session ID. */
227};
228typedef struct auditpinfo auditpinfo_t;
229
230struct auditpinfo_addr {
231 pid_t ap_pid; /* ID of target process. */
232 au_id_t ap_auid; /* Audit user ID. */
233 au_mask_t ap_mask; /* Audit masks. */
234 au_tid_addr_t ap_termid; /* Terminal ID. */
235 au_asid_t ap_asid; /* Audit session ID. */
236 au_asflgs_t ap_flags; /* Audit session flags. */
237};
238typedef struct auditpinfo_addr auditpinfo_addr_t;
239
240struct au_session {
241 auditinfo_addr_t *as_aia_p; /* Ptr to full audit info. */
242 au_mask_t as_mask; /* Process Audit Masks. */
243};
244typedef struct au_session au_session_t;
245
246/*
247 * Contents of token_t are opaque outside of libbsm.
248 */
249typedef struct au_token token_t;
250
251/*
252 * Kernel audit queue control parameters:
253 * Default: Maximum:
254 * aq_hiwater: AQ_HIWATER (100) AQ_MAXHIGH (10000)
255 * aq_lowater: AQ_LOWATER (10) <aq_hiwater
256 * aq_bufsz: AQ_BUFSZ (32767) AQ_MAXBUFSZ (1048576)
257 * aq_delay: 20 20000 (not used)
258 */
259struct au_qctrl {
260 int aq_hiwater; /* Max # of audit recs in queue when */
261 /* threads with new ARs get blocked. */
262
263 int aq_lowater; /* # of audit recs in queue when */
264 /* blocked threads get unblocked. */
265
266 int aq_bufsz; /* Max size of audit record for audit(2). */
267 int aq_delay; /* Queue delay (not used). */
268 int aq_minfree; /* Minimum filesystem percent free space. */
269};
270typedef struct au_qctrl au_qctrl_t;
271
272/*
273 * Structure for the audit statistics.
274 */
275struct audit_stat {
276 unsigned int as_version;
277 unsigned int as_numevent;
278 int as_generated;
279 int as_nonattrib;
280 int as_kernel;
281 int as_audit;
282 int as_auditctl;
283 int as_enqueue;
284 int as_written;
285 int as_wblocked;
286 int as_rblocked;
287 int as_dropped;
288 int as_totalsize;
289 unsigned int as_memused;
290};
291typedef struct audit_stat au_stat_t;
292
293/*
294 * Structure for the audit file statistics.
295 */
296struct audit_fstat {
297 u_int64_t af_filesz;
298 u_int64_t af_currsz;
299};
300typedef struct audit_fstat au_fstat_t;
301
302/*
303 * Audit to event class mapping.
304 */
305struct au_evclass_map {
306 au_event_t ec_number;
307 au_class_t ec_class;
308};
309typedef struct au_evclass_map au_evclass_map_t;
310
311/*
312 * Event-to-name mapping.
313 */
314#define EVNAMEMAP_NAME_SIZE 64
315struct au_evname_map {
316 au_event_t en_number;
317 char en_name[EVNAMEMAP_NAME_SIZE];
318};
319typedef struct au_evname_map au_evname_map_t;
320
321/*
322 * Audit system calls.
323 */
324#if !defined(_KERNEL) && !defined(KERNEL)
325int audit(const void *, int);
326int auditon(int, void *, int);
327int auditctl(const char *);
328int getauid(au_id_t *);
329int setauid(const au_id_t *);
330int getaudit(struct auditinfo *);
331int setaudit(const struct auditinfo *);
332int getaudit_addr(struct auditinfo_addr *, int);
333int setaudit_addr(const struct auditinfo_addr *, int);
334
335#ifdef __APPLE_API_PRIVATE
336#include <mach/port.h>
337mach_port_name_t audit_session_self(void);
338au_asid_t audit_session_join(mach_port_name_t port);
339#endif /* __APPLE_API_PRIVATE */
340
341#endif /* defined(_KERNEL) || defined(KERNEL) */
342
343__END_DECLS
344
345#endif /* !_BSM_AUDIT_H */
lib/libc/include/generic-freebsd/bsm/audit_domain.h created+114
......@@ -0,0 +1,114 @@
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 2008 Apple Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of Apple Inc. ("Apple") nor the names of
16 * its contributors may be used to endorse or promote products derived
17 * from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR
23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
28 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _BSM_AUDIT_DOMAIN_H_
33#define _BSM_AUDIT_DOMAIN_H_
34
35/*
36 * BSM protocol domain constants - protocol domains defined in Solaris.
37 */
38#define BSM_PF_UNSPEC 0
39#define BSM_PF_LOCAL 1
40#define BSM_PF_INET 2
41#define BSM_PF_IMPLINK 3
42#define BSM_PF_PUP 4
43#define BSM_PF_CHAOS 5
44#define BSM_PF_NS 6
45#define BSM_PF_NBS 7 /* Solaris-specific. */
46#define BSM_PF_ECMA 8
47#define BSM_PF_DATAKIT 9
48#define BSM_PF_CCITT 10
49#define BSM_PF_SNA 11
50#define BSM_PF_DECnet 12
51#define BSM_PF_DLI 13
52#define BSM_PF_LAT 14
53#define BSM_PF_HYLINK 15
54#define BSM_PF_APPLETALK 16
55#define BSM_PF_NIT 17 /* Solaris-specific. */
56#define BSM_PF_802 18 /* Solaris-specific. */
57#define BSM_PF_OSI 19
58#define BSM_PF_X25 20 /* Solaris/Linux-specific. */
59#define BSM_PF_OSINET 21 /* Solaris-specific. */
60#define BSM_PF_GOSIP 22 /* Solaris-specific. */
61#define BSM_PF_IPX 23
62#define BSM_PF_ROUTE 24
63#define BSM_PF_LINK 25
64#define BSM_PF_INET6 26
65#define BSM_PF_KEY 27
66#define BSM_PF_NCA 28 /* Solaris-specific. */
67#define BSM_PF_POLICY 29 /* Solaris-specific. */
68#define BSM_PF_INET_OFFLOAD 30 /* Solaris-specific. */
69
70/*
71 * BSM protocol domain constants - protocol domains not defined in Solaris.
72 */
73#define BSM_PF_NETBIOS 500 /* FreeBSD/Darwin-specific. */
74#define BSM_PF_ISO 501 /* FreeBSD/Darwin-specific. */
75#define BSM_PF_XTP 502 /* FreeBSD/Darwin-specific. */
76#define BSM_PF_COIP 503 /* FreeBSD/Darwin-specific. */
77#define BSM_PF_CNT 504 /* FreeBSD/Darwin-specific. */
78#define BSM_PF_RTIP 505 /* FreeBSD/Darwin-specific. */
79#define BSM_PF_SIP 506 /* FreeBSD/Darwin-specific. */
80#define BSM_PF_PIP 507 /* FreeBSD/Darwin-specific. */
81#define BSM_PF_ISDN 508 /* FreeBSD/Darwin-specific. */
82#define BSM_PF_E164 509 /* FreeBSD/Darwin-specific. */
83#define BSM_PF_NATM 510 /* FreeBSD/Darwin-specific. */
84#define BSM_PF_ATM 511 /* FreeBSD/Darwin-specific. */
85#define BSM_PF_NETGRAPH 512 /* FreeBSD/Darwin-specific. */
86#define BSM_PF_SLOW 513 /* FreeBSD-specific. */
87#define BSM_PF_SCLUSTER 514 /* FreeBSD-specific. */
88#define BSM_PF_ARP 515 /* FreeBSD-specific. */
89#define BSM_PF_BLUETOOTH 516 /* FreeBSD-specific. */
90 /* 517: unallocated. */
91#define BSM_PF_AX25 518 /* Linux-specific. */
92#define BSM_PF_ROSE 519 /* Linux-specific. */
93#define BSM_PF_NETBEUI 520 /* Linux-specific. */
94#define BSM_PF_SECURITY 521 /* Linux-specific. */
95#define BSM_PF_PACKET 522 /* Linux-specific. */
96#define BSM_PF_ASH 523 /* Linux-specific. */
97#define BSM_PF_ECONET 524 /* Linux-specific. */
98#define BSM_PF_ATMSVC 525 /* Linux-specific. */
99#define BSM_PF_IRDA 526 /* Linux-specific. */
100#define BSM_PF_PPPOX 527 /* Linux-specific. */
101#define BSM_PF_WANPIPE 528 /* Linux-specific. */
102#define BSM_PF_LLC 529 /* Linux-specific. */
103#define BSM_PF_CAN 530 /* Linux-specific. */
104#define BSM_PF_TIPC 531 /* Linux-specific. */
105#define BSM_PF_IUCV 532 /* Linux-specific. */
106#define BSM_PF_RXRPC 533 /* Linux-specific. */
107#define BSM_PF_PHONET 534 /* Linux-specific. */
108
109/*
110 * Used when there is no mapping from a local to BSM protocol domain.
111 */
112#define BSM_PF_UNKNOWN 700 /* OpenBSM-specific. */
113
114#endif /* !_BSM_AUDIT_DOMAIN_H_ */
lib/libc/include/generic-freebsd/bsm/audit_errno.h created+217
......@@ -0,0 +1,217 @@
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 2008 Apple Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of Apple Inc. ("Apple") nor the names of
16 * its contributors may be used to endorse or promote products derived
17 * from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR
23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
28 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _BSM_AUDIT_ERRNO_H_
33#define _BSM_AUDIT_ERRNO_H_
34
35/*
36 * For the purposes of portable encoding, we convert between local error
37 * numbers and Solaris error numbers (as well as some extensions for error
38 * numbers that don't exist in Solaris). Although the first 35 or so
39 * constants are the same across all OS's, we don't handle that in any
40 * special way.
41 *
42 * When adding constants here, also add them to bsm_errno.c.
43 */
44#define BSM_ERRNO_ESUCCESS 0
45#define BSM_ERRNO_EPERM 1
46#define BSM_ERRNO_ENOENT 2
47#define BSM_ERRNO_ESRCH 3
48#define BSM_ERRNO_EINTR 4
49#define BSM_ERRNO_EIO 5
50#define BSM_ERRNO_ENXIO 6
51#define BSM_ERRNO_E2BIG 7
52#define BSM_ERRNO_ENOEXEC 8
53#define BSM_ERRNO_EBADF 9
54#define BSM_ERRNO_ECHILD 10
55#define BSM_ERRNO_EAGAIN 11
56#define BSM_ERRNO_ENOMEM 12
57#define BSM_ERRNO_EACCES 13
58#define BSM_ERRNO_EFAULT 14
59#define BSM_ERRNO_ENOTBLK 15
60#define BSM_ERRNO_EBUSY 16
61#define BSM_ERRNO_EEXIST 17
62#define BSM_ERRNO_EXDEV 18
63#define BSM_ERRNO_ENODEV 19
64#define BSM_ERRNO_ENOTDIR 20
65#define BSM_ERRNO_EISDIR 21
66#define BSM_ERRNO_EINVAL 22
67#define BSM_ERRNO_ENFILE 23
68#define BSM_ERRNO_EMFILE 24
69#define BSM_ERRNO_ENOTTY 25
70#define BSM_ERRNO_ETXTBSY 26
71#define BSM_ERRNO_EFBIG 27
72#define BSM_ERRNO_ENOSPC 28
73#define BSM_ERRNO_ESPIPE 29
74#define BSM_ERRNO_EROFS 30
75#define BSM_ERRNO_EMLINK 31
76#define BSM_ERRNO_EPIPE 32
77#define BSM_ERRNO_EDOM 33
78#define BSM_ERRNO_ERANGE 34
79#define BSM_ERRNO_ENOMSG 35
80#define BSM_ERRNO_EIDRM 36
81#define BSM_ERRNO_ECHRNG 37 /* Solaris/Linux-specific. */
82#define BSM_ERRNO_EL2NSYNC 38 /* Solaris/Linux-specific. */
83#define BSM_ERRNO_EL3HLT 39 /* Solaris/Linux-specific. */
84#define BSM_ERRNO_EL3RST 40 /* Solaris/Linux-specific. */
85#define BSM_ERRNO_ELNRNG 41 /* Solaris/Linux-specific. */
86#define BSM_ERRNO_EUNATCH 42 /* Solaris/Linux-specific. */
87#define BSM_ERRNO_ENOCSI 43 /* Solaris/Linux-specific. */
88#define BSM_ERRNO_EL2HLT 44 /* Solaris/Linux-specific. */
89#define BSM_ERRNO_EDEADLK 45
90#define BSM_ERRNO_ENOLCK 46
91#define BSM_ERRNO_ECANCELED 47
92#define BSM_ERRNO_ENOTSUP 48
93#define BSM_ERRNO_EDQUOT 49
94#define BSM_ERRNO_EBADE 50 /* Solaris/Linux-specific. */
95#define BSM_ERRNO_EBADR 51 /* Solaris/Linux-specific. */
96#define BSM_ERRNO_EXFULL 52 /* Solaris/Linux-specific. */
97#define BSM_ERRNO_ENOANO 53 /* Solaris/Linux-specific. */
98#define BSM_ERRNO_EBADRQC 54 /* Solaris/Linux-specific. */
99#define BSM_ERRNO_EBADSLT 55 /* Solaris/Linux-specific. */
100#define BSM_ERRNO_EDEADLOCK 56 /* Solaris-specific. */
101#define BSM_ERRNO_EBFONT 57 /* Solaris/Linux-specific. */
102#define BSM_ERRNO_EOWNERDEAD 58 /* Solaris/Linux-specific. */
103#define BSM_ERRNO_ENOTRECOVERABLE 59 /* Solaris/Linux-specific. */
104#define BSM_ERRNO_ENOSTR 60 /* Solaris/Darwin/Linux-specific. */
105#define BSM_ERRNO_ENODATA 61 /* Solaris/Darwin/Linux-specific. */
106#define BSM_ERRNO_ETIME 62 /* Solaris/Darwin/Linux-specific. */
107#define BSM_ERRNO_ENOSR 63 /* Solaris/Darwin/Linux-specific. */
108#define BSM_ERRNO_ENONET 64 /* Solaris/Linux-specific. */
109#define BSM_ERRNO_ENOPKG 65 /* Solaris/Linux-specific. */
110#define BSM_ERRNO_EREMOTE 66
111#define BSM_ERRNO_ENOLINK 67
112#define BSM_ERRNO_EADV 68 /* Solaris/Linux-specific. */
113#define BSM_ERRNO_ESRMNT 69 /* Solaris/Linux-specific. */
114#define BSM_ERRNO_ECOMM 70 /* Solaris/Linux-specific. */
115#define BSM_ERRNO_EPROTO 71
116#define BSM_ERRNO_ELOCKUNMAPPED 72 /* Solaris-specific. */
117#define BSM_ERRNO_ENOTACTIVE 73 /* Solaris-specific. */
118#define BSM_ERRNO_EMULTIHOP 74
119#define BSM_ERRNO_EBADMSG 77
120#define BSM_ERRNO_ENAMETOOLONG 78
121#define BSM_ERRNO_EOVERFLOW 79
122#define BSM_ERRNO_ENOTUNIQ 80 /* Solaris/Linux-specific. */
123#define BSM_ERRNO_EBADFD 81 /* Solaris/Linux-specific. */
124#define BSM_ERRNO_EREMCHG 82 /* Solaris/Linux-specific. */
125#define BSM_ERRNO_ELIBACC 83 /* Solaris/Linux-specific. */
126#define BSM_ERRNO_ELIBBAD 84 /* Solaris/Linux-specific. */
127#define BSM_ERRNO_ELIBSCN 85 /* Solaris/Linux-specific. */
128#define BSM_ERRNO_ELIBMAX 86 /* Solaris/Linux-specific. */
129#define BSM_ERRNO_ELIBEXEC 87 /* Solaris/Linux-specific. */
130#define BSM_ERRNO_EILSEQ 88
131#define BSM_ERRNO_ENOSYS 89
132#define BSM_ERRNO_ELOOP 90
133#define BSM_ERRNO_ERESTART 91
134#define BSM_ERRNO_ESTRPIPE 92 /* Solaris/Linux-specific. */
135#define BSM_ERRNO_ENOTEMPTY 93
136#define BSM_ERRNO_EUSERS 94
137#define BSM_ERRNO_ENOTSOCK 95
138#define BSM_ERRNO_EDESTADDRREQ 96
139#define BSM_ERRNO_EMSGSIZE 97
140#define BSM_ERRNO_EPROTOTYPE 98
141#define BSM_ERRNO_ENOPROTOOPT 99
142#define BSM_ERRNO_EPROTONOSUPPORT 120
143#define BSM_ERRNO_ESOCKTNOSUPPORT 121
144#define BSM_ERRNO_EOPNOTSUPP 122
145#define BSM_ERRNO_EPFNOSUPPORT 123
146#define BSM_ERRNO_EAFNOSUPPORT 124
147#define BSM_ERRNO_EADDRINUSE 125
148#define BSM_ERRNO_EADDRNOTAVAIL 126
149#define BSM_ERRNO_ENETDOWN 127
150#define BSM_ERRNO_ENETUNREACH 128
151#define BSM_ERRNO_ENETRESET 129
152#define BSM_ERRNO_ECONNABORTED 130
153#define BSM_ERRNO_ECONNRESET 131
154#define BSM_ERRNO_ENOBUFS 132
155#define BSM_ERRNO_EISCONN 133
156#define BSM_ERRNO_ENOTCONN 134
157#define BSM_ERRNO_ESHUTDOWN 143
158#define BSM_ERRNO_ETOOMANYREFS 144
159#define BSM_ERRNO_ETIMEDOUT 145
160#define BSM_ERRNO_ECONNREFUSED 146
161#define BSM_ERRNO_EHOSTDOWN 147
162#define BSM_ERRNO_EHOSTUNREACH 148
163#define BSM_ERRNO_EALREADY 149
164#define BSM_ERRNO_EINPROGRESS 150
165#define BSM_ERRNO_ESTALE 151
166
167/*
168 * OpenBSM constants for error numbers not defined in Solaris. In the event
169 * that these errors are added to Solaris, we will deprecate the OpenBSM
170 * numbers in the same way we do for audit event constants.
171 *
172 * ELAST doesn't get a constant in the BSM space.
173 */
174#define BSM_ERRNO_EPROCLIM 190 /* FreeBSD/Darwin-specific. */
175#define BSM_ERRNO_EBADRPC 191 /* FreeBSD/Darwin-specific. */
176#define BSM_ERRNO_ERPCMISMATCH 192 /* FreeBSD/Darwin-specific. */
177#define BSM_ERRNO_EPROGUNAVAIL 193 /* FreeBSD/Darwin-specific. */
178#define BSM_ERRNO_EPROGMISMATCH 194 /* FreeBSD/Darwin-specific. */
179#define BSM_ERRNO_EPROCUNAVAIL 195 /* FreeBSD/Darwin-specific. */
180#define BSM_ERRNO_EFTYPE 196 /* FreeBSD/Darwin-specific. */
181#define BSM_ERRNO_EAUTH 197 /* FreeBSD/Darwin-specific. */
182#define BSM_ERRNO_ENEEDAUTH 198 /* FreeBSD/Darwin-specific. */
183#define BSM_ERRNO_ENOATTR 199 /* FreeBSD/Darwin-specific. */
184#define BSM_ERRNO_EDOOFUS 200 /* FreeBSD-specific. */
185#define BSM_ERRNO_EJUSTRETURN 201 /* FreeBSD-specific. */
186#define BSM_ERRNO_ENOIOCTL 202 /* FreeBSD-specific. */
187#define BSM_ERRNO_EDIRIOCTL 203 /* FreeBSD-specific. */
188#define BSM_ERRNO_EPWROFF 204 /* Darwin-specific. */
189#define BSM_ERRNO_EDEVERR 205 /* Darwin-specific. */
190#define BSM_ERRNO_EBADEXEC 206 /* Darwin-specific. */
191#define BSM_ERRNO_EBADARCH 207 /* Darwin-specific. */
192#define BSM_ERRNO_ESHLIBVERS 208 /* Darwin-specific. */
193#define BSM_ERRNO_EBADMACHO 209 /* Darwin-specific. */
194#define BSM_ERRNO_EPOLICY 210 /* Darwin-specific. */
195#define BSM_ERRNO_EDOTDOT 211 /* Linux-specific. */
196#define BSM_ERRNO_EUCLEAN 212 /* Linux-specific. */
197#define BSM_ERRNO_ENOTNAM 213 /* Linux(Xenix?)-specific. */
198#define BSM_ERRNO_ENAVAIL 214 /* Linux(Xenix?)-specific. */
199#define BSM_ERRNO_EISNAM 215 /* Linux(Xenix?)-specific. */
200#define BSM_ERRNO_EREMOTEIO 216 /* Linux-specific. */
201#define BSM_ERRNO_ENOMEDIUM 217 /* Linux-specific. */
202#define BSM_ERRNO_EMEDIUMTYPE 218 /* Linux-specific. */
203#define BSM_ERRNO_ENOKEY 219 /* Linux-specific. */
204#define BSM_ERRNO_EKEYEXPIRED 220 /* Linux-specific. */
205#define BSM_ERRNO_EKEYREVOKED 221 /* Linux-specific. */
206#define BSM_ERRNO_EKEYREJECTED 222 /* Linux-specific. */
207#define BSM_ERRNO_ENOTCAPABLE 223 /* FreeBSD-specific. */
208#define BSM_ERRNO_ECAPMODE 224 /* FreeBSD-specific. */
209#define BSM_ERRNO_EINTEGRITY 225 /* FreeBSD-specific. */
210
211/*
212 * In the event that OpenBSM doesn't have a file representation of a local
213 * error number, use this.
214 */
215#define BSM_ERRNO_UNKNOWN 250 /* OpenBSM-specific. */
216
217#endif /* !_BSM_AUDIT_ERRNO_H_ */
lib/libc/include/generic-freebsd/bsm/audit_fcntl.h created+140
......@@ -0,0 +1,140 @@
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 2009 Apple Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of Apple Inc. ("Apple") nor the names of
16 * its contributors may be used to endorse or promote products derived
17 * from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR
23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
28 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _BSM_AUDIT_FCNTL_H_
33#define _BSM_AUDIT_FCNTL_H_
34
35/*
36 * Shared and Solaris-specific: (0-99).
37 */
38#define BSM_F_DUPFD 0
39#define BSM_F_GETFD 1
40#define BSM_F_SETFD 2
41#define BSM_F_GETFL 3
42#define BSM_F_SETFL 4
43#define BSM_F_O_GETLK 5 /* Solaris-specific. */
44#define BSM_F_SETLK 6
45#define BSM_F_SETLKW 7
46#define BSM_F_CHKFL 8 /* Solaris-specific. */
47#define BSM_F_DUP2FD 9 /* FreeBSD/Solaris-specific. */
48#define BSM_F_ALLOCSP 10 /* Solaris-specific. */
49#define BSM_F_FREESP 11 /* Solaris-specific. */
50
51#define BSM_F_ISSTREAM 13 /* Solaris-specific. */
52#define BSM_F_GETLK 14
53#define BSM_F_PRIV 15 /* Solaris-specific. */
54#define BSM_F_NPRIV 16 /* Solaris-specific. */
55#define BSM_F_QUOTACTL 17 /* Solaris-specific. */
56#define BSM_F_BLOCKS 18 /* Solaris-specific. */
57#define BSM_F_BLKSIZE 19 /* Solaris-specific. */
58
59#define BSM_F_GETOWN 23
60#define BSM_F_SETOWN 24
61#define BSM_F_REVOKE 25 /* Solaris-specific. */
62#define BSM_F_HASREMOTELOCKS 26 /* Solaris-specific. */
63#define BSM_F_FREESP64 27 /* Solaris-specific. */
64#define BSM_F_ALLOCSP64 28 /* Solaris-specific. */
65
66#define BSM_F_GETLK64 33 /* Solaris-specific. */
67#define BSM_F_SETLK64 34 /* Solaris-specific. */
68#define BSM_F_SETLKW64 35 /* Solaris-specific. */
69
70#define BSM_F_SHARE 40 /* Solaris-specific. */
71#define BSM_F_UNSHARE 41 /* Solaris-specific. */
72#define BSM_F_SETLK_NBMAND 42 /* Solaris-specific. */
73#define BSM_F_SHARE_NBMAND 43 /* Solaris-specific. */
74#define BSM_F_SETLK64_NBMAND 44 /* Solaris-specific. */
75#define BSM_F_GETXFL 45 /* Solaris-specific. */
76#define BSM_F_BADFD 46 /* Solaris-specific. */
77
78/*
79 * FreeBSD-specific (100-199).
80 */
81#define BSM_F_OGETLK 107 /* FreeBSD-specific. */
82#define BSM_F_OSETLK 108 /* FreeBSD-specific. */
83#define BSM_F_OSETLKW 109 /* FreeBSD-specific. */
84
85#define BSM_F_SETLK_REMOTE 114 /* FreeBSD-specific. */
86
87/*
88 * Linux-specific (200-299).
89 */
90#define BSM_F_SETSIG 210 /* Linux-specific. */
91#define BSM_F_GETSIG 211 /* Linux-specific. */
92
93/*
94 * Darwin-specific (300-399).
95 */
96#define BSM_F_CHKCLEAN 341 /* Darwin-specific. */
97#define BSM_F_PREALLOCATE 342 /* Darwin-specific. */
98#define BSM_F_SETSIZE 343 /* Darwin-specific. */
99#define BSM_F_RDADVISE 344 /* Darwin-specific. */
100#define BSM_F_RDAHEAD 345 /* Darwin-specific. */
101#define BSM_F_READBOOTSTRAP 346 /* Darwin-specific. */
102#define BSM_F_WRITEBOOTSTRAP 347 /* Darwin-specific. */
103#define BSM_F_NOCACHE 348 /* Darwin-specific. */
104#define BSM_F_LOG2PHYS 349 /* Darwin-specific. */
105#define BSM_F_GETPATH 350 /* Darwin-specific. */
106#define BSM_F_FULLFSYNC 351 /* Darwin-specific. */
107#define BSM_F_PATHPKG_CHECK 352 /* Darwin-specific. */
108#define BSM_F_FREEZE_FS 353 /* Darwin-specific. */
109#define BSM_F_THAW_FS 354 /* Darwin-specific. */
110#define BSM_F_GLOBAL_NOCACHE 355 /* Darwin-specific. */
111#define BSM_F_OPENFROM 356 /* Darwin-specific. */
112#define BSM_F_UNLINKFROM 357 /* Darwin-specific. */
113#define BSM_F_CHECK_OPENEVT 358 /* Darwin-specific. */
114#define BSM_F_ADDSIGS 359 /* Darwin-specific. */
115#define BSM_F_MARKDEPENDENCY 360 /* Darwin-specific. */
116
117/*
118 * Darwin file system specific (400-499).
119 */
120#define BSM_F_FS_SPECIFIC_0 400 /* Darwin-fs-specific. */
121#define BSM_F_FS_SPECIFIC_1 401 /* Darwin-fs-specific. */
122#define BSM_F_FS_SPECIFIC_2 402 /* Darwin-fs-specific. */
123#define BSM_F_FS_SPECIFIC_3 403 /* Darwin-fs-specific. */
124#define BSM_F_FS_SPECIFIC_4 404 /* Darwin-fs-specific. */
125#define BSM_F_FS_SPECIFIC_5 405 /* Darwin-fs-specific. */
126#define BSM_F_FS_SPECIFIC_6 406 /* Darwin-fs-specific. */
127#define BSM_F_FS_SPECIFIC_7 407 /* Darwin-fs-specific. */
128#define BSM_F_FS_SPECIFIC_8 408 /* Darwin-fs-specific. */
129#define BSM_F_FS_SPECIFIC_9 409 /* Darwin-fs-specific. */
130#define BSM_F_FS_SPECIFIC_10 410 /* Darwin-fs-specific. */
131#define BSM_F_FS_SPECIFIC_11 411 /* Darwin-fs-specific. */
132#define BSM_F_FS_SPECIFIC_12 412 /* Darwin-fs-specific. */
133#define BSM_F_FS_SPECIFIC_13 413 /* Darwin-fs-specific. */
134#define BSM_F_FS_SPECIFIC_14 414 /* Darwin-fs-specific. */
135#define BSM_F_FS_SPECIFIC_15 415 /* Darwin-fs-specific. */
136
137
138#define BSM_F_UNKNOWN 0xFFFF
139
140#endif /* !_BSM_AUDIT_FCNTL_H_ */
lib/libc/include/generic-freebsd/bsm/audit_internal.h created+117
......@@ -0,0 +1,117 @@
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 2005-2008 Apple Inc.
5 * Copyright (c) 2005 SPARTA, Inc.
6 * All rights reserved.
7 *
8 * This code was developed in part by Robert N. M. Watson, Senior Principal
9 * Scientist, SPARTA, Inc.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of Apple Inc. ("Apple") nor the names of
21 * its contributors may be used to endorse or promote products derived
22 * from this software without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
25 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
28 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */
35
36#ifndef _AUDIT_INTERNAL_H
37#define _AUDIT_INTERNAL_H
38
39#if defined(__linux__) && !defined(__unused)
40#define __unused
41#endif
42
43/*
44 * audit_internal.h contains private interfaces that are shared by user space
45 * and the kernel for the purposes of assembling audit records. Applications
46 * should not include this file or use the APIs found within, or it may be
47 * broken with future releases of OpenBSM, which may delete, modify, or
48 * otherwise break these interfaces or the assumptions they rely on.
49 */
50struct au_token {
51 u_char *t_data;
52 size_t len;
53 TAILQ_ENTRY(au_token) tokens;
54};
55
56struct au_record {
57 char used; /* Record currently in use? */
58 int desc; /* Descriptor for record. */
59 TAILQ_HEAD(, au_token) token_q; /* Queue of BSM tokens. */
60 u_char *data;
61 size_t len;
62 LIST_ENTRY(au_record) au_rec_q;
63};
64typedef struct au_record au_record_t;
65
66
67/*
68 * We could determined the header and trailer sizes by defining appropriate
69 * structures. We hold off that approach until we have a consistent way of
70 * using structures for all tokens. This is not straightforward since these
71 * token structures may contain pointers of whose contents we do not know the
72 * size (e.g text tokens).
73 */
74#define AUDIT_HEADER_EX_SIZE(a) ((a)->ai_termid.at_type+18+sizeof(u_int32_t))
75#define AUDIT_HEADER_SIZE 18
76#define MAX_AUDIT_HEADER_SIZE (5*sizeof(u_int32_t)+18)
77#define AUDIT_TRAILER_SIZE 7
78
79/*
80 * BSM token streams store fields in big endian byte order, so as to be
81 * portable; when encoding and decoding, we must convert byte orders for
82 * typed values.
83 */
84#define ADD_U_CHAR(loc, val) \
85 do { \
86 *(loc) = (val); \
87 (loc) += sizeof(u_char); \
88 } while(0)
89
90
91#define ADD_U_INT16(loc, val) \
92 do { \
93 be16enc((loc), (val)); \
94 (loc) += sizeof(u_int16_t); \
95 } while(0)
96
97#define ADD_U_INT32(loc, val) \
98 do { \
99 be32enc((loc), (val)); \
100 (loc) += sizeof(u_int32_t); \
101 } while(0)
102
103#define ADD_U_INT64(loc, val) \
104 do { \
105 be64enc((loc), (val)); \
106 (loc) += sizeof(u_int64_t); \
107 } while(0)
108
109#define ADD_MEM(loc, data, size) \
110 do { \
111 memcpy((loc), (data), (size)); \
112 (loc) += size; \
113 } while(0)
114
115#define ADD_STRING(loc, data, size) ADD_MEM(loc, data, size)
116
117#endif /* !_AUDIT_INTERNAL_H_ */
lib/libc/include/generic-freebsd/bsm/audit_kevents.h created+853
......@@ -0,0 +1,853 @@
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 2005-2009 Apple Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of Apple Inc. ("Apple") nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
21 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
24 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _BSM_AUDIT_KEVENTS_H_
33#define _BSM_AUDIT_KEVENTS_H_
34
35/*
36 * The reserved event numbers for kernel events are 1...2047 and 43001..44999.
37 */
38#define AUE_IS_A_KEVENT(e) (((e) > 0 && (e) < 2048) || \
39 ((e) > 43000 && (e) < 45000))
40
41/*
42 * Values marked as AUE_NULL are not required to be audited as per CAPP.
43 *
44 * Some conflicts exist in the assignment of name to event number mappings
45 * between BSM implementations. In general, we prefer the OpenSolaris
46 * definition as we consider Solaris BSM to be authoritative. _DARWIN_ has
47 * been inserted for the Darwin variants. If necessary, other tags will be
48 * added in the future.
49 */
50#define AUE_NULL 0
51#define AUE_EXIT 1
52#define AUE_FORK 2
53#define AUE_FORKALL AUE_FORK /* Solaris-specific. */
54#define AUE_OPEN 3
55#define AUE_CREAT 4
56#define AUE_LINK 5
57#define AUE_UNLINK 6
58#define AUE_DELETE AUE_UNLINK /* Darwin-specific. */
59#define AUE_EXEC 7
60#define AUE_CHDIR 8
61#define AUE_MKNOD 9
62#define AUE_CHMOD 10
63#define AUE_CHOWN 11
64#define AUE_UMOUNT 12
65#define AUE_JUNK 13 /* Solaris-specific. */
66#define AUE_ACCESS 14
67#define AUE_KILL 15
68#define AUE_STAT 16
69#define AUE_LSTAT 17
70#define AUE_ACCT 18
71#define AUE_MCTL 19 /* Solaris-specific. */
72#define AUE_REBOOT 20 /* XXX: Darwin conflict. */
73#define AUE_SYMLINK 21
74#define AUE_READLINK 22
75#define AUE_EXECVE 23
76#define AUE_CHROOT 24
77#define AUE_VFORK 25
78#define AUE_SETGROUPS 26
79#define AUE_SETPGRP 27
80#define AUE_SWAPON 28
81#define AUE_SETHOSTNAME 29 /* XXX: Darwin conflict. */
82#define AUE_FCNTL 30
83#define AUE_SETPRIORITY 31 /* XXX: Darwin conflict. */
84#define AUE_CONNECT 32
85#define AUE_ACCEPT 33
86#define AUE_BIND 34
87#define AUE_SETSOCKOPT 35
88#define AUE_VTRACE 36 /* Solaris-specific. */
89#define AUE_SETTIMEOFDAY 37 /* XXX: Darwin conflict. */
90#define AUE_FCHOWN 38
91#define AUE_FCHMOD 39
92#define AUE_SETREUID 40
93#define AUE_SETREGID 41
94#define AUE_RENAME 42
95#define AUE_TRUNCATE 43 /* XXX: Darwin conflict. */
96#define AUE_FTRUNCATE 44 /* XXX: Darwin conflict. */
97#define AUE_FLOCK 45 /* XXX: Darwin conflict. */
98#define AUE_SHUTDOWN 46
99#define AUE_MKDIR 47
100#define AUE_RMDIR 48
101#define AUE_UTIMES 49
102#define AUE_ADJTIME 50
103#define AUE_SETRLIMIT 51
104#define AUE_KILLPG 52
105#define AUE_NFS_SVC 53 /* XXX: Darwin conflict. */
106#define AUE_STATFS 54
107#define AUE_FSTATFS 55
108#define AUE_UNMOUNT 56 /* XXX: Darwin conflict. */
109#define AUE_ASYNC_DAEMON 57
110#define AUE_NFS_GETFH 58 /* XXX: Darwin conflict. */
111#define AUE_SETDOMAINNAME 59
112#define AUE_QUOTACTL 60 /* XXX: Darwin conflict. */
113#define AUE_EXPORTFS 61
114#define AUE_MOUNT 62
115#define AUE_SEMSYS 63
116#define AUE_MSGSYS 64
117#define AUE_SHMSYS 65
118#define AUE_BSMSYS 66 /* Solaris-specific. */
119#define AUE_RFSSYS 67 /* Solaris-specific. */
120#define AUE_FCHDIR 68
121#define AUE_FCHROOT 69
122#define AUE_VPIXSYS 70 /* Solaris-specific. */
123#define AUE_PATHCONF 71
124#define AUE_OPEN_R 72
125#define AUE_OPEN_RC 73
126#define AUE_OPEN_RT 74
127#define AUE_OPEN_RTC 75
128#define AUE_OPEN_W 76
129#define AUE_OPEN_WC 77
130#define AUE_OPEN_WT 78
131#define AUE_OPEN_WTC 79
132#define AUE_OPEN_RW 80
133#define AUE_OPEN_RWC 81
134#define AUE_OPEN_RWT 82
135#define AUE_OPEN_RWTC 83
136#define AUE_MSGCTL 84
137#define AUE_MSGCTL_RMID 85
138#define AUE_MSGCTL_SET 86
139#define AUE_MSGCTL_STAT 87
140#define AUE_MSGGET 88
141#define AUE_MSGRCV 89
142#define AUE_MSGSND 90
143#define AUE_SHMCTL 91
144#define AUE_SHMCTL_RMID 92
145#define AUE_SHMCTL_SET 93
146#define AUE_SHMCTL_STAT 94
147#define AUE_SHMGET 95
148#define AUE_SHMAT 96
149#define AUE_SHMDT 97
150#define AUE_SEMCTL 98
151#define AUE_SEMCTL_RMID 99
152#define AUE_SEMCTL_SET 100
153#define AUE_SEMCTL_STAT 101
154#define AUE_SEMCTL_GETNCNT 102
155#define AUE_SEMCTL_GETPID 103
156#define AUE_SEMCTL_GETVAL 104
157#define AUE_SEMCTL_GETALL 105
158#define AUE_SEMCTL_GETZCNT 106
159#define AUE_SEMCTL_SETVAL 107
160#define AUE_SEMCTL_SETALL 108
161#define AUE_SEMGET 109
162#define AUE_SEMOP 110
163#define AUE_CORE 111 /* Solaris-specific, currently. */
164#define AUE_CLOSE 112
165#define AUE_SYSTEMBOOT 113 /* Solaris-specific. */
166#define AUE_ASYNC_DAEMON_EXIT 114 /* Solaris-specific. */
167#define AUE_NFSSVC_EXIT 115 /* Solaris-specific. */
168#define AUE_WRITEL 128 /* Solaris-specific. */
169#define AUE_WRITEVL 129 /* Solaris-specific. */
170#define AUE_GETAUID 130
171#define AUE_SETAUID 131
172#define AUE_GETAUDIT 132
173#define AUE_SETAUDIT 133
174#define AUE_GETUSERAUDIT 134 /* Solaris-specific. */
175#define AUE_SETUSERAUDIT 135 /* Solaris-specific. */
176#define AUE_AUDITSVC 136 /* Solaris-specific. */
177#define AUE_AUDITUSER 137 /* Solaris-specific. */
178#define AUE_AUDITON 138
179#define AUE_AUDITON_GTERMID 139 /* Solaris-specific. */
180#define AUE_AUDITON_STERMID 140 /* Solaris-specific. */
181#define AUE_AUDITON_GPOLICY 141
182#define AUE_AUDITON_SPOLICY 142
183#define AUE_AUDITON_GQCTRL 145
184#define AUE_AUDITON_SQCTRL 146
185#define AUE_GETKERNSTATE 147 /* Solaris-specific. */
186#define AUE_SETKERNSTATE 148 /* Solaris-specific. */
187#define AUE_GETPORTAUDIT 149 /* Solaris-specific. */
188#define AUE_AUDITSTAT 150 /* Solaris-specific. */
189#define AUE_REVOKE 151
190#define AUE_MAC 152 /* Solaris-specific. */
191#define AUE_ENTERPROM 153 /* Solaris-specific. */
192#define AUE_EXITPROM 154 /* Solaris-specific. */
193#define AUE_IFLOAT 155 /* Solaris-specific. */
194#define AUE_PFLOAT 156 /* Solaris-specific. */
195#define AUE_UPRIV 157 /* Solaris-specific. */
196#define AUE_IOCTL 158
197#define AUE_SOCKET 183
198#define AUE_SENDTO 184
199#define AUE_PIPE 185
200#define AUE_SOCKETPAIR 186 /* XXX: Darwin conflict. */
201#define AUE_SEND 187
202#define AUE_SENDMSG 188
203#define AUE_RECV 189
204#define AUE_RECVMSG 190
205#define AUE_RECVFROM 191
206#define AUE_READ 192
207#define AUE_GETDENTS 193
208#define AUE_LSEEK 194
209#define AUE_WRITE 195
210#define AUE_WRITEV 196
211#define AUE_NFS 197 /* Solaris-specific. */
212#define AUE_READV 198
213#define AUE_OSTAT 199 /* Solaris-specific. */
214#define AUE_SETUID 200 /* XXXRW: Solaris old setuid? */
215#define AUE_STIME 201 /* XXXRW: Solaris old stime? */
216#define AUE_UTIME 202 /* XXXRW: Solaris old utime? */
217#define AUE_NICE 203 /* XXXRW: Solaris old nice? */
218#define AUE_OSETPGRP 204 /* Solaris-specific. */
219#define AUE_SETGID 205
220#define AUE_READL 206 /* Solaris-specific. */
221#define AUE_READVL 207 /* Solaris-specific. */
222#define AUE_FSTAT 208
223#define AUE_DUP2 209
224#define AUE_MMAP 210
225#define AUE_AUDIT 211
226#define AUE_PRIOCNTLSYS 212 /* Solaris-specific. */
227#define AUE_MUNMAP 213
228#define AUE_SETEGID 214
229#define AUE_SETEUID 215
230#define AUE_PUTMSG 216 /* Solaris-specific. */
231#define AUE_GETMSG 217 /* Solaris-specific. */
232#define AUE_PUTPMSG 218 /* Solaris-specific. */
233#define AUE_GETPMSG 219 /* Solaris-specific. */
234#define AUE_AUDITSYS 220 /* Solaris-specific. */
235#define AUE_AUDITON_GETKMASK 221
236#define AUE_AUDITON_SETKMASK 222
237#define AUE_AUDITON_GETCWD 223
238#define AUE_AUDITON_GETCAR 224
239#define AUE_AUDITON_GETSTAT 225
240#define AUE_AUDITON_SETSTAT 226
241#define AUE_AUDITON_SETUMASK 227
242#define AUE_AUDITON_SETSMASK 228
243#define AUE_AUDITON_GETCOND 229
244#define AUE_AUDITON_SETCOND 230
245#define AUE_AUDITON_GETCLASS 231
246#define AUE_AUDITON_SETCLASS 232
247#define AUE_FUSERS 233 /* Solaris-specific; also UTSSYS? */
248#define AUE_STATVFS 234
249#define AUE_XSTAT 235 /* Solaris-specific. */
250#define AUE_LXSTAT 236 /* Solaris-specific. */
251#define AUE_LCHOWN 237
252#define AUE_MEMCNTL 238 /* Solaris-specific. */
253#define AUE_SYSINFO 239 /* Solaris-specific. */
254#define AUE_XMKNOD 240 /* Solaris-specific. */
255#define AUE_FORK1 241
256#define AUE_MODCTL 242 /* Solaris-specific. */
257#define AUE_MODLOAD 243
258#define AUE_MODUNLOAD 244
259#define AUE_MODCONFIG 245 /* Solaris-specific. */
260#define AUE_MODADDMAJ 246 /* Solaris-specific. */
261#define AUE_SOCKACCEPT 247 /* Solaris-specific. */
262#define AUE_SOCKCONNECT 248 /* Solaris-specific. */
263#define AUE_SOCKSEND 249 /* Solaris-specific. */
264#define AUE_SOCKRECEIVE 250 /* Solaris-specific. */
265#define AUE_ACLSET 251
266#define AUE_FACLSET 252
267#define AUE_DOORFS 253 /* Solaris-specific. */
268#define AUE_DOORFS_DOOR_CALL 254 /* Solaris-specific. */
269#define AUE_DOORFS_DOOR_RETURN 255 /* Solaris-specific. */
270#define AUE_DOORFS_DOOR_CREATE 256 /* Solaris-specific. */
271#define AUE_DOORFS_DOOR_REVOKE 257 /* Solaris-specific. */
272#define AUE_DOORFS_DOOR_INFO 258 /* Solaris-specific. */
273#define AUE_DOORFS_DOOR_CRED 259 /* Solaris-specific. */
274#define AUE_DOORFS_DOOR_BIND 260 /* Solaris-specific. */
275#define AUE_DOORFS_DOOR_UNBIND 261 /* Solaris-specific. */
276#define AUE_P_ONLINE 262 /* Solaris-specific. */
277#define AUE_PROCESSOR_BIND 263 /* Solaris-specific. */
278#define AUE_INST_SYNC 264 /* Solaris-specific. */
279#define AUE_SOCKCONFIG 265 /* Solaris-specific. */
280#define AUE_SETAUDIT_ADDR 266
281#define AUE_GETAUDIT_ADDR 267
282#define AUE_UMOUNT2 268 /* Solaris-specific. */
283#define AUE_FSAT 269 /* Solaris-specific. */
284#define AUE_OPENAT_R 270
285#define AUE_OPENAT_RC 271
286#define AUE_OPENAT_RT 272
287#define AUE_OPENAT_RTC 273
288#define AUE_OPENAT_W 274
289#define AUE_OPENAT_WC 275
290#define AUE_OPENAT_WT 276
291#define AUE_OPENAT_WTC 277
292#define AUE_OPENAT_RW 278
293#define AUE_OPENAT_RWC 279
294#define AUE_OPENAT_RWT 280
295#define AUE_OPENAT_RWTC 281
296#define AUE_RENAMEAT 282
297#define AUE_FSTATAT 283
298#define AUE_FCHOWNAT 284
299#define AUE_FUTIMESAT 285
300#define AUE_UNLINKAT 286
301#define AUE_CLOCK_SETTIME 287
302#define AUE_NTP_ADJTIME 288
303#define AUE_SETPPRIV 289 /* Solaris-specific. */
304#define AUE_MODDEVPLCY 290 /* Solaris-specific. */
305#define AUE_MODADDPRIV 291 /* Solaris-specific. */
306#define AUE_CRYPTOADM 292 /* Solaris-specific. */
307#define AUE_CONFIGKSSL 293 /* Solaris-specific. */
308#define AUE_BRANDSYS 294 /* Solaris-specific. */
309#define AUE_PF_POLICY_ADDRULE 295 /* Solaris-specific. */
310#define AUE_PF_POLICY_DELRULE 296 /* Solaris-specific. */
311#define AUE_PF_POLICY_CLONE 297 /* Solaris-specific. */
312#define AUE_PF_POLICY_FLIP 298 /* Solaris-specific. */
313#define AUE_PF_POLICY_FLUSH 299 /* Solaris-specific. */
314#define AUE_PF_POLICY_ALGS 300 /* Solaris-specific. */
315#define AUE_PORTFS 301 /* Solaris-specific. */
316
317/*
318 * Events added for Apple Darwin that potentially collide with future Solaris
319 * BSM events. These are assigned AUE_DARWIN prefixes, and are deprecated in
320 * new trails. Systems generating these events should switch to the new
321 * identifiers that avoid colliding with the Solaris identifier space.
322 */
323#define AUE_DARWIN_GETFSSTAT 301
324#define AUE_DARWIN_PTRACE 302
325#define AUE_DARWIN_CHFLAGS 303
326#define AUE_DARWIN_FCHFLAGS 304
327#define AUE_DARWIN_PROFILE 305
328#define AUE_DARWIN_KTRACE 306
329#define AUE_DARWIN_SETLOGIN 307
330#define AUE_DARWIN_REBOOT 308
331#define AUE_DARWIN_REVOKE 309
332#define AUE_DARWIN_UMASK 310
333#define AUE_DARWIN_MPROTECT 311
334#define AUE_DARWIN_SETPRIORITY 312
335#define AUE_DARWIN_SETTIMEOFDAY 313
336#define AUE_DARWIN_FLOCK 314
337#define AUE_DARWIN_MKFIFO 315
338#define AUE_DARWIN_POLL 316
339#define AUE_DARWIN_SOCKETPAIR 317
340#define AUE_DARWIN_FUTIMES 318
341#define AUE_DARWIN_SETSID 319
342#define AUE_DARWIN_SETPRIVEXEC 320 /* Darwin-specific. */
343#define AUE_DARWIN_NFSSVC 321
344#define AUE_DARWIN_GETFH 322
345#define AUE_DARWIN_QUOTACTL 323
346#define AUE_DARWIN_ADDPROFILE 324 /* Darwin-specific. */
347#define AUE_DARWIN_KDEBUGTRACE 325 /* Darwin-specific. */
348#define AUE_DARWIN_KDBUGTRACE AUE_KDEBUGTRACE
349#define AUE_DARWIN_FSTAT 326
350#define AUE_DARWIN_FPATHCONF 327
351#define AUE_DARWIN_GETDIRENTRIES 328
352#define AUE_DARWIN_TRUNCATE 329
353#define AUE_DARWIN_FTRUNCATE 330
354#define AUE_DARWIN_SYSCTL 331
355#define AUE_DARWIN_MLOCK 332
356#define AUE_DARWIN_MUNLOCK 333
357#define AUE_DARWIN_UNDELETE 334
358#define AUE_DARWIN_GETATTRLIST 335 /* Darwin-specific. */
359#define AUE_DARWIN_SETATTRLIST 336 /* Darwin-specific. */
360#define AUE_DARWIN_GETDIRENTRIESATTR 337 /* Darwin-specific. */
361#define AUE_DARWIN_EXCHANGEDATA 338 /* Darwin-specific. */
362#define AUE_DARWIN_SEARCHFS 339 /* Darwin-specific. */
363#define AUE_DARWIN_MINHERIT 340
364#define AUE_DARWIN_SEMCONFIG 341
365#define AUE_DARWIN_SEMOPEN 342
366#define AUE_DARWIN_SEMCLOSE 343
367#define AUE_DARWIN_SEMUNLINK 344
368#define AUE_DARWIN_SHMOPEN 345
369#define AUE_DARWIN_SHMUNLINK 346
370#define AUE_DARWIN_LOADSHFILE 347 /* Darwin-specific. */
371#define AUE_DARWIN_RESETSHFILE 348 /* Darwin-specific. */
372#define AUE_DARWIN_NEWSYSTEMSHREG 349 /* Darwin-specific. */
373#define AUE_DARWIN_PTHREADKILL 350 /* Darwin-specific. */
374#define AUE_DARWIN_PTHREADSIGMASK 351 /* Darwin-specific. */
375#define AUE_DARWIN_AUDITCTL 352
376#define AUE_DARWIN_RFORK 353
377#define AUE_DARWIN_LCHMOD 354
378#define AUE_DARWIN_SWAPOFF 355
379#define AUE_DARWIN_INITPROCESS 356 /* Darwin-specific. */
380#define AUE_DARWIN_MAPFD 357 /* Darwin-specific. */
381#define AUE_DARWIN_TASKFORPID 358 /* Darwin-specific. */
382#define AUE_DARWIN_PIDFORTASK 359 /* Darwin-specific. */
383#define AUE_DARWIN_SYSCTL_NONADMIN 360
384#define AUE_DARWIN_COPYFILE 361 /* Darwin-specific. */
385
386/*
387 * Audit event identifiers added as part of OpenBSM, generally corresponding
388 * to events in FreeBSD, Darwin, and Linux that were not present in Solaris.
389 * These often duplicate events added to the Solaris set by Darwin, but use
390 * event identifiers in a higher range in order to avoid colliding with
391 * future Solaris additions.
392 *
393 * If an event in this section is later added to Solaris, we prefer the
394 * Solaris event identifier, and add _OPENBSM_ to the OpenBSM-specific
395 * identifier so that old trails can still be processed, but new trails use
396 * the Solaris identifier.
397 */
398#define AUE_GETFSSTAT 43001
399#define AUE_PTRACE 43002
400#define AUE_CHFLAGS 43003
401#define AUE_FCHFLAGS 43004
402#define AUE_PROFILE 43005
403#define AUE_KTRACE 43006
404#define AUE_SETLOGIN 43007
405#define AUE_OPENBSM_REVOKE 43008 /* Solaris event now preferred. */
406#define AUE_UMASK 43009
407#define AUE_MPROTECT 43010
408#define AUE_MKFIFO 43011
409#define AUE_POLL 43012
410#define AUE_FUTIMES 43013
411#define AUE_SETSID 43014
412#define AUE_SETPRIVEXEC 43015 /* Darwin-specific. */
413#define AUE_ADDPROFILE 43016 /* Darwin-specific. */
414#define AUE_KDEBUGTRACE 43017 /* Darwin-specific. */
415#define AUE_KDBUGTRACE AUE_KDEBUGTRACE
416#define AUE_OPENBSM_FSTAT 43018 /* Solaris event now preferred. */
417#define AUE_FPATHCONF 43019
418#define AUE_GETDIRENTRIES 43020
419#define AUE_SYSCTL 43021
420#define AUE_MLOCK 43022
421#define AUE_MUNLOCK 43023
422#define AUE_UNDELETE 43024
423#define AUE_GETATTRLIST 43025 /* Darwin-specific. */
424#define AUE_SETATTRLIST 43026 /* Darwin-specific. */
425#define AUE_GETDIRENTRIESATTR 43027 /* Darwin-specific. */
426#define AUE_EXCHANGEDATA 43028 /* Darwin-specific. */
427#define AUE_SEARCHFS 43029 /* Darwin-specific. */
428#define AUE_MINHERIT 43030
429#define AUE_SEMCONFIG 43031
430#define AUE_SEMOPEN 43032
431#define AUE_SEMCLOSE 43033
432#define AUE_SEMUNLINK 43034
433#define AUE_SHMOPEN 43035
434#define AUE_SHMUNLINK 43036
435#define AUE_LOADSHFILE 43037 /* Darwin-specific. */
436#define AUE_RESETSHFILE 43038 /* Darwin-specific. */
437#define AUE_NEWSYSTEMSHREG 43039 /* Darwin-specific. */
438#define AUE_PTHREADKILL 43040 /* Darwin-specific. */
439#define AUE_PTHREADSIGMASK 43041 /* Darwin-specific. */
440#define AUE_AUDITCTL 43042
441#define AUE_RFORK 43043
442#define AUE_LCHMOD 43044
443#define AUE_SWAPOFF 43045
444#define AUE_INITPROCESS 43046 /* Darwin-specific. */
445#define AUE_MAPFD 43047 /* Darwin-specific. */
446#define AUE_TASKFORPID 43048 /* Darwin-specific. */
447#define AUE_PIDFORTASK 43049 /* Darwin-specific. */
448#define AUE_SYSCTL_NONADMIN 43050
449#define AUE_COPYFILE 43051 /* Darwin-specific. */
450
451/*
452 * Events added to OpenBSM for FreeBSD and Linux; may also be used by Darwin
453 * in the future.
454 */
455#define AUE_LUTIMES 43052
456#define AUE_LCHFLAGS 43053 /* FreeBSD-specific. */
457#define AUE_SENDFILE 43054 /* BSD/Linux-specific. */
458#define AUE_USELIB 43055 /* Linux-specific. */
459#define AUE_GETRESUID 43056
460#define AUE_SETRESUID 43057
461#define AUE_GETRESGID 43058
462#define AUE_SETRESGID 43059
463#define AUE_WAIT4 43060 /* FreeBSD-specific. */
464#define AUE_LGETFH 43061 /* FreeBSD-specific. */
465#define AUE_FHSTATFS 43062 /* FreeBSD-specific. */
466#define AUE_FHOPEN 43063 /* FreeBSD-specific. */
467#define AUE_FHSTAT 43064 /* FreeBSD-specific. */
468#define AUE_JAIL 43065 /* FreeBSD-specific. */
469#define AUE_EACCESS 43066 /* FreeBSD-specific. */
470#define AUE_KQUEUE 43067 /* FreeBSD-specific. */
471#define AUE_KEVENT 43068 /* FreeBSD-specific. */
472#define AUE_FSYNC 43069
473#define AUE_NMOUNT 43070 /* FreeBSD-specific. */
474#define AUE_BDFLUSH 43071 /* Linux-specific. */
475#define AUE_SETFSUID 43072 /* Linux-specific. */
476#define AUE_SETFSGID 43073 /* Linux-specific. */
477#define AUE_PERSONALITY 43074 /* Linux-specific. */
478#define AUE_SCHED_GETSCHEDULER 43075 /* POSIX.1b. */
479#define AUE_SCHED_SETSCHEDULER 43076 /* POSIX.1b. */
480#define AUE_PRCTL 43077 /* Linux-specific. */
481#define AUE_GETCWD 43078 /* FreeBSD/Linux-specific. */
482#define AUE_CAPGET 43079 /* Linux-specific. */
483#define AUE_CAPSET 43080 /* Linux-specific. */
484#define AUE_PIVOT_ROOT 43081 /* Linux-specific. */
485#define AUE_RTPRIO 43082 /* FreeBSD-specific. */
486#define AUE_SCHED_GETPARAM 43083 /* POSIX.1b. */
487#define AUE_SCHED_SETPARAM 43084 /* POSIX.1b. */
488#define AUE_SCHED_GET_PRIORITY_MAX 43085 /* POSIX.1b. */
489#define AUE_SCHED_GET_PRIORITY_MIN 43086 /* POSIX.1b. */
490#define AUE_SCHED_RR_GET_INTERVAL 43087 /* POSIX.1b. */
491#define AUE_ACL_GET_FILE 43088 /* FreeBSD. */
492#define AUE_ACL_SET_FILE 43089 /* FreeBSD. */
493#define AUE_ACL_GET_FD 43090 /* FreeBSD. */
494#define AUE_ACL_SET_FD 43091 /* FreeBSD. */
495#define AUE_ACL_DELETE_FILE 43092 /* FreeBSD. */
496#define AUE_ACL_DELETE_FD 43093 /* FreeBSD. */
497#define AUE_ACL_CHECK_FILE 43094 /* FreeBSD. */
498#define AUE_ACL_CHECK_FD 43095 /* FreeBSD. */
499#define AUE_ACL_GET_LINK 43096 /* FreeBSD. */
500#define AUE_ACL_SET_LINK 43097 /* FreeBSD. */
501#define AUE_ACL_DELETE_LINK 43098 /* FreeBSD. */
502#define AUE_ACL_CHECK_LINK 43099 /* FreeBSD. */
503#define AUE_SYSARCH 43100 /* FreeBSD. */
504#define AUE_EXTATTRCTL 43101 /* FreeBSD. */
505#define AUE_EXTATTR_GET_FILE 43102 /* FreeBSD. */
506#define AUE_EXTATTR_SET_FILE 43103 /* FreeBSD. */
507#define AUE_EXTATTR_LIST_FILE 43104 /* FreeBSD. */
508#define AUE_EXTATTR_DELETE_FILE 43105 /* FreeBSD. */
509#define AUE_EXTATTR_GET_FD 43106 /* FreeBSD. */
510#define AUE_EXTATTR_SET_FD 43107 /* FreeBSD. */
511#define AUE_EXTATTR_LIST_FD 43108 /* FreeBSD. */
512#define AUE_EXTATTR_DELETE_FD 43109 /* FreeBSD. */
513#define AUE_EXTATTR_GET_LINK 43110 /* FreeBSD. */
514#define AUE_EXTATTR_SET_LINK 43111 /* FreeBSD. */
515#define AUE_EXTATTR_LIST_LINK 43112 /* FreeBSD. */
516#define AUE_EXTATTR_DELETE_LINK 43113 /* FreeBSD. */
517#define AUE_KENV 43114 /* FreeBSD. */
518#define AUE_JAIL_ATTACH 43115 /* FreeBSD. */
519#define AUE_SYSCTL_WRITE 43116 /* FreeBSD. */
520#define AUE_IOPERM 43117 /* Linux. */
521#define AUE_READDIR 43118 /* Linux. */
522#define AUE_IOPL 43119 /* Linux. */
523#define AUE_VM86 43120 /* Linux. */
524#define AUE_MAC_GET_PROC 43121 /* FreeBSD/Darwin. */
525#define AUE_MAC_SET_PROC 43122 /* FreeBSD/Darwin. */
526#define AUE_MAC_GET_FD 43123 /* FreeBSD/Darwin. */
527#define AUE_MAC_GET_FILE 43124 /* FreeBSD/Darwin. */
528#define AUE_MAC_SET_FD 43125 /* FreeBSD/Darwin. */
529#define AUE_MAC_SET_FILE 43126 /* FreeBSD/Darwin. */
530#define AUE_MAC_SYSCALL 43127 /* FreeBSD. */
531#define AUE_MAC_GET_PID 43128 /* FreeBSD/Darwin. */
532#define AUE_MAC_GET_LINK 43129 /* FreeBSD/Darwin. */
533#define AUE_MAC_SET_LINK 43130 /* FreeBSD/Darwin. */
534#define AUE_MAC_EXECVE 43131 /* FreeBSD/Darwin. */
535#define AUE_GETPATH_FROMFD 43132 /* FreeBSD. */
536#define AUE_GETPATH_FROMADDR 43133 /* FreeBSD. */
537#define AUE_MQ_OPEN 43134 /* FreeBSD. */
538#define AUE_MQ_SETATTR 43135 /* FreeBSD. */
539#define AUE_MQ_TIMEDRECEIVE 43136 /* FreeBSD. */
540#define AUE_MQ_TIMEDSEND 43137 /* FreeBSD. */
541#define AUE_MQ_NOTIFY 43138 /* FreeBSD. */
542#define AUE_MQ_UNLINK 43139 /* FreeBSD. */
543#define AUE_LISTEN 43140 /* FreeBSD/Darwin/Linux. */
544#define AUE_MLOCKALL 43141 /* FreeBSD. */
545#define AUE_MUNLOCKALL 43142 /* FreeBSD. */
546#define AUE_CLOSEFROM 43143 /* FreeBSD. */
547#define AUE_FEXECVE 43144 /* FreeBSD. */
548#define AUE_FACCESSAT 43145 /* FreeBSD. */
549#define AUE_FCHMODAT 43146 /* FreeBSD. */
550#define AUE_LINKAT 43147 /* FreeBSD. */
551#define AUE_MKDIRAT 43148 /* FreeBSD. */
552#define AUE_MKFIFOAT 43149 /* FreeBSD. */
553#define AUE_MKNODAT 43150 /* FreeBSD. */
554#define AUE_READLINKAT 43151 /* FreeBSD. */
555#define AUE_SYMLINKAT 43152 /* FreeBSD. */
556#define AUE_MAC_GETFSSTAT 43153 /* Darwin. */
557#define AUE_MAC_GET_MOUNT 43154 /* Darwin. */
558#define AUE_MAC_GET_LCID 43155 /* Darwin. */
559#define AUE_MAC_GET_LCTX 43156 /* Darwin. */
560#define AUE_MAC_SET_LCTX 43157 /* Darwin. */
561#define AUE_MAC_MOUNT 43158 /* Darwin. */
562#define AUE_GETLCID 43159 /* Darwin. */
563#define AUE_SETLCID 43160 /* Darwin. */
564#define AUE_TASKNAMEFORPID 43161 /* Darwin. */
565#define AUE_ACCESS_EXTENDED 43162 /* Darwin. */
566#define AUE_CHMOD_EXTENDED 43163 /* Darwin. */
567#define AUE_FCHMOD_EXTENDED 43164 /* Darwin. */
568#define AUE_FSTAT_EXTENDED 43165 /* Darwin. */
569#define AUE_LSTAT_EXTENDED 43166 /* Darwin. */
570#define AUE_MKDIR_EXTENDED 43167 /* Darwin. */
571#define AUE_MKFIFO_EXTENDED 43168 /* Darwin. */
572#define AUE_OPEN_EXTENDED 43169 /* Darwin. */
573#define AUE_OPEN_EXTENDED_R 43170 /* Darwin. */
574#define AUE_OPEN_EXTENDED_RC 43171 /* Darwin. */
575#define AUE_OPEN_EXTENDED_RT 43172 /* Darwin. */
576#define AUE_OPEN_EXTENDED_RTC 43173 /* Darwin. */
577#define AUE_OPEN_EXTENDED_W 43174 /* Darwin. */
578#define AUE_OPEN_EXTENDED_WC 43175 /* Darwin. */
579#define AUE_OPEN_EXTENDED_WT 43176 /* Darwin. */
580#define AUE_OPEN_EXTENDED_WTC 43177 /* Darwin. */
581#define AUE_OPEN_EXTENDED_RW 43178 /* Darwin. */
582#define AUE_OPEN_EXTENDED_RWC 43179 /* Darwin. */
583#define AUE_OPEN_EXTENDED_RWT 43180 /* Darwin. */
584#define AUE_OPEN_EXTENDED_RWTC 43181 /* Darwin. */
585#define AUE_STAT_EXTENDED 43182 /* Darwin. */
586#define AUE_UMASK_EXTENDED 43183 /* Darwin. */
587#define AUE_OPENAT 43184 /* FreeBSD. */
588#define AUE_POSIX_OPENPT 43185 /* FreeBSD. */
589#define AUE_CAP_NEW 43186 /* TrustedBSD. */
590#define AUE_CAP_RIGHTS_GET 43187 /* TrustedBSD. */
591#define AUE_CAP_GETRIGHTS AUE_CAP_RIGHTS_GET
592#define AUE_CAP_ENTER 43188 /* TrustedBSD. */
593#define AUE_CAP_GETMODE 43189 /* TrustedBSD. */
594#define AUE_POSIX_SPAWN 43190 /* Darwin. */
595#define AUE_FSGETPATH 43191 /* Darwin. */
596#define AUE_PREAD 43192 /* Darwin/FreeBSD. */
597#define AUE_PWRITE 43193 /* Darwin/FreeBSD. */
598#define AUE_FSCTL 43194 /* Darwin. */
599#define AUE_FFSCTL 43195 /* Darwin. */
600#define AUE_LPATHCONF 43196 /* FreeBSD. */
601#define AUE_PDFORK 43197 /* FreeBSD. */
602#define AUE_PDKILL 43198 /* FreeBSD. */
603#define AUE_PDGETPID 43199 /* FreeBSD. */
604#define AUE_PDWAIT 43200 /* FreeBSD. */
605#define AUE_WAIT6 43201 /* FreeBSD. */
606#define AUE_CAP_RIGHTS_LIMIT 43202 /* TrustedBSD. */
607#define AUE_CAP_IOCTLS_LIMIT 43203 /* TrustedBSD. */
608#define AUE_CAP_IOCTLS_GET 43204 /* TrustedBSD. */
609#define AUE_CAP_FCNTLS_LIMIT 43205 /* TrustedBSD. */
610#define AUE_CAP_FCNTLS_GET 43206 /* TrustedBSD. */
611#define AUE_BINDAT 43207 /* TrustedBSD. */
612#define AUE_CONNECTAT 43208 /* TrustedBSD. */
613#define AUE_CHFLAGSAT 43209 /* FreeBSD-specific. */
614#define AUE_PREADV 43210 /* FreeBSD-specific. */
615#define AUE_PWRITEV 43211 /* FreeBSD-specific. */
616#define AUE_POSIX_FALLOCATE 43212 /* FreeBSD-specific. */
617#define AUE_AIO_MLOCK 43213 /* FreeBSD-specific. */
618#define AUE_PROCCTL 43214 /* FreeBSD-specific. */
619#define AUE_AIO_READ 43215 /* FreeBSD-specific. */
620#define AUE_AIO_WRITE 43216 /* FreeBSD-specific. */
621#define AUE_AIO_RETURN 43217 /* FreeBSD-specific. */
622#define AUE_AIO_SUSPEND 43218 /* FreeBSD-specific. */
623#define AUE_AIO_CANCEL 43219 /* FreeBSD-specific. */
624#define AUE_AIO_ERROR 43220 /* FreeBSD-specific. */
625#define AUE_AIO_WAITCOMPLETE 43221 /* FreeBSD-specific. */
626#define AUE_AIO_FSYNC 43222 /* FreeBSD-specific. */
627#define AUE_THR_CREATE 43223 /* FreeBSD-specific. */
628#define AUE_THR_NEW 43224 /* FreeBSD-specific. */
629#define AUE_THR_EXIT 43225 /* FreeBSD-specific. */
630#define AUE_THR_KILL 43226 /* FreeBSD-specific. */
631#define AUE_THR_KILL2 43227 /* FreeBSD-specific. */
632#define AUE_SETFIB 43228 /* FreeBSD-specific. */
633#define AUE_LIO_LISTIO 43229 /* FreeBSD-specific. */
634#define AUE_SETUGID 43230 /* FreeBSD-specific. */
635#define AUE_SCTP_PEELOFF 43231 /* FreeBSD-specific. */
636#define AUE_SCTP_GENERIC_SENDMSG 43232 /* FreeBSD-specific. */
637#define AUE_SCTP_GENERIC_RECVMSG 43233 /* FreeBSD-specific. */
638#define AUE_JAIL_GET 43234 /* FreeBSD-specific. */
639#define AUE_JAIL_SET 43235 /* FreeBSD-specific. */
640#define AUE_JAIL_REMOVE 43236 /* FreeBSD-specific. */
641#define AUE_GETLOGINCLASS 43237 /* FreeBSD-specific. */
642#define AUE_SETLOGINCLASS 43238 /* FreeBSD-specific. */
643#define AUE_POSIX_FADVISE 43239 /* FreeBSD-specific. */
644#define AUE_SCTP_GENERIC_SENDMSG_IOV 43240 /* FreeBSD-specific. */
645#define AUE_ABORT2 43241 /* FreeBSD-specific. */
646#define AUE_SEMTIMEDWAIT 43242 /* FreeBSD-specific. */
647#define AUE_SEMDESTROY 43243 /* FreeBSD-specific. */
648#define AUE_SEMGETVALUE 43244 /* FreeBSD-specific. */
649#define AUE_SEMINIT 43245 /* FreeBSD-specific. */
650#define AUE_SEMPOST 43246 /* FreeBSD-specific. */
651#define AUE_SEMTRYWAIT 43247 /* FreeBSD-specific. */
652#define AUE_SEMWAIT 43258 /* FreeBSD-specific. */
653#define AUE_FGETUUID 43259 /* CADETS. */
654#define AUE_GETUUID 43260 /* CADETS. */
655#define AUE_LGETUUID 43261 /* CADETS. */
656#define AUE_EXECVEAT 43262 /* FreeBSD/Linux. */
657#define AUE_SHMRENAME 43263 /* FreeBSD-specific. */
658#define AUE_REALPATHAT 43264 /* FreeBSD-specific. */
659#define AUE_CLOSERANGE 43265 /* FreeBSD-specific. */
660#define AUE_SPECIALFD 43266 /* FreeBSD-specific. */
661#define AUE_AIO_WRITEV 43267 /* FreeBSD-specific. */
662#define AUE_AIO_READV 43268 /* FreeBSD-specific. */
663#define AUE_FSPACECTL 43269 /* FreeBSD-specific. */
664#define AUE_TIMERFD 43270 /* FreeBSD/Linux. */
665#define AUE_SETCRED 43271 /* FreeBSD-specific. */
666#define AUE_INOTIFY 43272 /* FreeBSD/Linux. */
667
668/*
669 * Darwin BSM uses a number of AUE_O_* definitions, which are aliased to the
670 * normal Solaris BSM identifiers. _O_ refers to it being an old, or compat
671 * interface. In most cases, Darwin has never implemented these system calls
672 * but picked up the fields in their system call table from their FreeBSD
673 * import. Happily, these have different names than the AUE_O* definitions
674 * in Solaris BSM.
675 */
676#define AUE_O_CREAT AUE_OPEN_RWTC /* Darwin */
677#define AUE_O_EXECVE AUE_NULL /* Darwin */
678#define AUE_O_SBREAK AUE_NULL /* Darwin */
679#define AUE_O_LSEEK AUE_NULL /* Darwin */
680#define AUE_O_MOUNT AUE_NULL /* Darwin */
681#define AUE_O_UMOUNT AUE_NULL /* Darwin */
682#define AUE_O_STAT AUE_STAT /* Darwin */
683#define AUE_O_LSTAT AUE_LSTAT /* Darwin */
684#define AUE_O_FSTAT AUE_FSTAT /* Darwin */
685#define AUE_O_GETPAGESIZE AUE_NULL /* Darwin */
686#define AUE_O_VREAD AUE_NULL /* Darwin */
687#define AUE_O_VWRITE AUE_NULL /* Darwin */
688#define AUE_O_MMAP AUE_MMAP /* Darwin */
689#define AUE_O_VADVISE AUE_NULL /* Darwin */
690#define AUE_O_VHANGUP AUE_NULL /* Darwin */
691#define AUE_O_VLIMIT AUE_NULL /* Darwin */
692#define AUE_O_WAIT AUE_NULL /* Darwin */
693#define AUE_O_GETHOSTNAME AUE_NULL /* Darwin */
694#define AUE_O_SETHOSTNAME AUE_SYSCTL /* Darwin */
695#define AUE_O_GETDOPT AUE_NULL /* Darwin */
696#define AUE_O_SETDOPT AUE_NULL /* Darwin */
697#define AUE_O_ACCEPT AUE_NULL /* Darwin */
698#define AUE_O_SEND AUE_SENDMSG /* Darwin */
699#define AUE_O_RECV AUE_RECVMSG /* Darwin */
700#define AUE_O_VTIMES AUE_NULL /* Darwin */
701#define AUE_O_SIGVEC AUE_NULL /* Darwin */
702#define AUE_O_SIGBLOCK AUE_NULL /* Darwin */
703#define AUE_O_SIGSETMASK AUE_NULL /* Darwin */
704#define AUE_O_SIGSTACK AUE_NULL /* Darwin */
705#define AUE_O_RECVMSG AUE_RECVMSG /* Darwin */
706#define AUE_O_SENDMSG AUE_SENDMSG /* Darwin */
707#define AUE_O_VTRACE AUE_NULL /* Darwin */
708#define AUE_O_RESUBA AUE_NULL /* Darwin */
709#define AUE_O_RECVFROM AUE_RECVFROM /* Darwin */
710#define AUE_O_SETREUID AUE_SETREUID /* Darwin */
711#define AUE_O_SETREGID AUE_SETREGID /* Darwin */
712#define AUE_O_GETDIRENTRIES AUE_GETDIRENTRIES /* Darwin */
713#define AUE_O_TRUNCATE AUE_TRUNCATE /* Darwin */
714#define AUE_O_FTRUNCATE AUE_FTRUNCATE /* Darwin */
715#define AUE_O_GETPEERNAME AUE_NULL /* Darwin */
716#define AUE_O_GETHOSTID AUE_NULL /* Darwin */
717#define AUE_O_SETHOSTID AUE_NULL /* Darwin */
718#define AUE_O_GETRLIMIT AUE_NULL /* Darwin */
719#define AUE_O_SETRLIMIT AUE_SETRLIMIT /* Darwin */
720#define AUE_O_KILLPG AUE_KILL /* Darwin */
721#define AUE_O_SETQUOTA AUE_NULL /* Darwin */
722#define AUE_O_QUOTA AUE_NULL /* Darwin */
723#define AUE_O_GETSOCKNAME AUE_NULL /* Darwin */
724#define AUE_O_GETDIREENTRIES AUE_GETDIREENTRIES /* Darwin */
725#define AUE_O_ASYNCDAEMON AUE_NULL /* Darwin */
726#define AUE_O_GETDOMAINNAME AUE_NULL /* Darwin */
727#define AUE_O_SETDOMAINNAME AUE_SYSCTL /* Darwin */
728#define AUE_O_PCFS_MOUNT AUE_NULL /* Darwin */
729#define AUE_O_EXPORTFS AUE_NULL /* Darwin */
730#define AUE_O_USTATE AUE_NULL /* Darwin */
731#define AUE_O_WAIT3 AUE_NULL /* Darwin */
732#define AUE_O_RPAUSE AUE_NULL /* Darwin */
733#define AUE_O_GETDENTS AUE_NULL /* Darwin */
734
735/*
736 * Possible desired future values based on review of BSD/Darwin system calls.
737 */
738#define AUE_ATGETMSG AUE_NULL
739#define AUE_ATPUTMSG AUE_NULL
740#define AUE_ATSOCKET AUE_NULL
741#define AUE_ATPGETREQ AUE_NULL
742#define AUE_ATPGETRSP AUE_NULL
743#define AUE_ATPSNDREQ AUE_NULL
744#define AUE_ATPSNDRSP AUE_NULL
745#define AUE_BSDTHREADCREATE AUE_NULL
746#define AUE_BSDTHREADTERMINATE AUE_NULL
747#define AUE_BSDTHREADREGISTER AUE_NULL
748#define AUE_CHUD AUE_NULL
749#define AUE_CSOPS AUE_NULL
750#define AUE_DUP AUE_NULL
751#define AUE_FDATASYNC AUE_NULL
752#define AUE_FGETATTRLIST AUE_NULL
753#define AUE_FGETXATTR AUE_NULL
754#define AUE_FLISTXATTR AUE_NULL
755#define AUE_FREMOVEXATTR AUE_NULL
756#define AUE_FSETATTRLIST AUE_NULL
757#define AUE_FSETXATTR AUE_NULL
758#define AUE_FSTATFS64 AUE_NULL
759#define AUE_FSTATV AUE_NULL
760#define AUE_FSTAT64 AUE_NULL
761#define AUE_FSTAT64_EXTENDED AUE_NULL
762#define AUE_GCCONTROL AUE_NULL
763#define AUE_GETDIRENTRIES64 AUE_NULL
764#define AUE_GETDTABLESIZE AUE_NULL
765#define AUE_GETEGID AUE_NULL
766#define AUE_GETEUID AUE_NULL
767#define AUE_GETFSSTAT64 AUE_NULL
768#define AUE_GETGID AUE_NULL
769#define AUE_GETGROUPS AUE_NULL
770#define AUE_GETITIMER AUE_NULL
771#define AUE_GETLOGIN AUE_NULL
772#define AUE_GETPEERNAME AUE_NULL
773#define AUE_GETPGID AUE_NULL
774#define AUE_GETPGRP AUE_NULL
775#define AUE_GETPID AUE_NULL
776#define AUE_GETPPID AUE_NULL
777#define AUE_GETPRIORITY AUE_NULL
778#define AUE_GETRLIMIT AUE_NULL
779#define AUE_GETRUSAGE AUE_NULL
780#define AUE_GETSGROUPS AUE_NULL
781#define AUE_GETSID AUE_NULL
782#define AUE_GETSOCKNAME AUE_NULL
783#define AUE_GETTIMEOFDAY AUE_NULL
784#define AUE_GETTID AUE_NULL
785#define AUE_GETUID AUE_NULL
786#define AUE_GETSOCKOPT AUE_NULL
787#define AUE_GETWGROUPS AUE_NULL
788#define AUE_GETXATTR AUE_NULL
789#define AUE_IDENTITYSVC AUE_NULL
790#define AUE_INITGROUPS AUE_NULL
791#define AUE_IOPOLICYSYS AUE_NULL
792#define AUE_ISSETUGID AUE_NULL
793#define AUE_LIOLISTIO AUE_NULL
794#define AUE_LISTXATTR AUE_NULL
795#define AUE_LSTATV AUE_NULL
796#define AUE_LSTAT64 AUE_NULL
797#define AUE_LSTAT64_EXTENDED AUE_NULL
798#define AUE_MADVISE AUE_NULL
799#define AUE_MINCORE AUE_NULL
800#define AUE_MKCOMPLEX AUE_NULL
801#define AUE_MODWATCH AUE_NULL
802#define AUE_MSGCL AUE_NULL
803#define AUE_MSYNC AUE_NULL
804#define AUE_PROCINFO AUE_NULL
805#define AUE_PTHREADCANCELED AUE_NULL
806#define AUE_PTHREADCHDIR AUE_NULL
807#define AUE_PTHREADCONDBROADCAST AUE_NULL
808#define AUE_PTHREADCONDDESTORY AUE_NULL
809#define AUE_PTHREADCONDINIT AUE_NULL
810#define AUE_PTHREADCONDSIGNAL AUE_NULL
811#define AUE_PTHREADCONDWAIT AUE_NULL
812#define AUE_PTHREADFCHDIR AUE_NULL
813#define AUE_PTHREADMARK AUE_NULL
814#define AUE_PTHREADMUTEXDESTROY AUE_NULL
815#define AUE_PTHREADMUTEXINIT AUE_NULL
816#define AUE_PTHREADMUTEXTRYLOCK AUE_NULL
817#define AUE_PTHREADMUTEXUNLOCK AUE_NULL
818#define AUE_REMOVEXATTR AUE_NULL
819#define AUE_SBRK AUE_NULL
820#define AUE_SELECT AUE_NULL
821#define AUE_SEMWAITSIGNAL AUE_NULL
822#define AUE_SETITIMER AUE_NULL
823#define AUE_SETSGROUPS AUE_NULL
824#define AUE_SETTID AUE_NULL
825#define AUE_SETTIDWITHPID AUE_NULL
826#define AUE_SETWGROUPS AUE_NULL
827#define AUE_SETXATTR AUE_NULL
828#define AUE_SHAREDREGIONCHECK AUE_NULL
829#define AUE_SHAREDREGIONMAP AUE_NULL
830#define AUE_SIGACTION AUE_NULL
831#define AUE_SIGALTSTACK AUE_NULL
832#define AUE_SIGPENDING AUE_NULL
833#define AUE_SIGPROCMASK AUE_NULL
834#define AUE_SIGRETURN AUE_NULL
835#define AUE_SIGSUSPEND AUE_NULL
836#define AUE_SIGWAIT AUE_NULL
837#define AUE_SSTK AUE_NULL
838#define AUE_STACKSNAPSHOT AUE_NULL
839#define AUE_STATFS64 AUE_NULL
840#define AUE_STATV AUE_NULL
841#define AUE_STAT64 AUE_NULL
842#define AUE_STAT64_EXTENDED AUE_NULL
843#define AUE_SYNC AUE_NULL
844#define AUE_SYSCALL AUE_NULL
845#define AUE_TABLE AUE_NULL
846#define AUE_VMPRESSUREMONITOR AUE_NULL
847#define AUE_WAITEVENT AUE_NULL
848#define AUE_WAITID AUE_NULL
849#define AUE_WATCHEVENT AUE_NULL
850#define AUE_WORKQOPEN AUE_NULL
851#define AUE_WORKQOPS AUE_NULL
852
853#endif /* !_BSM_AUDIT_KEVENTS_H_ */
lib/libc/include/generic-freebsd/bsm/audit_record.h created+311
......@@ -0,0 +1,311 @@
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 2005-2009 Apple Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of Apple Inc. ("Apple") nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
21 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
24 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _BSM_AUDIT_RECORD_H_
33#define _BSM_AUDIT_RECORD_H_
34
35#include <sys/types.h>
36#include <sys/time.h> /* struct timeval */
37
38/*
39 * Token type identifiers.
40 */
41#define AUT_INVALID 0x00
42#define AUT_OTHER_FILE32 0x11
43#define AUT_OHEADER 0x12
44#define AUT_TRAILER 0x13
45#define AUT_HEADER32 0x14
46#define AUT_HEADER32_EX 0x15
47#define AUT_DATA 0x21
48#define AUT_IPC 0x22
49#define AUT_PATH 0x23
50#define AUT_SUBJECT32 0x24
51#define AUT_XATPATH 0x25
52#define AUT_PROCESS32 0x26
53#define AUT_RETURN32 0x27
54#define AUT_TEXT 0x28
55#define AUT_OPAQUE 0x29
56#define AUT_IN_ADDR 0x2a
57#define AUT_IP 0x2b
58#define AUT_IPORT 0x2c
59#define AUT_ARG32 0x2d
60#define AUT_SOCKET 0x2e
61#define AUT_SEQ 0x2f
62#define AUT_ACL 0x30
63#define AUT_ATTR 0x31
64#define AUT_IPC_PERM 0x32
65#define AUT_LABEL 0x33
66#define AUT_GROUPS 0x34
67#define AUT_ACE 0x35
68#define AUT_PRIV 0x38
69#define AUT_UPRIV 0x39
70#define AUT_LIAISON 0x3a
71#define AUT_NEWGROUPS 0x3b
72#define AUT_EXEC_ARGS 0x3c
73#define AUT_EXEC_ENV 0x3d
74#define AUT_ATTR32 0x3e
75#define AUT_UNAUTH 0x3f
76#define AUT_XATOM 0x40
77#define AUT_XOBJ 0x41
78#define AUT_XPROTO 0x42
79#define AUT_XSELECT 0x43
80#define AUT_XCOLORMAP 0x44
81#define AUT_XCURSOR 0x45
82#define AUT_XFONT 0x46
83#define AUT_XGC 0x47
84#define AUT_XPIXMAP 0x48
85#define AUT_XPROPERTY 0x49
86#define AUT_XWINDOW 0x4a
87#define AUT_XCLIENT 0x4b
88#define AUT_CMD 0x51
89#define AUT_EXIT 0x52
90#define AUT_ZONENAME 0x60
91#define AUT_HOST 0x70
92#define AUT_ARG64 0x71
93#define AUT_RETURN64 0x72
94#define AUT_ATTR64 0x73
95#define AUT_HEADER64 0x74
96#define AUT_SUBJECT64 0x75
97#define AUT_PROCESS64 0x77
98#define AUT_OTHER_FILE64 0x78
99#define AUT_HEADER64_EX 0x79
100#define AUT_SUBJECT32_EX 0x7a
101#define AUT_PROCESS32_EX 0x7b
102#define AUT_SUBJECT64_EX 0x7c
103#define AUT_PROCESS64_EX 0x7d
104#define AUT_IN_ADDR_EX 0x7e
105#define AUT_SOCKET_EX 0x7f
106
107/*
108 * Pre-64-bit BSM, 32-bit tokens weren't explicitly named as '32'. We have
109 * compatibility defines.
110 */
111#define AUT_HEADER AUT_HEADER32
112#define AUT_ARG AUT_ARG32
113#define AUT_RETURN AUT_RETURN32
114#define AUT_SUBJECT AUT_SUBJECT32
115#define AUT_PROCESS AUT_PROCESS32
116#define AUT_OTHER_FILE AUT_OTHER_FILE32
117
118/*
119 * The values for the following token ids are not defined by BSM.
120 *
121 * XXXRW: Not sure how to handle these in OpenBSM yet, but I'll give them
122 * names more consistent with Sun's BSM. These originally came from Apple's
123 * BSM.
124 */
125#define AUT_SOCKINET32 0x80 /* XXX */
126#define AUT_SOCKINET128 0x81 /* XXX */
127#define AUT_SOCKUNIX 0x82 /* XXX */
128
129#define AUT_RIGHTS 0x83
130
131/* print values for the arbitrary token */
132#define AUP_BINARY 0
133#define AUP_OCTAL 1
134#define AUP_DECIMAL 2
135#define AUP_HEX 3
136#define AUP_STRING 4
137
138/* data-types for the arbitrary token */
139#define AUR_BYTE 0
140#define AUR_CHAR AUR_BYTE
141#define AUR_SHORT 1
142#define AUR_INT32 2
143#define AUR_INT AUR_INT32
144#define AUR_INT64 3
145
146/* ... and their sizes */
147#define AUR_BYTE_SIZE sizeof(u_char)
148#define AUR_CHAR_SIZE AUR_BYTE_SIZE
149#define AUR_SHORT_SIZE sizeof(uint16_t)
150#define AUR_INT32_SIZE sizeof(uint32_t)
151#define AUR_INT_SIZE AUR_INT32_SIZE
152#define AUR_INT64_SIZE sizeof(uint64_t)
153
154/* Modifiers for the header token */
155#define PAD_NOTATTR 0x4000 /* nonattributable event */
156#define PAD_FAILURE 0x8000 /* fail audit event */
157
158#define AUDIT_MAX_GROUPS 16
159
160/*
161 * A number of BSM versions are floating around and defined. Here are
162 * constants for them. OpenBSM uses the same token types, etc, used in the
163 * Solaris BSM version, but has a separate version number in order to
164 * identify a potentially different event identifier name space.
165 */
166#define AUDIT_HEADER_VERSION_OLDDARWIN 1 /* In retrospect, a mistake. */
167#define AUDIT_HEADER_VERSION_SOLARIS 2
168#define AUDIT_HEADER_VERSION_TSOL25 3
169#define AUDIT_HEADER_VERSION_TSOL 4
170#define AUDIT_HEADER_VERSION_OPENBSM10 10
171#define AUDIT_HEADER_VERSION_OPENBSM11 11
172#define AUDIT_HEADER_VERSION_OPENBSM AUDIT_HEADER_VERSION_OPENBSM11
173
174#define AUT_TRAILER_MAGIC 0xb105
175
176/* BSM library calls */
177
178__BEGIN_DECLS
179
180struct in_addr;
181struct in6_addr;
182struct ip;
183struct ipc_perm;
184struct kevent;
185struct sockaddr;
186struct sockaddr_in;
187struct sockaddr_in6;
188struct sockaddr_un;
189#if defined(_KERNEL) || defined(KERNEL)
190struct vnode_au_info;
191#endif
192
193#ifndef _CAP_RIGHTS_T_DECLARED
194#define _CAP_RIGHTS_T_DECLARED
195struct cap_rights;
196
197typedef struct cap_rights cap_rights_t;
198#endif
199
200int au_open(void);
201int au_write(int d, token_t *m);
202int au_close(int d, int keep, short event);
203int au_close_buffer(int d, short event, u_char *buffer, size_t *buflen);
204int au_close_token(token_t *tok, u_char *buffer, size_t *buflen);
205
206token_t *au_to_file(const char *file, struct timeval tm);
207
208token_t *au_to_header32_tm(int rec_size, au_event_t e_type, au_emod_t e_mod,
209 struct timeval tm);
210token_t *au_to_header32_ex_tm(int rec_size, au_event_t e_type, au_emod_t e_mod,
211 struct timeval tm, struct auditinfo_addr *aia);
212token_t *au_to_header64_tm(int rec_size, au_event_t e_type, au_emod_t e_mod,
213 struct timeval tm);
214#if !defined(KERNEL) && !defined(_KERNEL)
215token_t *au_to_header(int rec_size, au_event_t e_type, au_emod_t e_mod);
216token_t *au_to_header_ex(int rec_size, au_event_t e_type, au_emod_t e_mod);
217token_t *au_to_header32(int rec_size, au_event_t e_type, au_emod_t e_mod);
218token_t *au_to_header64(int rec_size, au_event_t e_type, au_emod_t e_mod);
219token_t *au_to_header32_ex(int rec_size, au_event_t e_type, au_emod_t e_mod);
220#endif
221
222token_t *au_to_me(void);
223token_t *au_to_arg(char n, const char *text, uint32_t v);
224token_t *au_to_arg32(char n, const char *text, uint32_t v);
225token_t *au_to_arg64(char n, const char *text, uint64_t v);
226
227#if defined(_KERNEL) || defined(KERNEL)
228token_t *au_to_attr(struct vnode_au_info *vni);
229token_t *au_to_attr32(struct vnode_au_info *vni);
230token_t *au_to_attr64(struct vnode_au_info *vni);
231#endif
232
233token_t *au_to_data(char unit_print, char unit_type, char unit_count,
234 const char *p);
235token_t *au_to_exit(int retval, int err);
236token_t *au_to_groups(int *groups);
237token_t *au_to_newgroups(uint16_t n, gid_t *groups);
238token_t *au_to_in_addr(struct in_addr *internet_addr);
239token_t *au_to_in_addr_ex(struct in6_addr *internet_addr);
240token_t *au_to_ip(struct ip *ip);
241token_t *au_to_ipc(char type, int id);
242token_t *au_to_ipc_perm(struct ipc_perm *perm);
243token_t *au_to_iport(uint16_t iport);
244token_t *au_to_opaque(const char *data, uint16_t bytes);
245token_t *au_to_path(const char *path);
246token_t *au_to_privset(char *privtypestr, char *privstr);
247token_t *au_to_process(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid,
248 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_t *tid);
249token_t *au_to_process32(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid,
250 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_t *tid);
251token_t *au_to_process64(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid,
252 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_t *tid);
253token_t *au_to_process_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid,
254 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_addr_t *tid);
255token_t *au_to_process32_ex(au_id_t auid, uid_t euid, gid_t egid,
256 uid_t ruid, gid_t rgid, pid_t pid, au_asid_t sid,
257 au_tid_addr_t *tid);
258token_t *au_to_process64_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid,
259 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_addr_t *tid);
260token_t *au_to_rights(cap_rights_t *rightsp);
261token_t *au_to_return(char status, uint32_t ret);
262token_t *au_to_return32(char status, uint32_t ret);
263token_t *au_to_return64(char status, uint64_t ret);
264token_t *au_to_seq(long audit_count);
265token_t *au_to_socket_ex(u_short so_domain, u_short so_type,
266 struct sockaddr *sa_local, struct sockaddr *sa_remote);
267token_t *au_to_sock_inet(struct sockaddr_in *so);
268token_t *au_to_sock_inet32(struct sockaddr_in *so);
269token_t *au_to_sock_inet128(struct sockaddr_in6 *so);
270token_t *au_to_sock_unix(struct sockaddr_un *so);
271token_t *au_to_subject(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid,
272 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_t *tid);
273token_t *au_to_subject32(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid,
274 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_t *tid);
275token_t *au_to_subject64(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid,
276 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_t *tid);
277token_t *au_to_subject_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid,
278 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_addr_t *tid);
279token_t *au_to_subject32_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid,
280 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_addr_t *tid);
281token_t *au_to_subject64_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid,
282 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_addr_t *tid);
283#if defined(_KERNEL) || defined(KERNEL)
284token_t *au_to_exec_args(char *args, int argc);
285token_t *au_to_exec_env(char *envs, int envc);
286#else
287token_t *au_to_exec_args(char **argv);
288token_t *au_to_exec_env(char **envp);
289#endif
290token_t *au_to_text(const char *text);
291token_t *au_to_kevent(struct kevent *kev);
292token_t *au_to_trailer(int rec_size);
293token_t *au_to_upriv(char sorf, char *priv);
294token_t *au_to_zonename(const char *zonename);
295
296/*
297 * BSM library routines for converting between local and BSM constant spaces.
298 */
299int au_bsm_to_domain(u_short bsm_domain, int *local_domainp);
300int au_bsm_to_errno(u_char bsm_error, int *errorp);
301int au_bsm_to_fcntl_cmd(u_short bsm_fcntl_cmd, int *local_fcntl_cmdp);
302int au_bsm_to_socket_type(u_short bsm_socket_type,
303 int *local_socket_typep);
304u_short au_domain_to_bsm(int local_domain);
305u_char au_errno_to_bsm(int local_errno);
306u_short au_fcntl_cmd_to_bsm(int local_fcntl_command);
307u_short au_socket_type_to_bsm(int local_socket_type);
308
309__END_DECLS
310
311#endif /* ! _BSM_AUDIT_RECORD_H_ */
lib/libc/include/generic-freebsd/bsm/audit_socket_type.h created+46
......@@ -0,0 +1,46 @@
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 2008 Apple Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of Apple Inc. ("Apple") nor the names of
16 * its contributors may be used to endorse or promote products derived
17 * from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR
23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
28 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _BSM_AUDIT_SOCKET_TYPE_H_
33#define _BSM_AUDIT_SOCKET_TYPE_H_
34
35/*
36 * BSM socket type constants.
37 */
38#define BSM_SOCK_DGRAM 1
39#define BSM_SOCK_STREAM 2
40#define BSM_SOCK_RAW 4
41#define BSM_SOCK_RDM 5
42#define BSM_SOCK_SEQPACKET 6
43
44#define BSM_SOCK_UNKNOWN 500
45
46#endif /* !_BSM_AUDIT_SOCKET_TYPE_H_ */