@@ -6,6 +6,7 @@ use std::env;
6
6
7
7
fn main ( ) {
8
8
let target = env:: var ( "TARGET" ) . unwrap ( ) ;
9
+ let x86_64 = target. contains ( "x86_64" ) ;
9
10
let windows = target. contains ( "windows" ) ;
10
11
let mingw = target. contains ( "windows-gnu" ) ;
11
12
let linux = target. contains ( "unknown-linux" ) ;
@@ -20,7 +21,7 @@ fn main() {
20
21
let mut cfg = ctest:: TestGenerator :: new ( ) ;
21
22
22
23
// Pull in extra goodies on linux/mingw
23
- if target . contains ( "unknown- linux" ) {
24
+ if linux || android {
24
25
cfg. define ( "_GNU_SOURCE" , None ) ;
25
26
} else if windows {
26
27
cfg. define ( "_WIN32_WINNT" , Some ( "0x8000" ) ) ;
@@ -81,6 +82,12 @@ fn main() {
81
82
cfg. header ( "utime.h" ) ;
82
83
cfg. header ( "pwd.h" ) ;
83
84
cfg. header ( "grp.h" ) ;
85
+ cfg. header ( "sys/utsname.h" ) ;
86
+ cfg. header ( "sys/ptrace.h" ) ;
87
+ cfg. header ( "sys/mount.h" ) ;
88
+ cfg. header ( "sys/uio.h" ) ;
89
+ cfg. header ( "sched.h" ) ;
90
+ cfg. header ( "termios.h" ) ;
84
91
}
85
92
86
93
if android {
@@ -89,6 +96,7 @@ fn main() {
89
96
} else if !windows {
90
97
cfg. header ( "glob.h" ) ;
91
98
cfg. header ( "ifaddrs.h" ) ;
99
+ cfg. header ( "sys/quota.h" ) ;
92
100
cfg. header ( "sys/statvfs.h" ) ;
93
101
94
102
if !musl {
@@ -109,29 +117,49 @@ fn main() {
109
117
}
110
118
}
111
119
120
+ if bsdlike {
121
+ cfg. header ( "sys/event.h" ) ;
122
+ }
123
+
112
124
if linux {
125
+ cfg. header ( "mqueue.h" ) ;
126
+ cfg. header ( "sys/signalfd.h" ) ;
113
127
cfg. header ( "sys/xattr.h" ) ;
114
128
cfg. header ( "sys/ipc.h" ) ;
115
129
cfg. header ( "sys/shm.h" ) ;
116
130
}
117
131
118
132
if linux || android {
119
- cfg. header ( "netpacket/packet.h" ) ;
120
- cfg. header ( "net/ethernet.h" ) ;
121
133
cfg. header ( "malloc.h" ) ;
134
+ cfg. header ( "net/ethernet.h" ) ;
135
+ cfg. header ( "netpacket/packet.h" ) ;
136
+ cfg. header ( "sched.h" ) ;
137
+ cfg. header ( "sys/epoll.h" ) ;
138
+ cfg. header ( "sys/eventfd.h" ) ;
122
139
cfg. header ( "sys/prctl.h" ) ;
123
- /* linux kernel header */
140
+ cfg . header ( "sys/vfs.h" ) ;
124
141
if !musl {
125
142
cfg. header ( "linux/netlink.h" ) ;
143
+ cfg. header ( "linux/magic.h" ) ;
144
+ cfg. header ( "linux/fs.h" ) ;
145
+
146
+ if !mips {
147
+ cfg. header ( "linux/quota.h" ) ;
148
+ }
126
149
}
127
- cfg. header ( "sched.h" ) ;
128
150
}
129
151
130
152
if freebsd {
131
153
cfg. header ( "pthread_np.h" ) ;
132
154
cfg. header ( "sched.h" ) ;
133
155
}
134
156
157
+ if netbsd {
158
+ cfg. header ( "ufs/ufs/quota.h" ) ;
159
+ cfg. header ( "ufs/ufs/quota1.h" ) ;
160
+ cfg. header ( "sys/ioctl_compat.h" ) ;
161
+ }
162
+
135
163
cfg. type_name ( move |ty, is_struct| {
136
164
match ty {
137
165
// Just pass all these through, no need for a "struct" prefix
@@ -182,6 +210,7 @@ fn main() {
182
210
s. replace ( "e_nsec" , ".tv_nsec" )
183
211
}
184
212
}
213
+ "u64" if struct_ == "epoll_event" => "data.u64" . to_string ( ) ,
185
214
s => s. to_string ( ) ,
186
215
}
187
216
} ) ;
@@ -198,6 +227,10 @@ fn main() {
198
227
cfg. skip_struct ( move |ty| {
199
228
match ty {
200
229
"sockaddr_nl" => musl,
230
+
231
+ // The alignment of this is 4 on 64-bit OSX...
232
+ "kevent" if apple && x86_64 => true ,
233
+
201
234
_ => false
202
235
}
203
236
} ) ;
@@ -239,6 +272,19 @@ fn main() {
239
272
// work around super old mips toolchain
240
273
"SCHED_IDLE" | "SHM_NORESERVE" => mips,
241
274
275
+ // weird signed extension or something like that?
276
+ "MS_NOUSER" => true ,
277
+
278
+ // These OSX constants are flagged as deprecated
279
+ "NOTE_EXIT_REPARENTED" |
280
+ "NOTE_REAP" if apple => true ,
281
+
282
+ // The linux/quota.h header file which defines these can't be
283
+ // included with sys/quota.h currently on MIPS, so we don't include
284
+ // it and just ignore these constants
285
+ "QFMT_VFS_OLD" |
286
+ "QFMT_VFS_V0" if mips && linux => true ,
287
+
242
288
_ => false ,
243
289
}
244
290
} ) ;
@@ -265,6 +311,10 @@ fn main() {
265
311
// Rust, but is close enough to *mut
266
312
"timegm" if apple => true ,
267
313
314
+ // OSX's daemon is deprecated in 10.5 so we'll get a warning (which
315
+ // we turn into an error) so just ignore it.
316
+ "daemon" if apple => true ,
317
+
268
318
// These functions presumably exist on netbsd but don't look like
269
319
// they're implemented on rumprun yet, just let them slide for now.
270
320
// Some of them look like they have headers but then don't have
@@ -275,6 +325,8 @@ fn main() {
275
325
"pthread_stackseg_np" |
276
326
"shm_open" |
277
327
"shm_unlink" |
328
+ "syscall" |
329
+ "ptrace" |
278
330
"sigaltstack" if rumprun => true ,
279
331
280
332
_ => false ,
0 commit comments