1d874057dim//===-- sanitizer_platform_limits_freebsd.h -------------------------------===//
2d874057dim//
3d874057dim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4d874057dim// See https://llvm.org/LICENSE.txt for license information.
5d874057dim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6d874057dim//
7d874057dim//===----------------------------------------------------------------------===//
8d874057dim//
9d874057dim// This file is a part of Sanitizer common code.
10d874057dim//
11d874057dim// Sizes and layouts of platform-specific FreeBSD data structures.
12d874057dim//===----------------------------------------------------------------------===//
13d874057dim
14d874057dim#ifndef SANITIZER_PLATFORM_LIMITS_FREEBSD_H
15d874057dim#define SANITIZER_PLATFORM_LIMITS_FREEBSD_H
16d874057dim
17d874057dim#if SANITIZER_FREEBSD
18d874057dim
19d874057dim#include "sanitizer_internal_defs.h"
20d874057dim#include "sanitizer_platform.h"
21d874057dim#include "sanitizer_platform_limits_posix.h"
22d874057dim
23d874057dim// Get sys/_types.h, because that tells us whether 64-bit inodes are
24d874057dim// used in struct dirent below.
25d874057dim#include <sys/_types.h>
26d874057dim
27d874057dimnamespace __sanitizer {
28340097edimvoid *__sanitizer_get_link_map_by_dlopen_handle(void *handle);
29340097edim#define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) \
30340097edim  (link_map *)__sanitizer_get_link_map_by_dlopen_handle(handle)
31340097edim
32d874057dimextern unsigned struct_utsname_sz;
33d874057dimextern unsigned struct_stat_sz;
34d874057dim#if defined(__powerpc64__)
35d874057dimconst unsigned struct___old_kernel_stat_sz = 0;
36d874057dim#else
37d874057dimconst unsigned struct___old_kernel_stat_sz = 32;
38d874057dim#endif
39d874057dimextern unsigned struct_rusage_sz;
40d874057dimextern unsigned siginfo_t_sz;
41d874057dimextern unsigned struct_itimerval_sz;
42d874057dimextern unsigned pthread_t_sz;
43d874057dimextern unsigned pthread_mutex_t_sz;
44d874057dimextern unsigned pthread_cond_t_sz;
45d874057dimextern unsigned pid_t_sz;
46d874057dimextern unsigned timeval_sz;
47d874057dimextern unsigned uid_t_sz;
48d874057dimextern unsigned gid_t_sz;
49d874057dimextern unsigned fpos_t_sz;
50d874057dimextern unsigned mbstate_t_sz;
51d874057dimextern unsigned struct_timezone_sz;
52d874057dimextern unsigned struct_tms_sz;
53d874057dimextern unsigned struct_itimerspec_sz;
54d874057dimextern unsigned struct_sigevent_sz;
55340097edimextern unsigned struct_stack_t_sz;
56d874057dimextern unsigned struct_sched_param_sz;
57d874057dimextern unsigned struct_statfs64_sz;
58d874057dimextern unsigned struct_statfs_sz;
59d874057dimextern unsigned struct_sockaddr_sz;
60d874057dimextern unsigned ucontext_t_sz;
61d874057dimextern unsigned struct_rlimit_sz;
62d874057dimextern unsigned struct_utimbuf_sz;
63d874057dimextern unsigned struct_timespec_sz;
64d874057dimextern unsigned struct_regmatch_sz;
65d874057dimextern unsigned struct_regex_sz;
66d874057dimextern unsigned struct_FTS_sz;
67d874057dimextern unsigned struct_FTSENT_sz;
68d874057dimextern const int unvis_valid;
69d874057dimextern const int unvis_validpush;
70d874057dim
71d874057dimstruct __sanitizer_iocb {
72d874057dim  u64 aio_data;
73d874057dim  u32 aio_key_or_aio_reserved1;  // Simply crazy.
74d874057dim  u32 aio_reserved1_or_aio_key;  // Luckily, we don't need these.
75d874057dim  u16 aio_lio_opcode;
76d874057dim  s16 aio_reqprio;
77d874057dim  u32 aio_fildes;
78d874057dim  u64 aio_buf;
79d874057dim  u64 aio_nbytes;
80d874057dim  s64 aio_offset;
81d874057dim  u64 aio_reserved2;
82d874057dim  u64 aio_reserved3;
83d874057dim};
84d874057dim
85d874057dimstruct __sanitizer_io_event {
86d874057dim  u64 data;
87d874057dim  u64 obj;
88d874057dim  u64 res;
89d874057dim  u64 res2;
90d874057dim};
91d874057dim
92d874057dimconst unsigned iocb_cmd_pread = 0;
93d874057dimconst unsigned iocb_cmd_pwrite = 1;
94d874057dimconst unsigned iocb_cmd_preadv = 7;
95d874057dimconst unsigned iocb_cmd_pwritev = 8;
96d874057dim
97d874057dimstruct __sanitizer___sysctl_args {
98d874057dim  int *name;
99d874057dim  int nlen;
100d874057dim  void *oldval;
101d874057dim  uptr *oldlenp;
102d874057dim  void *newval;
103d874057dim  uptr newlen;
104d874057dim  unsigned long ___unused[4];
105d874057dim};
106d874057dim
107d874057dimstruct __sanitizer_ipc_perm {
108d874057dim  unsigned int cuid;
109d874057dim  unsigned int cgid;
110d874057dim  unsigned int uid;
111d874057dim  unsigned int gid;
112d874057dim  unsigned short mode;
113d874057dim  unsigned short seq;
114d874057dim  long key;
115d874057dim};
116d874057dim
117d874057dim#if !defined(__i386__)
118d874057dimtypedef long long __sanitizer_time_t;
119d874057dim#else
120d874057dimtypedef long __sanitizer_time_t;
121d874057dim#endif
122d874057dim
123d874057dimstruct __sanitizer_shmid_ds {
124d874057dim  __sanitizer_ipc_perm shm_perm;
125d874057dim  unsigned long shm_segsz;
126d874057dim  unsigned int shm_lpid;
127d874057dim  unsigned int shm_cpid;
128d874057dim  int shm_nattch;
129d874057dim  __sanitizer_time_t shm_atime;
130d874057dim  __sanitizer_time_t shm_dtime;
131d874057dim  __sanitizer_time_t shm_ctime;
132d874057dim};
133d874057dim
134d874057dimextern unsigned struct_msqid_ds_sz;
135d874057dimextern unsigned struct_mq_attr_sz;
136d874057dimextern unsigned struct_timeb_sz;
137d874057dimextern unsigned struct_statvfs_sz;
138d874057dim
139d874057dimstruct __sanitizer_iovec {
140d874057dim  void *iov_base;
141d874057dim  uptr iov_len;
142d874057dim};
143d874057dim
144d874057dimstruct __sanitizer_ifaddrs {
145d874057dim  struct __sanitizer_ifaddrs *ifa_next;
146d874057dim  char *ifa_name;
147d874057dim  unsigned int ifa_flags;
148d874057dim  void *ifa_addr;     // (struct sockaddr *)
149d874057dim  void *ifa_netmask;  // (struct sockaddr *)
150340097edim#undef ifa_dstaddr
151d874057dim  void *ifa_dstaddr;  // (struct sockaddr *)
152d874057dim  void *ifa_data;
153d874057dim};
154d874057dim
155d874057dimtypedef unsigned __sanitizer_pthread_key_t;
156d874057dim
157d874057dimstruct __sanitizer_passwd {
158d874057dim  char *pw_name;
159d874057dim  char *pw_passwd;
160d874057dim  int pw_uid;
161d874057dim  int pw_gid;
162d874057dim  __sanitizer_time_t pw_change;
163d874057dim  char *pw_class;
164d874057dim  char *pw_gecos;
165d874057dim  char *pw_dir;
166d874057dim  char *pw_shell;
167d874057dim  __sanitizer_time_t pw_expire;
168d874057dim  int pw_fields;
169d874057dim};
170d874057dim
171d874057dimstruct __sanitizer_group {
172d874057dim  char *gr_name;
173d874057dim  char *gr_passwd;
174d874057dim  int gr_gid;
175d874057dim  char **gr_mem;
176d874057dim};
177d874057dim
178d874057dimtypedef long __sanitizer_suseconds_t;
179d874057dim
180d874057dimstruct __sanitizer_timeval {
181d874057dim  __sanitizer_time_t tv_sec;
182d874057dim  __sanitizer_suseconds_t tv_usec;
183d874057dim};
184d874057dim
185d874057dimstruct __sanitizer_itimerval {
186d874057dim  struct __sanitizer_timeval it_interval;
187d874057dim  struct __sanitizer_timeval it_value;
188d874057dim};
189d874057dim
190d874057dimstruct __sanitizer_timeb {
191d874057dim  __sanitizer_time_t time;
192d874057dim  unsigned short millitm;
193d874057dim  short timezone;
194d874057dim  short dstflag;
195d874057dim};
196d874057dim
197d874057dimstruct __sanitizer_ether_addr {
198d874057dim  u8 octet[6];
199d874057dim};
200d874057dim
201d874057dimstruct __sanitizer_tm {
202d874057dim  int tm_sec;
203d874057dim  int tm_min;
204d874057dim  int tm_hour;
205d874057dim  int tm_mday;
206d874057dim  int tm_mon;
207d874057dim  int tm_year;
208d874057dim  int tm_wday;
209d874057dim  int tm_yday;
210d874057dim  int tm_isdst;
211d874057dim  long int tm_gmtoff;
212d874057dim  const char *tm_zone;
213d874057dim};
214d874057dim
215d874057dimstruct __sanitizer_msghdr {
216d874057dim  void *msg_name;
217d874057dim  unsigned msg_namelen;
218d874057dim  struct __sanitizer_iovec *msg_iov;
219d874057dim  unsigned msg_iovlen;
220d874057dim  void *msg_control;
221d874057dim  unsigned msg_controllen;
222d874057dim  int msg_flags;
223d874057dim};
224d874057dim
225d874057dimstruct __sanitizer_cmsghdr {
226d874057dim  unsigned cmsg_len;
227d874057dim  int cmsg_level;
228d874057dim  int cmsg_type;
229d874057dim};
230d874057dim
231d874057dimstruct __sanitizer_dirent {
232d874057dim#if defined(__INO64)
233d874057dim  unsigned long long d_fileno;
234d874057dim  unsigned long long d_off;
235d874057dim#else
236d874057dim  unsigned int d_fileno;
237d874057dim#endif
238d874057dim  unsigned short d_reclen;
239d874057dim  // more fields that we don't care about
240d874057dim};
241d874057dim
242d874057dim// 'clock_t' is 32 bits wide on x64 FreeBSD
243d874057dimtypedef int __sanitizer_clock_t;
244d874057dimtypedef int __sanitizer_clockid_t;
245d874057dim
246d874057dim#if defined(_LP64) || defined(__x86_64__) || defined(__powerpc__) || \
247d874057dim    defined(__mips__)
248d874057dimtypedef unsigned __sanitizer___kernel_uid_t;
249d874057dimtypedef unsigned __sanitizer___kernel_gid_t;
250d874057dim#else
251d874057dimtypedef unsigned short __sanitizer___kernel_uid_t;
252d874057dimtypedef unsigned short __sanitizer___kernel_gid_t;
253d874057dim#endif
254d874057dimtypedef long long __sanitizer___kernel_off_t;
255d874057dim
256d874057dim#if defined(__powerpc__) || defined(__mips__)
257d874057dimtypedef unsigned int __sanitizer___kernel_old_uid_t;
258d874057dimtypedef unsigned int __sanitizer___kernel_old_gid_t;
259d874057dim#else
260d874057dimtypedef unsigned short __sanitizer___kernel_old_uid_t;
261d874057dimtypedef unsigned short __sanitizer___kernel_old_gid_t;
262d874057dim#endif
263d874057dim
264d874057dimtypedef long long __sanitizer___kernel_loff_t;
265d874057dimtypedef struct {
266d874057dim  unsigned long fds_bits[1024 / (8 * sizeof(long))];
267d874057dim} __sanitizer___kernel_fd_set;
268d874057dim
269d874057dim// This thing depends on the platform. We are only interested in the upper
270d874057dim// limit. Verified with a compiler assert in .cpp.
271d874057dimunion __sanitizer_pthread_attr_t {
272d874057dim  char size[128];
273d874057dim  void *align;
274d874057dim};
275d874057dim
276d874057dimconst unsigned old_sigset_t_sz = sizeof(unsigned long);
277d874057dim
278d874057dimstruct __sanitizer_sigset_t {
279d874057dim  // uint32_t * 4
280d874057dim  unsigned int __bits[4];
281d874057dim};
282d874057dim
283d874057dimtypedef __sanitizer_sigset_t __sanitizer_kernel_sigset_t;
284d874057dim
285d874057dimstruct __sanitizer_siginfo {
286d874057dim  // The size is determined by looking at sizeof of real siginfo_t on linux.
287d874057dim  u64 opaque[128 / sizeof(u64)];
288d874057dim};
289d874057dim
290d874057dimusing __sanitizer_sighandler_ptr = void (*)(int sig);
291d874057dimusing __sanitizer_sigactionhandler_ptr = void (*)(int sig,
292d874057dim                                                  __sanitizer_siginfo *siginfo,
293d874057dim                                                  void *uctx);
294d874057dim
295d874057dimstruct __sanitizer_sigaction {
296d874057dim  union {
297d874057dim    __sanitizer_sigactionhandler_ptr sigaction;
298d874057dim    __sanitizer_sighandler_ptr handler;
299d874057dim  };
300d874057dim  int sa_flags;
301d874057dim  __sanitizer_sigset_t sa_mask;
302d874057dim};
303d874057dim
304d874057dimstruct __sanitizer_sem_t {
305d874057dim  u32 data[4];
306d874057dim};
307d874057dim
308d874057dimextern const uptr sig_ign;
309d874057dimextern const uptr sig_dfl;
310d874057dimextern const uptr sig_err;
311d874057dimextern const uptr sa_siginfo;
312d874057dim
313d874057dimextern int af_inet;
314d874057dimextern int af_inet6;
315d874057dimuptr __sanitizer_in_addr_sz(int af);
316d874057dim
317d874057dimstruct __sanitizer_dl_phdr_info {
318d874057dim  uptr dlpi_addr;
319d874057dim  const char *dlpi_name;
320d874057dim  const void *dlpi_phdr;
321d874057dim  short dlpi_phnum;
322d874057dim};
323d874057dim
324d874057dimextern unsigned struct_ElfW_Phdr_sz;
325d874057dim
326d874057dimstruct __sanitizer_addrinfo {
327d874057dim  int ai_flags;
328d874057dim  int ai_family;
329d874057dim  int ai_socktype;
330d874057dim  int ai_protocol;
331d874057dim  unsigned ai_addrlen;
332d874057dim  char *ai_canonname;
333d874057dim  void *ai_addr;
334d874057dim  struct __sanitizer_addrinfo *ai_next;
335d874057dim};
336d874057dim
337d874057dimstruct __sanitizer_hostent {
338d874057dim  char *h_name;
339d874057dim  char **h_aliases;
340d874057dim  int h_addrtype;
341d874057dim  int h_length;
342d874057dim  char **h_addr_list;
343d874057dim};
344d874057dim
345d874057dimstruct __sanitizer_pollfd {
346d874057dim  int fd;
347d874057dim  short events;
348d874057dim  short revents;
349d874057dim};
350d874057dim
351d874057dimtypedef unsigned __sanitizer_nfds_t;
352d874057dim
353d874057dimstruct __sanitizer_glob_t {
354d874057dim  uptr gl_pathc;
355d874057dim  uptr gl_matchc;
356d874057dim  uptr gl_offs;
357d874057dim  int gl_flags;
358d874057dim  char **gl_pathv;
359d874057dim  int (*gl_errfunc)(const char *, int);
360d874057dim  void (*gl_closedir)(void *dirp);
361d874057dim  struct dirent *(*gl_readdir)(void *dirp);
362d874057dim  void *(*gl_opendir)(const char *);
363d874057dim  int (*gl_lstat)(const char *, void * /* struct stat* */);
364d874057dim  int (*gl_stat)(const char *, void * /* struct stat* */);
365d874057dim};
366d874057dim
367d874057dimextern int glob_nomatch;
368d874057dimextern int glob_altdirfunc;
369d874057dim
370d874057dimextern unsigned path_max;
371d874057dim
372d874057dimstruct __sanitizer_wordexp_t {
373d874057dim  uptr we_wordc;
374d874057dim  char **we_wordv;
375d874057dim  uptr we_offs;
376d874057dim  char *we_strings;
377d874057dim  uptr we_nbytes;
378d874057dim};
379d874057dim
380d874057dimtypedef void __sanitizer_FILE;
381d874057dim
382d874057dimextern unsigned struct_shminfo_sz;
383d874057dimextern unsigned struct_shm_info_sz;
384d874057dimextern int shmctl_ipc_stat;
385d874057dimextern int shmctl_ipc_info;
386d874057dimextern int shmctl_shm_info;
387d874057dimextern int shmctl_shm_stat;
388d874057dim
389d874057dimextern unsigned struct_utmpx_sz;
390d874057dim
391d874057dimextern int map_fixed;
392d874057dim
393d874057dim// ioctl arguments
394d874057dimstruct __sanitizer_ifconf {
395d874057dim  int ifc_len;
396d874057dim  union {
397d874057dim    void *ifcu_req;
398d874057dim  } ifc_ifcu;
399d874057dim};
400d874057dim
401d874057dim#define IOC_NRBITS 8
402d874057dim#define IOC_TYPEBITS 8
403d874057dim#if defined(__powerpc__) || defined(__powerpc64__) || defined(__mips__)
404d874057dim#define IOC_SIZEBITS 13
405d874057dim#define IOC_DIRBITS 3
406d874057dim#define IOC_NONE 1U
407d874057dim#define IOC_WRITE 4U
408d874057dim#define IOC_READ 2U
409d874057dim#else
410d874057dim#define IOC_SIZEBITS 14
411d874057dim#define IOC_DIRBITS 2
412d874057dim#define IOC_NONE 0U
413d874057dim#define IOC_WRITE 1U
414d874057dim#define IOC_READ 2U
415d874057dim#endif
416d874057dim#define IOC_NRMASK ((1 << IOC_NRBITS) - 1)
417d874057dim#define IOC_TYPEMASK ((1 << IOC_TYPEBITS) - 1)
418d874057dim#define IOC_SIZEMASK ((1 << IOC_SIZEBITS) - 1)
419d874057dim#if defined(IOC_DIRMASK)
420d874057dim#undef IOC_DIRMASK
421d874057dim#endif
422d874057dim#define IOC_DIRMASK ((1 << IOC_DIRBITS) - 1)
423d874057dim#define IOC_NRSHIFT 0
424d874057dim#define IOC_TYPESHIFT (IOC_NRSHIFT + IOC_NRBITS)
425d874057dim#define IOC_SIZESHIFT (IOC_TYPESHIFT + IOC_TYPEBITS)
426d874057dim#define IOC_DIRSHIFT (IOC_SIZESHIFT + IOC_SIZEBITS)
427d874057dim#define EVIOC_EV_MAX 0x1f
428d874057dim#define EVIOC_ABS_MAX 0x3f
429d874057dim
430d874057dim#define IOC_DIR(nr) (((nr) >> IOC_DIRSHIFT) & IOC_DIRMASK)
431d874057dim#define IOC_TYPE(nr) (((nr) >> IOC_TYPESHIFT) & IOC_TYPEMASK)
432d874057dim#define IOC_NR(nr) (((nr) >> IOC_NRSHIFT) & IOC_NRMASK)
433d874057dim#define IOC_SIZE(nr) (((nr) >> IOC_SIZESHIFT) & IOC_SIZEMASK)
434d874057dim
435d874057dimextern unsigned struct_ifreq_sz;
436d874057dimextern unsigned struct_termios_sz;
437d874057dimextern unsigned struct_winsize_sz;
438d874057dim
439d874057dimextern unsigned struct_copr_buffer_sz;
440d874057dimextern unsigned struct_copr_debug_buf_sz;
441d874057dimextern unsigned struct_copr_msg_sz;
442d874057dimextern unsigned struct_midi_info_sz;
443d874057dimextern unsigned struct_mtget_sz;
444d874057dimextern unsigned struct_mtop_sz;
445d874057dimextern unsigned struct_rtentry_sz;
446d874057dimextern unsigned struct_sbi_instrument_sz;
447d874057dimextern unsigned struct_seq_event_rec_sz;
448d874057dimextern unsigned struct_synth_info_sz;
449d874057dimextern unsigned struct_vt_mode_sz;
450d874057dim
451d874057dimextern const unsigned long __sanitizer_bufsiz;
452d874057dimextern unsigned struct_audio_buf_info_sz;
453d874057dimextern unsigned struct_ppp_stats_sz;
454d874057dimextern unsigned struct_sioc_sg_req_sz;
455d874057dimextern unsigned struct_sioc_vif_req_sz;
456d874057dim
457d874057dim// ioctl request identifiers
458d874057dim
459d874057dim// A special value to mark ioctls that are not present on the target platform,
460d874057dim// when it can not be determined without including any system headers.
461d874057dimextern const unsigned IOCTL_NOT_PRESENT;
462d874057dim
463d874057dimextern unsigned IOCTL_FIOASYNC;
464d874057dimextern unsigned IOCTL_FIOCLEX;
465d874057dimextern unsigned IOCTL_FIOGETOWN;
466d874057dimextern unsigned IOCTL_FIONBIO;
467d874057dimextern unsigned IOCTL_FIONCLEX;
468d874057dimextern unsigned IOCTL_FIOSETOWN;
469d874057dimextern unsigned IOCTL_SIOCADDMULTI;
470d874057dimextern unsigned IOCTL_SIOCATMARK;
471d874057dimextern unsigned IOCTL_SIOCDELMULTI;
472d874057dimextern unsigned IOCTL_SIOCGIFADDR;
473d874057dimextern unsigned IOCTL_SIOCGIFBRDADDR;
474d874057dimextern unsigned IOCTL_SIOCGIFCONF;
475d874057dimextern unsigned IOCTL_SIOCGIFDSTADDR;
476d874057dimextern unsigned IOCTL_SIOCGIFFLAGS;
477d874057dimextern unsigned IOCTL_SIOCGIFMETRIC;
478d874057dimextern unsigned IOCTL_SIOCGIFMTU;
479d874057dimextern unsigned IOCTL_SIOCGIFNETMASK;
480d874057dimextern unsigned IOCTL_SIOCGPGRP;
481d874057dimextern unsigned IOCTL_SIOCSIFADDR;
482d874057dimextern unsigned IOCTL_SIOCSIFBRDADDR;
483d874057dimextern unsigned IOCTL_SIOCSIFDSTADDR;
484d874057dimextern unsigned IOCTL_SIOCSIFFLAGS;
485d874057dimextern unsigned IOCTL_SIOCSIFMETRIC;
486d874057dimextern unsigned IOCTL_SIOCSIFMTU;
487d874057dimextern unsigned IOCTL_SIOCSIFNETMASK;
488d874057dimextern unsigned IOCTL_SIOCSPGRP;
489d874057dimextern unsigned IOCTL_TIOCCONS;
490d874057dimextern unsigned IOCTL_TIOCEXCL;
491d874057dimextern unsigned IOCTL_TIOCGETD;
492d874057dimextern unsigned IOCTL_TIOCGPGRP;
493d874057dimextern unsigned IOCTL_TIOCGWINSZ;
494d874057dimextern unsigned IOCTL_TIOCMBIC;
495d874057dimextern unsigned IOCTL_TIOCMBIS;
496d874057dimextern unsigned IOCTL_TIOCMGET;
497d874057dimextern unsigned IOCTL_TIOCMSET;
498d874057dimextern unsigned IOCTL_TIOCNOTTY;
499d874057dimextern unsigned IOCTL_TIOCNXCL;
500d874057dimextern unsigned IOCTL_TIOCOUTQ;
501d874057dimextern unsigned IOCTL_TIOCPKT;
502d874057dimextern unsigned IOCTL_TIOCSCTTY;
503d874057dimextern unsigned IOCTL_TIOCSETD;
504d874057dimextern unsigned IOCTL_TIOCSPGRP;
505d874057dimextern unsigned IOCTL_TIOCSTI;
506d874057dimextern unsigned IOCTL_TIOCSWINSZ;
507d874057dimextern unsigned IOCTL_SIOCGETSGCNT;
508d874057dimextern unsigned IOCTL_SIOCGETVIFCNT;
509d874057dimextern unsigned IOCTL_MTIOCGET;
510d874057dimextern unsigned IOCTL_MTIOCTOP;
511d874057dimextern unsigned IOCTL_SIOCADDRT;
512d874057dimextern unsigned IOCTL_SIOCDELRT;
513d874057dimextern unsigned IOCTL_SNDCTL_DSP_GETBLKSIZE;
514d874057dimextern unsigned IOCTL_SNDCTL_DSP_GETFMTS;
515d874057dimextern unsigned IOCTL_SNDCTL_DSP_NONBLOCK;
516d874057dimextern unsigned IOCTL_SNDCTL_DSP_POST;
517d874057dimextern unsigned IOCTL_SNDCTL_DSP_RESET;
518d874057dimextern unsigned IOCTL_SNDCTL_DSP_SETFMT;
519d874057dimextern unsigned IOCTL_SNDCTL_DSP_SETFRAGMENT;
520d874057dimextern unsigned IOCTL_SNDCTL_DSP_SPEED;
521d874057dimextern unsigned IOCTL_SNDCTL_DSP_STEREO;
522d874057dimextern unsigned IOCTL_SNDCTL_DSP_SUBDIVIDE;
523d874057dimextern unsigned IOCTL_SNDCTL_DSP_SYNC;
524d874057dimextern unsigned IOCTL_SNDCTL_FM_4OP_ENABLE;
525d874057dimextern unsigned IOCTL_SNDCTL_FM_LOAD_INSTR;
526d874057dimextern unsigned IOCTL_SNDCTL_MIDI_INFO;
527d874057dimextern unsigned IOCTL_SNDCTL_MIDI_PRETIME;
528d874057dimextern unsigned IOCTL_SNDCTL_SEQ_CTRLRATE;
529d874057dimextern unsigned IOCTL_SNDCTL_SEQ_GETINCOUNT;
530d874057dimextern unsigned IOCTL_SNDCTL_SEQ_GETOUTCOUNT;
531d874057dimextern unsigned IOCTL_SNDCTL_SEQ_NRMIDIS;
532d874057dimextern unsigned IOCTL_SNDCTL_SEQ_NRSYNTHS;
533d874057dimextern unsigned IOCTL_SNDCTL_SEQ_OUTOFBAND;
534d874057dimextern unsigned IOCTL_SNDCTL_SEQ_PANIC;
535d874057dimextern unsigned IOCTL_SNDCTL_SEQ_PERCMODE;
536d874057dimextern unsigned IOCTL_SNDCTL_SEQ_RESET;
537d874057dimextern unsigned IOCTL_SNDCTL_SEQ_RESETSAMPLES;
538d874057dimextern unsigned IOCTL_SNDCTL_SEQ_SYNC;
539d874057dimextern unsigned IOCTL_SNDCTL_SEQ_TESTMIDI;
540d874057dimextern unsigned IOCTL_SNDCTL_SEQ_THRESHOLD;
541d874057dimextern unsigned IOCTL_SNDCTL_SYNTH_INFO;
542d874057dimextern unsigned IOCTL_SNDCTL_SYNTH_MEMAVL;
543d874057dimextern unsigned IOCTL_SNDCTL_TMR_CONTINUE;
544d874057dimextern unsigned IOCTL_SNDCTL_TMR_METRONOME;
545d874057dimextern unsigned IOCTL_SNDCTL_TMR_SELECT;
546d874057dimextern unsigned IOCTL_SNDCTL_TMR_SOURCE;
547d874057dimextern unsigned IOCTL_SNDCTL_TMR_START;
548d874057dimextern unsigned IOCTL_SNDCTL_TMR_STOP;
549d874057dimextern unsigned IOCTL_SNDCTL_TMR_TEMPO;
550d874057dimextern unsigned IOCTL_SNDCTL_TMR_TIMEBASE;
551d874057dimextern unsigned IOCTL_SOUND_MIXER_READ_ALTPCM;
552d874057dimextern unsigned IOCTL_SOUND_MIXER_READ_BASS;
553d874057dimextern unsigned IOCTL_SOUND_MIXER_READ_CAPS;
554d874057dimextern unsigned IOCTL_SOUND_MIXER_READ_CD;
555d874057dimextern unsigned IOCTL_SOUND_MIXER_READ_DEVMASK;
556d874057dimextern unsigned IOCTL_SOUND_MIXER_READ_ENHANCE;
557d874057dimextern unsigned IOCTL_SOUND_MIXER_READ_IGAIN;
558d874057dimextern unsigned IOCTL_SOUND_MIXER_READ_IMIX;
559d874057dimextern unsigned IOCTL_SOUND_MIXER_READ_LINE1;
560d874057dimextern unsigned IOCTL_SOUND_MIXER_READ_LINE2;
561d874057dimextern unsigned IOCTL_SOUND_MIXER_READ_LINE3;
562d874057dimextern unsigned IOCTL_SOUND_MIXER_READ_LINE;
563d874057dimextern unsigned IOCTL_SOUND_MIXER_READ_LOUD;
564d874057dimextern unsigned IOCTL_SOUND_MIXER_READ_MIC;
565d874057dimextern unsigned IOCTL_SOUND_MIXER_READ_MUTE;
566d874057dimextern unsigned IOCTL_SOUND_MIXER_READ_OGAIN;
567d874057dimextern unsigned IOCTL_SOUND_MIXER_READ_PCM;
568d874057dimextern unsigned IOCTL_SOUND_MIXER_READ_RECLEV;
569d874057dimextern unsigned IOCTL_SOUND_MIXER_READ_RECMASK;
570d874057dimextern unsigned IOCTL_SOUND_MIXER_READ_RECSRC;
571d874057dimextern unsigned IOCTL_SOUND_MIXER_READ_SPEAKER;
572d874057dimextern unsigned IOCTL_SOUND_MIXER_READ_STEREODEVS;
573d874057dimextern unsigned IOCTL_SOUND_MIXER_READ_SYNTH;
574d874057dimextern unsigned IOCTL_SOUND_MIXER_READ_TREBLE;
575d874057dimextern unsigned IOCTL_SOUND_MIXER_READ_VOLUME;
576d874057dimextern unsigned IOCTL_SOUND_MIXER_WRITE_ALTPCM;
577d874057dimextern unsigned IOCTL_SOUND_MIXER_WRITE_BASS;
578d874057dimextern unsigned IOCTL_SOUND_MIXER_WRITE_CD;
579d874057dimextern unsigned IOCTL_SOUND_MIXER_WRITE_ENHANCE;
580d874057dimextern unsigned IOCTL_SOUND_MIXER_WRITE_IGAIN;
581d874057dimextern unsigned IOCTL_SOUND_MIXER_WRITE_IMIX;
582d874057dimextern unsigned IOCTL_SOUND_MIXER_WRITE_LINE1;
583d874057dimextern unsigned IOCTL_SOUND_MIXER_WRITE_LINE2;
584d874057dimextern unsigned IOCTL_SOUND_MIXER_WRITE_LINE3;
585d874057dimextern unsigned IOCTL_SOUND_MIXER_WRITE_LINE;
586d874057dimextern unsigned IOCTL_SOUND_MIXER_WRITE_LOUD;
587d874057dimextern unsigned IOCTL_SOUND_MIXER_WRITE_MIC;
588d874057dimextern unsigned IOCTL_SOUND_MIXER_WRITE_MUTE;
589d874057dimextern unsigned IOCTL_SOUND_MIXER_WRITE_OGAIN;
590d874057dimextern unsigned IOCTL_SOUND_MIXER_WRITE_PCM;
591d874057dimextern unsigned IOCTL_SOUND_MIXER_WRITE_RECLEV;
592d874057dimextern unsigned IOCTL_SOUND_MIXER_WRITE_RECSRC;
593d874057dimextern unsigned IOCTL_SOUND_MIXER_WRITE_SPEAKER;
594d874057dimextern unsigned IOCTL_SOUND_MIXER_WRITE_SYNTH;
595d874057dimextern unsigned IOCTL_SOUND_MIXER_WRITE_TREBLE;
596d874057dimextern unsigned IOCTL_SOUND_MIXER_WRITE_VOLUME;
597d874057dimextern unsigned IOCTL_SOUND_PCM_READ_BITS;
598d874057dimextern unsigned IOCTL_SOUND_PCM_READ_CHANNELS;
599d874057dimextern unsigned IOCTL_SOUND_PCM_READ_FILTER;
600d874057dimextern unsigned IOCTL_SOUND_PCM_READ_RATE;
601d874057dimextern unsigned IOCTL_SOUND_PCM_WRITE_CHANNELS;
602d874057dimextern unsigned IOCTL_SOUND_PCM_WRITE_FILTER;
603d874057dimextern unsigned IOCTL_VT_ACTIVATE;
604d874057dimextern unsigned IOCTL_VT_GETMODE;
605d874057dimextern unsigned IOCTL_VT_OPENQRY;
606d874057dimextern unsigned IOCTL_VT_RELDISP;
607d874057dimextern unsigned IOCTL_VT_SETMODE;
608d874057dimextern unsigned IOCTL_VT_WAITACTIVE;
609d874057dimextern unsigned IOCTL_GIO_SCRNMAP;
610d874057dimextern unsigned IOCTL_KDDISABIO;
611d874057dimextern unsigned IOCTL_KDENABIO;
612d874057dimextern unsigned IOCTL_KDGETLED;
613d874057dimextern unsigned IOCTL_KDGETMODE;
614d874057dimextern unsigned IOCTL_KDGKBMODE;
615d874057dimextern unsigned IOCTL_KDGKBTYPE;
616d874057dimextern unsigned IOCTL_KDMKTONE;
617d874057dimextern unsigned IOCTL_KDSETLED;
618d874057dimextern unsigned IOCTL_KDSETMODE;
619d874057dimextern unsigned IOCTL_KDSKBMODE;
620d874057dim
621d874057dimextern const int si_SEGV_MAPERR;
622d874057dimextern const int si_SEGV_ACCERR;
623d874057dim
624d874057dimstruct __sanitizer_cap_rights {
625d874057dim  u64 cr_rights[2];
626d874057dim};
627d874057dim
628d874057dimtypedef struct __sanitizer_cap_rights __sanitizer_cap_rights_t;
629d874057dimextern unsigned struct_cap_rights_sz;
630d874057dim
631d874057dimextern unsigned struct_fstab_sz;
632d874057dimextern unsigned struct_StringList_sz;
633340097edim}  // namespace __sanitizer
634d874057dim
635d874057dim#define CHECK_TYPE_SIZE(TYPE) \
636d874057dim  COMPILER_CHECK(sizeof(__sanitizer_##TYPE) == sizeof(TYPE))
637d874057dim
638340097edim#define CHECK_SIZE_AND_OFFSET(CLASS, MEMBER)                      \
639340097edim  COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *)NULL)->MEMBER) == \
640340097edim                 sizeof(((CLASS *)NULL)->MEMBER));                \
641340097edim  COMPILER_CHECK(offsetof(__sanitizer_##CLASS, MEMBER) ==         \
642d874057dim                 offsetof(CLASS, MEMBER))
643d874057dim
644d874057dim// For sigaction, which is a function and struct at the same time,
645d874057dim// and thus requires explicit "struct" in sizeof() expression.
646340097edim#define CHECK_STRUCT_SIZE_AND_OFFSET(CLASS, MEMBER)                      \
647340097edim  COMPILER_CHECK(sizeof(((struct __sanitizer_##CLASS *)NULL)->MEMBER) == \
648340097edim                 sizeof(((struct CLASS *)NULL)->MEMBER));                \
649340097edim  COMPILER_CHECK(offsetof(struct __sanitizer_##CLASS, MEMBER) ==         \
650d874057dim                 offsetof(struct CLASS, MEMBER))
651d874057dim
652d874057dim#define SIGACTION_SYMNAME sigaction
653d874057dim
654d874057dim#endif
655d874057dim
656340097edim#endif  // SANITIZER_FREEBSD
657