Skip to content

Commit 1eec898

Browse files
flba-ebtgross35
authored andcommitted
Add support for alternative QNX Neutrino network stack io-sock
Signed-off-by: Florian Bartels <Florian.Bartels@elektrobit.com> (backport <#4169>) (cherry picked from commit f5bfa9f)
1 parent 5354b00 commit 1eec898

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
@@ -3307,6 +3307,20 @@ fn test_neutrino(target: &str) {
33073307
assert!(target.contains("nto-qnx"));
33083308

33093309
let mut cfg = ctest_cfg();
3310+
if target.ends_with("_iosock") {
3311+
let qnx_target_val = std::env::var("QNX_TARGET")
3312+
.unwrap_or_else(|_| "QNX_TARGET_not_set_please_source_qnxsdp".into());
3313+
3314+
cfg.include(qnx_target_val + "/usr/include/io-sock");
3315+
headers! { cfg:
3316+
"io-sock.h",
3317+
"sys/types.h",
3318+
"sys/socket.h",
3319+
"sys/sysctl.h",
3320+
"net/if.h",
3321+
"net/if_arp.h"
3322+
}
3323+
}
33103324

33113325
headers! { cfg:
33123326
"ctype.h",
@@ -3464,6 +3478,9 @@ fn test_neutrino(target: &str) {
34643478
// Does not exist in Neutrino
34653479
"locale_t" => true,
34663480

3481+
// FIXME: "'__uint128' undeclared" in C
3482+
"__uint128" => true,
3483+
34673484
_ => false,
34683485
}
34693486
});
@@ -3527,6 +3544,9 @@ fn test_neutrino(target: &str) {
35273544
// stack unwinding bug.
35283545
"__my_thread_exit" => true,
35293546

3547+
// Wrong const-ness
3548+
"dl_iterate_phdr" => true,
3549+
35303550
_ => false,
35313551
}
35323552
});

src/unix/mod.rs

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

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

340346
cfg_if! {
@@ -354,9 +360,22 @@ cfg_if! {
354360
target_os = "cygwin",
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)