1a14b3e1dim//===-- sanitizer_platform_limits_solaris.h -------------------------------===//
2a14b3e1dim//
38312957dim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
48312957dim// See https://llvm.org/LICENSE.txt for license information.
58312957dim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6a14b3e1dim//
7a14b3e1dim//===----------------------------------------------------------------------===//
8a14b3e1dim//
9a14b3e1dim// This file is a part of Sanitizer common code.
10a14b3e1dim//
11a14b3e1dim// Sizes and layouts of platform-specific Solaris data structures.
12a14b3e1dim//===----------------------------------------------------------------------===//
13a14b3e1dim
14a14b3e1dim#ifndef SANITIZER_PLATFORM_LIMITS_SOLARIS_H
15a14b3e1dim#define SANITIZER_PLATFORM_LIMITS_SOLARIS_H
16a14b3e1dim
17a14b3e1dim#if SANITIZER_SOLARIS
18a14b3e1dim
19a14b3e1dim#include "sanitizer_internal_defs.h"
20a14b3e1dim#include "sanitizer_platform.h"
21a14b3e1dim
22a14b3e1dimnamespace __sanitizer {
23a14b3e1dimextern unsigned struct_utsname_sz;
24a14b3e1dimextern unsigned struct_stat_sz;
25a14b3e1dimextern unsigned struct_stat64_sz;
26a14b3e1dimextern unsigned struct_rusage_sz;
27a14b3e1dimextern unsigned siginfo_t_sz;
28a14b3e1dimextern unsigned struct_itimerval_sz;
29a14b3e1dimextern unsigned pthread_t_sz;
30a14b3e1dimextern unsigned pthread_mutex_t_sz;
31a14b3e1dimextern unsigned pthread_cond_t_sz;
32a14b3e1dimextern unsigned pid_t_sz;
33a14b3e1dimextern unsigned timeval_sz;
34a14b3e1dimextern unsigned uid_t_sz;
35a14b3e1dimextern unsigned gid_t_sz;
36a14b3e1dimextern unsigned mbstate_t_sz;
37a14b3e1dimextern unsigned struct_timezone_sz;
38a14b3e1dimextern unsigned struct_tms_sz;
39a14b3e1dimextern unsigned struct_itimerspec_sz;
40a14b3e1dimextern unsigned struct_sigevent_sz;
41a14b3e1dimextern unsigned struct_sched_param_sz;
42a14b3e1dimextern unsigned struct_statfs64_sz;
43a14b3e1dimextern unsigned struct_statfs_sz;
44a14b3e1dimextern unsigned struct_sockaddr_sz;
45a14b3e1dimextern unsigned ucontext_t_sz;
46a14b3e1dim
47a14b3e1dimextern unsigned struct_timespec_sz;
48a14b3e1dimextern unsigned struct_rlimit_sz;
49a14b3e1dimextern unsigned struct_utimbuf_sz;
50a14b3e1dim
51a14b3e1dimstruct __sanitizer_sem_t {
52a14b3e1dim  //u64 data[6];
53a14b3e1dim  u32 sem_count;
54a14b3e1dim  u16 sem_type;
55a14b3e1dim  u16 sem_magic;
56a14b3e1dim  u64 sem_pad1[3];
57a14b3e1dim  u64 sem_pad2[2];
58a14b3e1dim};
59a14b3e1dim
60a14b3e1dimstruct __sanitizer_ipc_perm {
61a14b3e1dim  unsigned int uid;           // uid_t
62a14b3e1dim  unsigned int gid;           // gid_t
63a14b3e1dim  unsigned int cuid;          // uid_t
64a14b3e1dim  unsigned int cgid;          // gid_t
65a14b3e1dim  unsigned int mode;          // mode_t
66a14b3e1dim  unsigned int seq;           // uint_t
67a14b3e1dim  int key;                    // key_t
68a14b3e1dim#if !defined(_LP64)
69a14b3e1dim  int pad[4];
70a14b3e1dim#endif
71a14b3e1dim  };
72a14b3e1dim
73a14b3e1dimstruct __sanitizer_shmid_ds {
74a14b3e1dim  __sanitizer_ipc_perm shm_perm;
75a14b3e1dim  unsigned long shm_segsz;    // size_t
76a14b3e1dim  unsigned long shm_flags;    // uintptr_t
77a14b3e1dim  unsigned short shm_lkcnt;   // ushort_t
78a14b3e1dim  int shm_lpid;               // pid_t
79a14b3e1dim  int shm_cpid;               // pid_t
80a14b3e1dim  unsigned long shm_nattch;   // shmatt_t
81a14b3e1dim  unsigned long shm_cnattch;  // ulong_t
82a14b3e1dim#if defined(_LP64)
83a14b3e1dim  long shm_atime;             // time_t
84a14b3e1dim  long shm_dtime;
85a14b3e1dim  long shm_ctime;
86a14b3e1dim  void *shm_amp;
87a14b3e1dim  u64 shm_gransize;           // uint64_t
88a14b3e1dim  u64 shm_allocated;          // uint64_t
89a14b3e1dim  u64 shm_pad4[1];            // int64_t
90a14b3e1dim#else
91a14b3e1dim  long shm_atime;             // time_t
92a14b3e1dim  int shm_pad1;               // int32_t
93a14b3e1dim  long shm_dtime;             // time_t
94a14b3e1dim  int shm_pad2;               // int32_t
95a14b3e1dim  long shm_ctime;             // time_t
96a14b3e1dim  void *shm_amp;
97a14b3e1dim  u64 shm_gransize;           // uint64_t
98a14b3e1dim  u64 shm_allocated;          // uint64_t
99a14b3e1dim#endif
100a14b3e1dim};
101a14b3e1dim
102a14b3e1dimextern unsigned struct_statvfs_sz;
103a14b3e1dim#if SANITIZER_SOLARIS32
104a14b3e1dimextern unsigned struct_statvfs64_sz;
105a14b3e1dim#endif
106a14b3e1dim
107a14b3e1dimstruct __sanitizer_iovec {
108a14b3e1dim  void *iov_base;
109a14b3e1dim  uptr iov_len;
110a14b3e1dim};
111a14b3e1dim
112a14b3e1dimstruct __sanitizer_ifaddrs {
113a14b3e1dim  struct __sanitizer_ifaddrs *ifa_next;
114a14b3e1dim  char *ifa_name;
115a14b3e1dim  u64 ifa_flags;     // uint64_t
116a14b3e1dim  void *ifa_addr;    // (struct sockaddr *)
117a14b3e1dim  void *ifa_netmask; // (struct sockaddr *)
118a14b3e1dim  // This is a union on Linux.
119a14b3e1dim# ifdef ifa_dstaddr
120a14b3e1dim# undef ifa_dstaddr
121a14b3e1dim# endif
122a14b3e1dim  void *ifa_dstaddr; // (struct sockaddr *)
123a14b3e1dim  void *ifa_data;
124a14b3e1dim};
125a14b3e1dim
126a14b3e1dimtypedef unsigned __sanitizer_pthread_key_t;
127a14b3e1dim
128a14b3e1dimstruct __sanitizer_XDR {
129a14b3e1dim  int x_op;
130a14b3e1dim  void *x_ops;
131a14b3e1dim  uptr x_public;
132a14b3e1dim  uptr x_private;
133a14b3e1dim  uptr x_base;
134a14b3e1dim  unsigned x_handy;
135a14b3e1dim};
136a14b3e1dim
137a14b3e1dimconst int __sanitizer_XDR_ENCODE = 0;
138a14b3e1dimconst int __sanitizer_XDR_DECODE = 1;
139a14b3e1dimconst int __sanitizer_XDR_FREE = 2;
140a14b3e1dim
141a14b3e1dimstruct __sanitizer_passwd {
142a14b3e1dim  char *pw_name;
143a14b3e1dim  char *pw_passwd;
144a14b3e1dim  unsigned int pw_uid;    // uid_t
145a14b3e1dim  unsigned int pw_gid;    // gid_t
146a14b3e1dim  char *pw_age;
147a14b3e1dim  char *pw_comment;
148a14b3e1dim  char *pw_gecos;
149a14b3e1dim  char *pw_dir;
150a14b3e1dim  char *pw_shell;
151a14b3e1dim};
152a14b3e1dim
153a14b3e1dimstruct __sanitizer_group {
154a14b3e1dim  char *gr_name;
155a14b3e1dim  char *gr_passwd;
156a14b3e1dim  int gr_gid;
157a14b3e1dim  char **gr_mem;
158a14b3e1dim};
159a14b3e1dim
160a14b3e1dimtypedef long __sanitizer_time_t;
161a14b3e1dim
1629419380dimtypedef long __sanitizer_suseconds_t;
1639419380dim
1649419380dimstruct __sanitizer_timeval {
1659419380dim  __sanitizer_time_t tv_sec;
1669419380dim  __sanitizer_suseconds_t tv_usec;
1679419380dim};
1689419380dim
1699419380dimstruct __sanitizer_itimerval {
1709419380dim  struct __sanitizer_timeval it_interval;
1719419380dim  struct __sanitizer_timeval it_value;
1729419380dim};
1739419380dim
174a14b3e1dimstruct __sanitizer_timeb {
175a14b3e1dim  __sanitizer_time_t time;
176a14b3e1dim  unsigned short millitm;
177a14b3e1dim  short timezone;
178a14b3e1dim  short dstflag;
179a14b3e1dim};
180a14b3e1dim
181a14b3e1dimstruct __sanitizer_ether_addr {
182a14b3e1dim  u8 octet[6];
183a14b3e1dim};
184a14b3e1dim
185a14b3e1dimstruct __sanitizer_tm {
186a14b3e1dim  int tm_sec;
187a14b3e1dim  int tm_min;
188a14b3e1dim  int tm_hour;
189a14b3e1dim  int tm_mday;
190a14b3e1dim  int tm_mon;
191a14b3e1dim  int tm_year;
192a14b3e1dim  int tm_wday;
193a14b3e1dim  int tm_yday;
194a14b3e1dim  int tm_isdst;
195a14b3e1dim};
196a14b3e1dim
197a14b3e1dimstruct __sanitizer_msghdr {
198a14b3e1dim  void *msg_name;
199a14b3e1dim  unsigned msg_namelen;
200a14b3e1dim  struct __sanitizer_iovec *msg_iov;
201a14b3e1dim  unsigned msg_iovlen;
202a14b3e1dim  void *msg_control;
203a14b3e1dim  unsigned msg_controllen;
204a14b3e1dim  int msg_flags;
205a14b3e1dim};
206a14b3e1dimstruct __sanitizer_cmsghdr {
207a14b3e1dim  unsigned cmsg_len;
208a14b3e1dim  int cmsg_level;
209a14b3e1dim  int cmsg_type;
210a14b3e1dim};
211a14b3e1dim
2125c86f01dim#if SANITIZER_SOLARIS && (defined(_LP64) || _FILE_OFFSET_BITS == 64)
213a14b3e1dimstruct __sanitizer_dirent {
214a14b3e1dim  unsigned long long d_ino;
215a14b3e1dim  long long d_off;
216a14b3e1dim  unsigned short d_reclen;
217a14b3e1dim  // more fields that we don't care about
218a14b3e1dim};
219a14b3e1dim#else
220a14b3e1dimstruct __sanitizer_dirent {
221a14b3e1dim  unsigned long d_ino;
222a14b3e1dim  long d_off;
223a14b3e1dim  unsigned short d_reclen;
224a14b3e1dim  // more fields that we don't care about
225a14b3e1dim};
226a14b3e1dim#endif
227a14b3e1dim
228a14b3e1dimstruct __sanitizer_dirent64 {
229a14b3e1dim  unsigned long long d_ino;
230a14b3e1dim  unsigned long long d_off;
231a14b3e1dim  unsigned short d_reclen;
232a14b3e1dim  // more fields that we don't care about
233a14b3e1dim};
234a14b3e1dim
235a14b3e1dimtypedef long __sanitizer_clock_t;
236a14b3e1dimtypedef int __sanitizer_clockid_t;
237a14b3e1dim
238a14b3e1dim// This thing depends on the platform. We are only interested in the upper
239a14b3e1dim// limit. Verified with a compiler assert in .cc.
240a14b3e1dimconst int pthread_attr_t_max_sz = 128;
241a14b3e1dimunion __sanitizer_pthread_attr_t {
242a14b3e1dim  char size[pthread_attr_t_max_sz]; // NOLINT
243a14b3e1dim  void *align;
244a14b3e1dim};
245a14b3e1dim
246a14b3e1dimstruct __sanitizer_sigset_t {
247a14b3e1dim  // uint32_t * 4
248a14b3e1dim  unsigned int __bits[4];
249a14b3e1dim};
250a14b3e1dim
251a14b3e1dimstruct __sanitizer_siginfo {
252a14b3e1dim  // The size is determined by looking at sizeof of real siginfo_t on linux.
253a14b3e1dim  u64 opaque[128 / sizeof(u64)];
254a14b3e1dim};
255a14b3e1dim
256a14b3e1dimusing __sanitizer_sighandler_ptr = void (*)(int sig);
257a14b3e1dimusing __sanitizer_sigactionhandler_ptr =
258a14b3e1dim    void (*)(int sig, __sanitizer_siginfo *siginfo, void *uctx);
259a14b3e1dim
260a14b3e1dimstruct __sanitizer_sigaction {
261a14b3e1dim  int sa_flags;
262a14b3e1dim  union {
263a14b3e1dim    __sanitizer_sigactionhandler_ptr sigaction;
264a14b3e1dim    __sanitizer_sighandler_ptr handler;
265a14b3e1dim  };
266a14b3e1dim  __sanitizer_sigset_t sa_mask;
267a14b3e1dim#if !defined(_LP64)
268a14b3e1dim  int sa_resv[2];
269a14b3e1dim#endif
270a14b3e1dim};
271a14b3e1dim
272a14b3e1dimstruct __sanitizer_kernel_sigset_t {
273a14b3e1dim  u8 sig[8];
274a14b3e1dim};
275a14b3e1dim
276a14b3e1dimstruct __sanitizer_kernel_sigaction_t {
277a14b3e1dim  union {
278a14b3e1dim    void (*handler)(int signo);
279a14b3e1dim    void (*sigaction)(int signo, __sanitizer_siginfo *info, void *ctx);
280a14b3e1dim  };
281a14b3e1dim  unsigned long sa_flags;
282a14b3e1dim  void (*sa_restorer)(void);
283a14b3e1dim  __sanitizer_kernel_sigset_t sa_mask;
284a14b3e1dim};
285a14b3e1dim
286a14b3e1dimextern const uptr sig_ign;
287a14b3e1dimextern const uptr sig_dfl;
288a14b3e1dimextern const uptr sig_err;
289a14b3e1dimextern const uptr sa_siginfo;
290a14b3e1dim
291a14b3e1dimextern int af_inet;
292a14b3e1dimextern int af_inet6;
293a14b3e1dimuptr __sanitizer_in_addr_sz(int af);
294a14b3e1dim
295a14b3e1dimstruct __sanitizer_dl_phdr_info {
296a14b3e1dim  uptr dlpi_addr;
297a14b3e1dim  const char *dlpi_name;
298a14b3e1dim  const void *dlpi_phdr;
299a14b3e1dim  short dlpi_phnum;
300a14b3e1dim};
301a14b3e1dim
302a14b3e1dimextern unsigned struct_ElfW_Phdr_sz;
303a14b3e1dim
304a14b3e1dimstruct __sanitizer_addrinfo {
305a14b3e1dim  int ai_flags;
306a14b3e1dim  int ai_family;
307a14b3e1dim  int ai_socktype;
308a14b3e1dim  int ai_protocol;
309a14b3e1dim#if defined(__sparcv9)
310a14b3e1dim  int _ai_pad;
311a14b3e1dim#endif
312a14b3e1dim  unsigned ai_addrlen;
313a14b3e1dim  char *ai_canonname;
314a14b3e1dim  void *ai_addr;
315a14b3e1dim  struct __sanitizer_addrinfo *ai_next;
316a14b3e1dim};
317a14b3e1dim
318a14b3e1dimstruct __sanitizer_hostent {
319a14b3e1dim  char *h_name;
320a14b3e1dim  char **h_aliases;
321a14b3e1dim  int h_addrtype;
322a14b3e1dim  int h_length;
323a14b3e1dim  char **h_addr_list;
324a14b3e1dim};
325a14b3e1dim
326a14b3e1dimstruct __sanitizer_pollfd {
327a14b3e1dim  int fd;
328a14b3e1dim  short events;
329a14b3e1dim  short revents;
330a14b3e1dim};
331a14b3e1dim
332a14b3e1dimtypedef unsigned long __sanitizer_nfds_t;
333a14b3e1dim
334a14b3e1dimstruct __sanitizer_glob_t {
335a14b3e1dim  uptr gl_pathc;
336a14b3e1dim  char **gl_pathv;
337a14b3e1dim  uptr gl_offs;
338a14b3e1dim  char **gl_pathp;
339a14b3e1dim  int gl_pathn;
340a14b3e1dim};
341a14b3e1dim
342a14b3e1dimextern int glob_nomatch;
343a14b3e1dimextern int glob_altdirfunc;
344a14b3e1dim
345a14b3e1dimextern unsigned path_max;
346a14b3e1dim
347a14b3e1dimstruct __sanitizer_wordexp_t {
348a14b3e1dim  uptr we_wordc;
349a14b3e1dim  char **we_wordv;
350a14b3e1dim  uptr we_offs;
351a14b3e1dim  char **we_wordp;
352a14b3e1dim  int we_wordn;
353a14b3e1dim};
354a14b3e1dim
355a14b3e1dimtypedef void __sanitizer_FILE;
356a14b3e1dim#define SANITIZER_HAS_STRUCT_FILE 0
357a14b3e1dim
358a14b3e1dim// This simplifies generic code
359a14b3e1dim#define struct_shminfo_sz -1
360a14b3e1dim#define struct_shm_info_sz -1
361a14b3e1dim#define shmctl_shm_stat -1
362a14b3e1dim#define shmctl_ipc_info -1
363a14b3e1dim#define shmctl_shm_info -1
364a14b3e1dim
365a14b3e1dimextern int shmctl_ipc_stat;
366a14b3e1dim
367a14b3e1dimextern unsigned struct_utmp_sz;
368a14b3e1dimextern unsigned struct_utmpx_sz;
369a14b3e1dim
370a14b3e1dimextern int map_fixed;
371a14b3e1dim
372a14b3e1dim// ioctl arguments
373a14b3e1dimstruct __sanitizer_ifconf {
374a14b3e1dim  int ifc_len;
375a14b3e1dim  union {
376a14b3e1dim    void *ifcu_req;
377a14b3e1dim  } ifc_ifcu;
378a14b3e1dim};
379a14b3e1dim
380a14b3e1dim// <sys/ioccom.h>
381a14b3e1dim#define IOC_NRBITS 8
382a14b3e1dim#define IOC_TYPEBITS 8
383a14b3e1dim#define IOC_SIZEBITS 12
384a14b3e1dim#define IOC_DIRBITS 4
385a14b3e1dim#undef IOC_NONE
386a14b3e1dim#define IOC_NONE 2U     // IOC_VOID
387a14b3e1dim#define IOC_READ 4U     // IOC_OUT
388a14b3e1dim#define IOC_WRITE 8U    // IOC_IN
389a14b3e1dim
390a14b3e1dim#define IOC_NRMASK ((1 << IOC_NRBITS) - 1)
391a14b3e1dim#define IOC_TYPEMASK ((1 << IOC_TYPEBITS) - 1)
392a14b3e1dim#define IOC_SIZEMASK ((1 << IOC_SIZEBITS) - 1)
393a14b3e1dim#define IOC_DIRMASK ((1 << IOC_DIRBITS) - 1)
394a14b3e1dim#define IOC_NRSHIFT 0
395a14b3e1dim#define IOC_TYPESHIFT (IOC_NRSHIFT + IOC_NRBITS)
396a14b3e1dim#define IOC_SIZESHIFT (IOC_TYPESHIFT + IOC_TYPEBITS)
397a14b3e1dim#define IOC_DIRSHIFT (IOC_SIZESHIFT + IOC_SIZEBITS)
398a14b3e1dim
399a14b3e1dim#define IOC_DIR(nr) (((nr) >> IOC_DIRSHIFT) & IOC_DIRMASK)
400a14b3e1dim#define IOC_TYPE(nr) (((nr) >> IOC_TYPESHIFT) & IOC_TYPEMASK)
401a14b3e1dim#define IOC_NR(nr) (((nr) >> IOC_NRSHIFT) & IOC_NRMASK)
402a14b3e1dim
403a14b3e1dim#if defined(__sparc__)
404a14b3e1dim// In sparc the 14 bits SIZE field overlaps with the
405a14b3e1dim// least significant bit of DIR, so either IOC_READ or
406a14b3e1dim// IOC_WRITE shall be 1 in order to get a non-zero SIZE.
407a14b3e1dim#define IOC_SIZE(nr) \
408a14b3e1dim  ((((((nr) >> 29) & 0x7) & (4U | 2U)) == 0) ? 0 : (((nr) >> 16) & 0x3fff))
409a14b3e1dim#else
410a14b3e1dim#define IOC_SIZE(nr) (((nr) >> IOC_SIZESHIFT) & IOC_SIZEMASK)
411a14b3e1dim#endif
412a14b3e1dim
413a14b3e1dimextern unsigned struct_ifreq_sz;
414a14b3e1dimextern unsigned struct_termios_sz;
415a14b3e1dimextern unsigned struct_winsize_sz;
416a14b3e1dim
417a14b3e1dimextern unsigned struct_sioc_sg_req_sz;
418a14b3e1dimextern unsigned struct_sioc_vif_req_sz;
419a14b3e1dim
420a14b3e1dim// ioctl request identifiers
421a14b3e1dim
422a14b3e1dim// A special value to mark ioctls that are not present on the target platform,
423a14b3e1dim// when it can not be determined without including any system headers.
424a14b3e1dimextern const unsigned IOCTL_NOT_PRESENT;
425a14b3e1dim
426a14b3e1dimextern unsigned IOCTL_FIOASYNC;
427a14b3e1dimextern unsigned IOCTL_FIOCLEX;
428a14b3e1dimextern unsigned IOCTL_FIOGETOWN;
429a14b3e1dimextern unsigned IOCTL_FIONBIO;
430a14b3e1dimextern unsigned IOCTL_FIONCLEX;
431a14b3e1dimextern unsigned IOCTL_FIOSETOWN;
432a14b3e1dimextern unsigned IOCTL_SIOCADDMULTI;
433a14b3e1dimextern unsigned IOCTL_SIOCATMARK;
434a14b3e1dimextern unsigned IOCTL_SIOCDELMULTI;
435a14b3e1dimextern unsigned IOCTL_SIOCGIFADDR;
436a14b3e1dimextern unsigned IOCTL_SIOCGIFBRDADDR;
437a14b3e1dimextern unsigned IOCTL_SIOCGIFCONF;
438a14b3e1dimextern unsigned IOCTL_SIOCGIFDSTADDR;
439a14b3e1dimextern unsigned IOCTL_SIOCGIFFLAGS;
440a14b3e1dimextern unsigned IOCTL_SIOCGIFMETRIC;
441a14b3e1dimextern unsigned IOCTL_SIOCGIFMTU;
442a14b3e1dimextern unsigned IOCTL_SIOCGIFNETMASK;
443a14b3e1dimextern unsigned IOCTL_SIOCGPGRP;
444a14b3e1dimextern unsigned IOCTL_SIOCSIFADDR;
445a14b3e1dimextern unsigned IOCTL_SIOCSIFBRDADDR;
446a14b3e1dimextern unsigned IOCTL_SIOCSIFDSTADDR;
447a14b3e1dimextern unsigned IOCTL_SIOCSIFFLAGS;
448a14b3e1dimextern unsigned IOCTL_SIOCSIFMETRIC;
449a14b3e1dimextern unsigned IOCTL_SIOCSIFMTU;
450a14b3e1dimextern unsigned IOCTL_SIOCSIFNETMASK;
451a14b3e1dimextern unsigned IOCTL_SIOCSPGRP;
452a14b3e1dimextern unsigned IOCTL_TIOCEXCL;
453a14b3e1dimextern unsigned IOCTL_TIOCGETD;
454a14b3e1dimextern unsigned IOCTL_TIOCGPGRP;
455a14b3e1dimextern unsigned IOCTL_TIOCGWINSZ;
456a14b3e1dimextern unsigned IOCTL_TIOCMBIC;
457a14b3e1dimextern unsigned IOCTL_TIOCMBIS;
458a14b3e1dimextern unsigned IOCTL_TIOCMGET;
459a14b3e1dimextern unsigned IOCTL_TIOCMSET;
460a14b3e1dimextern unsigned IOCTL_TIOCNOTTY;
461a14b3e1dimextern unsigned IOCTL_TIOCNXCL;
462a14b3e1dimextern unsigned IOCTL_TIOCOUTQ;
463a14b3e1dimextern unsigned IOCTL_TIOCPKT;
464a14b3e1dimextern unsigned IOCTL_TIOCSCTTY;
465a14b3e1dimextern unsigned IOCTL_TIOCSETD;
466a14b3e1dimextern unsigned IOCTL_TIOCSPGRP;
467a14b3e1dimextern unsigned IOCTL_TIOCSTI;
468a14b3e1dimextern unsigned IOCTL_TIOCSWINSZ;
469a14b3e1dimextern unsigned IOCTL_MTIOCGET;
470a14b3e1dimextern unsigned IOCTL_MTIOCTOP;
471a14b3e1dim
472a14b3e1dimextern const int si_SEGV_MAPERR;
473a14b3e1dimextern const int si_SEGV_ACCERR;
474a14b3e1dim}  // namespace __sanitizer
475a14b3e1dim
476a14b3e1dim#define CHECK_TYPE_SIZE(TYPE) \
477a14b3e1dim  COMPILER_CHECK(sizeof(__sanitizer_##TYPE) == sizeof(TYPE))
478a14b3e1dim
479a14b3e1dim#define CHECK_SIZE_AND_OFFSET(CLASS, MEMBER)                       \
480a14b3e1dim  COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *) NULL)->MEMBER) == \
481a14b3e1dim                 sizeof(((CLASS *) NULL)->MEMBER));                \
482a14b3e1dim  COMPILER_CHECK(offsetof(__sanitizer_##CLASS, MEMBER) ==          \
483a14b3e1dim                 offsetof(CLASS, MEMBER))
484a14b3e1dim
485a14b3e1dim// For sigaction, which is a function and struct at the same time,
486a14b3e1dim// and thus requires explicit "struct" in sizeof() expression.
487a14b3e1dim#define CHECK_STRUCT_SIZE_AND_OFFSET(CLASS, MEMBER)                       \
488a14b3e1dim  COMPILER_CHECK(sizeof(((struct __sanitizer_##CLASS *) NULL)->MEMBER) == \
489a14b3e1dim                 sizeof(((struct CLASS *) NULL)->MEMBER));                \
490a14b3e1dim  COMPILER_CHECK(offsetof(struct __sanitizer_##CLASS, MEMBER) ==          \
491a14b3e1dim                 offsetof(struct CLASS, MEMBER))
492a14b3e1dim
493a14b3e1dim#endif  // SANITIZER_SOLARIS
494a14b3e1dim
495a14b3e1dim#endif
496