Skip to content

Commit 9ab9525

Browse files
committed
SCTP support for FreeBSD, NetBSD
Notification and log `union` types are exposed as partially-opaque structs for now, until libc targets a version of Rust which supports unions.
1 parent 0a52819 commit 9ab9525

File tree

3 files changed

+2023
-2
lines changed

3 files changed

+2023
-2
lines changed

libc-test/build.rs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,12 @@ fn main() {
244244
if linux || android {
245245
cfg.header("sys/fsuid.h");
246246

247-
// DCCP support
248247
if !uclibc && !musl && !emscripten {
248+
// DCCP support
249249
cfg.header("linux/dccp.h");
250+
251+
// SCTP support
252+
//cfg.header("netinet/sctp.h");
250253
}
251254
}
252255

@@ -258,6 +261,9 @@ fn main() {
258261
cfg.header("sys/ipc.h");
259262
cfg.header("sys/msg.h");
260263
cfg.header("sys/shm.h");
264+
265+
// SCTP support
266+
cfg.header("netinet/sctp.h");
261267
}
262268

263269
if netbsd {
@@ -267,6 +273,9 @@ fn main() {
267273

268274
// DCCP support
269275
cfg.header("netinet/dccp.h");
276+
277+
// SCTP support
278+
cfg.header("netinet/sctp.h");
270279
}
271280

272281
if openbsd {
@@ -343,6 +352,8 @@ fn main() {
343352
"type_" if linux &&
344353
(struct_ == "input_event" || struct_ == "input_mask" ||
345354
struct_ == "ff_effect") => "type".to_string(),
355+
"type_" if freebsd &&
356+
(struct_ == "sctp_error_missing_param") => "type".to_string(),
346357
s => s.to_string(),
347358
}
348359
});
@@ -352,6 +363,12 @@ fn main() {
352363
// sighandler_t is crazy across platforms
353364
"sighandler_t" => true,
354365

366+
// Temporarily skip the 'sctp_nets' type for FreeBSD,
367+
// it's currently just an alias for c_void since the true
368+
// type layout is very complex and it's only ever used
369+
// through a pointer (e.g. sctp_nets*).
370+
"sctp_nets" if freebsd => true,
371+
355372
_ => false
356373
}
357374
});
@@ -384,6 +401,9 @@ fn main() {
384401
// header conflicts when including them with all the other structs.
385402
"termios2" => true,
386403

404+
// This was added in FreeBSD 11
405+
"sctp_error_auth_invalid_hmac" if freebsd => true,
406+
387407
_ => false
388408
}
389409
});
@@ -452,6 +472,14 @@ fn main() {
452472
"HW_MAXID" |
453473
"USER_MAXID" if freebsd => true,
454474

475+
// These constants were added in FreeBSD 11.
476+
"SCTP_INTERLEAVING_SUPPORTED" |
477+
"SCTP_IDATA" |
478+
"SCTP_IFORWARD_CUM_TSN" |
479+
"SCTP_PR_SCTP_PRIO" |
480+
"SCTP_ASSOC_SUPPORTS_INTERLEAVING" |
481+
"SCTP_NOHEARTBEAT" if freebsd => true,
482+
455483
// These OSX constants are removed in Sierra.
456484
// https://developer.apple.com/library/content/releasenotes/General/APIDiffsMacOS10_12/Swift/Darwin.html
457485
"KERN_KDENABLE_BG_TRACE" if apple => true,

0 commit comments

Comments
 (0)