24
24
// Must go after undef _FILE_OFFSET_BITS.
25
25
#include " sanitizer_platform.h"
26
26
27
- #if SANITIZER_LINUX || SANITIZER_APPLE || SANITIZER_HAIKU
27
+ #if SANITIZER_LINUX || SANITIZER_APPLE || SANITIZER_HAIKU || SANITIZER_AIX
28
28
// Must go after undef _FILE_OFFSET_BITS.
29
29
#include " sanitizer_glibc_version.h"
30
30
61
61
#endif
62
62
63
63
#if !SANITIZER_ANDROID
64
- #if !SANITIZER_HAIKU
64
+ #if !SANITIZER_HAIKU && !SANITIZER_AIX
65
65
#include < sys/mount.h>
66
66
#endif
67
67
#include < sys/timeb.h>
@@ -112,11 +112,15 @@ typedef struct user_fpregs elf_fpregset_t;
112
112
#endif
113
113
114
114
#if !SANITIZER_ANDROID
115
- #include < ifaddrs.h>
116
- #if !SANITIZER_HAIKU
117
- #include < sys/ucontext.h>
118
- #include < wordexp.h>
119
- #endif
115
+ # if !SANITIZER_AIX
116
+ # include < ifaddrs.h>
117
+ # else
118
+ # include < netinet/in.h>
119
+ # endif
120
+ # if !SANITIZER_HAIKU
121
+ # include < sys/ucontext.h>
122
+ # include < wordexp.h>
123
+ # endif
120
124
#endif
121
125
122
126
#if SANITIZER_LINUX
@@ -182,6 +186,17 @@ typedef struct user_fpregs elf_fpregset_t;
182
186
#include < sys/ioctl.h>
183
187
#endif
184
188
189
+ # if SANITIZER_AIX
190
+ # include < netinet/ip_mroute.h>
191
+ # include < stropts.h>
192
+ # include < sys/ioctl.h>
193
+ # include < sys/statfs.h>
194
+ # include < unistd.h>
195
+ # if HAVE_RPC_XDR_H
196
+ # include < tirpc/rpc/xdr.h>
197
+ # endif
198
+ # endif
199
+
185
200
// Include these after system headers to avoid name clashes and ambiguities.
186
201
# include " sanitizer_common.h"
187
202
# include " sanitizer_internal_defs.h"
@@ -557,13 +572,20 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
557
572
558
573
const unsigned IOCTL_NOT_PRESENT = 0 ;
559
574
560
- unsigned IOCTL_FIONBIO = FIONBIO;
575
+ // On AIX, some variables are unsigned long types.
576
+ #if SANITIZER_AIX
577
+ using ioctl_alttype = uptr;
578
+ #else
579
+ using ioctl_alttype = unsigned ;
580
+ #endif
581
+
582
+ ioctl_alttype IOCTL_FIONBIO = FIONBIO;
561
583
#if !SANITIZER_HAIKU
562
- unsigned IOCTL_FIOASYNC = FIOASYNC;
584
+ ioctl_alttype IOCTL_FIOASYNC = FIOASYNC;
563
585
unsigned IOCTL_FIOCLEX = FIOCLEX;
564
586
unsigned IOCTL_FIOGETOWN = FIOGETOWN;
565
587
unsigned IOCTL_FIONCLEX = FIONCLEX;
566
- unsigned IOCTL_FIOSETOWN = FIOSETOWN;
588
+ ioctl_alttype IOCTL_FIOSETOWN = FIOSETOWN;
567
589
#endif
568
590
unsigned IOCTL_SIOCADDMULTI = SIOCADDMULTI;
569
591
unsigned IOCTL_SIOCATMARK = SIOCATMARK;
@@ -584,29 +606,31 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
584
606
unsigned IOCTL_SIOCSIFMETRIC = SIOCSIFMETRIC;
585
607
unsigned IOCTL_SIOCSIFMTU = SIOCSIFMTU;
586
608
unsigned IOCTL_SIOCSIFNETMASK = SIOCSIFNETMASK;
587
- unsigned IOCTL_SIOCSPGRP = SIOCSPGRP;
609
+ ioctl_alttype IOCTL_SIOCSPGRP = SIOCSPGRP;
588
610
589
611
#if !SANITIZER_HAIKU
590
- unsigned IOCTL_TIOCCONS = TIOCCONS;
612
+ ioctl_alttype IOCTL_TIOCCONS = TIOCCONS;
591
613
unsigned IOCTL_TIOCGETD = TIOCGETD;
592
614
unsigned IOCTL_TIOCNOTTY = TIOCNOTTY;
593
- unsigned IOCTL_TIOCPKT = TIOCPKT;
594
- unsigned IOCTL_TIOCSETD = TIOCSETD;
595
- unsigned IOCTL_TIOCSTI = TIOCSTI;
615
+ ioctl_alttype IOCTL_TIOCPKT = TIOCPKT;
616
+ ioctl_alttype IOCTL_TIOCSETD = TIOCSETD;
617
+ ioctl_alttype IOCTL_TIOCSTI = TIOCSTI;
596
618
#endif
597
619
598
620
unsigned IOCTL_TIOCEXCL = TIOCEXCL;
599
621
unsigned IOCTL_TIOCGPGRP = TIOCGPGRP;
600
622
unsigned IOCTL_TIOCGWINSZ = TIOCGWINSZ;
601
- unsigned IOCTL_TIOCMBIC = TIOCMBIC;
602
- unsigned IOCTL_TIOCMBIS = TIOCMBIS;
623
+ ioctl_alttype IOCTL_TIOCMBIC = TIOCMBIC;
624
+ ioctl_alttype IOCTL_TIOCMBIS = TIOCMBIS;
603
625
unsigned IOCTL_TIOCMGET = TIOCMGET;
604
- unsigned IOCTL_TIOCMSET = TIOCMSET;
626
+ ioctl_alttype IOCTL_TIOCMSET = TIOCMSET;
605
627
unsigned IOCTL_TIOCNXCL = TIOCNXCL;
606
628
unsigned IOCTL_TIOCOUTQ = TIOCOUTQ;
629
+ # if !SANITIZER_AIX
607
630
unsigned IOCTL_TIOCSCTTY = TIOCSCTTY;
608
- unsigned IOCTL_TIOCSPGRP = TIOCSPGRP;
609
- unsigned IOCTL_TIOCSWINSZ = TIOCSWINSZ;
631
+ # endif
632
+ ioctl_alttype IOCTL_TIOCSPGRP = TIOCSPGRP;
633
+ ioctl_alttype IOCTL_TIOCSWINSZ = TIOCSWINSZ;
610
634
#if SANITIZER_LINUX && !SANITIZER_ANDROID
611
635
unsigned IOCTL_SIOCGETSGCNT = SIOCGETSGCNT;
612
636
unsigned IOCTL_SIOCGETVIFCNT = SIOCGETVIFCNT;
@@ -1115,6 +1139,8 @@ COMPILER_CHECK(sizeof(__sanitizer_dirent) <= sizeof(dirent));
1115
1139
CHECK_SIZE_AND_OFFSET (dirent, d_ino);
1116
1140
#if SANITIZER_APPLE
1117
1141
CHECK_SIZE_AND_OFFSET (dirent, d_seekoff);
1142
+ #elif SANITIZER_AIX
1143
+ CHECK_SIZE_AND_OFFSET (dirent, d_offset);
1118
1144
#elif SANITIZER_FREEBSD || SANITIZER_HAIKU
1119
1145
// There is no 'd_off' field on FreeBSD.
1120
1146
#else
@@ -1205,8 +1231,10 @@ CHECK_SIZE_AND_OFFSET(tm, tm_year);
1205
1231
CHECK_SIZE_AND_OFFSET (tm, tm_wday);
1206
1232
CHECK_SIZE_AND_OFFSET (tm, tm_yday);
1207
1233
CHECK_SIZE_AND_OFFSET (tm, tm_isdst);
1234
+ # if !SANITIZER_AIX
1208
1235
CHECK_SIZE_AND_OFFSET (tm, tm_gmtoff);
1209
1236
CHECK_SIZE_AND_OFFSET (tm, tm_zone);
1237
+ # endif
1210
1238
1211
1239
#if SANITIZER_LINUX
1212
1240
CHECK_TYPE_SIZE (mntent);
@@ -1258,7 +1286,7 @@ CHECK_TYPE_SIZE(clock_t);
1258
1286
CHECK_TYPE_SIZE (clockid_t );
1259
1287
#endif
1260
1288
1261
- #if !SANITIZER_ANDROID && !SANITIZER_HAIKU
1289
+ #if !SANITIZER_ANDROID && !SANITIZER_HAIKU && !SANITIZER_AIX
1262
1290
CHECK_TYPE_SIZE (ifaddrs);
1263
1291
CHECK_SIZE_AND_OFFSET (ifaddrs, ifa_next);
1264
1292
CHECK_SIZE_AND_OFFSET (ifaddrs, ifa_name);
0 commit comments