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

source code of compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_freebsd.h