Skip to content

Commit f2b8ec3

Browse files
committed
Add support for alternative QNX Neutrino network stack io-sock
Signed-off-by: Florian Bartels <[email protected]>
1 parent 4bc5300 commit f2b8ec3

File tree

3 files changed

+237
-97
lines changed

3 files changed

+237
-97
lines changed

libc-test/build.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3033,6 +3033,20 @@ fn test_neutrino(target: &str) {
30333033
assert!(target.contains("nto-qnx"));
30343034

30353035
let mut cfg = ctest_cfg();
3036+
if target.ends_with("_iosock") {
3037+
let qnx_target_val = std::env::var("QNX_TARGET")
3038+
.unwrap_or_else(|_| "QNX_TARGET_not_set_please_source_qnxsdp".into());
3039+
3040+
cfg.include(qnx_target_val + "/usr/include/io-sock");
3041+
headers! { cfg:
3042+
"io-sock.h",
3043+
"sys/types.h",
3044+
"sys/socket.h",
3045+
"sys/sysctl.h",
3046+
"net/if.h",
3047+
"net/if_arp.h"
3048+
}
3049+
}
30363050

30373051
headers! { cfg:
30383052
"ctype.h",
@@ -3190,6 +3204,9 @@ fn test_neutrino(target: &str) {
31903204
// Does not exist in Neutrino
31913205
"locale_t" => true,
31923206

3207+
// FIXME: "'__uint128' undeclared" in C
3208+
"__uint128" => true,
3209+
31933210
_ => false,
31943211
}
31953212
});
@@ -3250,6 +3267,9 @@ fn test_neutrino(target: &str) {
32503267
// stack unwinding bug.
32513268
"__my_thread_exit" => true,
32523269

3270+
// Wrong const-ness
3271+
"dl_iterate_phdr" => true,
3272+
32533273
_ => false,
32543274
}
32553275
});

src/unix/mod.rs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,13 @@ pub const ATF_PERM: c_int = 0x04;
335335
pub const ATF_PUBL: c_int = 0x08;
336336
pub const ATF_USETRAILERS: c_int = 0x10;
337337

338-
pub const FNM_PERIOD: c_int = 1 << 2;
338+
cfg_if! {
339+
if #[cfg(target_os = "nto")] {
340+
pub const FNM_PERIOD: c_int = 1 << 1;
341+
} else {
342+
pub const FNM_PERIOD: c_int = 1 << 2;
343+
}
344+
}
339345
pub const FNM_NOMATCH: c_int = 1;
340346

341347
cfg_if! {
@@ -354,9 +360,22 @@ cfg_if! {
354360
target_os = "openbsd",
355361
))] {
356362
pub const FNM_PATHNAME: c_int = 1 << 1;
357-
pub const FNM_NOESCAPE: c_int = 1 << 0;
358363
} else {
359364
pub const FNM_PATHNAME: c_int = 1 << 0;
365+
}
366+
}
367+
368+
cfg_if! {
369+
if #[cfg(any(
370+
target_os = "macos",
371+
target_os = "freebsd",
372+
target_os = "android",
373+
target_os = "openbsd",
374+
))] {
375+
pub const FNM_NOESCAPE: c_int = 1 << 0;
376+
} else if #[cfg(target_os = "nto")] {
377+
pub const FNM_NOESCAPE: c_int = 1 << 2;
378+
} else {
360379
pub const FNM_NOESCAPE: c_int = 1 << 1;
361380
}
362381
}

0 commit comments

Comments
 (0)