Skip to content

Commit ccb346d

Browse files
committed
Add support for alternative QNX Neutrino network stack io-sock
Signed-off-by: Florian Bartels <Florian.Bartels@elektrobit.com>
1 parent 5f41b7a commit ccb346d

File tree

3 files changed

+235
-4
lines changed

3 files changed

+235
-4
lines changed

libc-test/build.rs

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

30573057
let mut cfg = ctest_cfg();
3058+
if target.ends_with("_iosock") {
3059+
cfg.include(concat!(env!("QNX_TARGET"), "/usr/include/io-sock"));
3060+
headers! { cfg:
3061+
"io-sock.h",
3062+
"sys/types.h",
3063+
"sys/socket.h",
3064+
"sys/sysctl.h",
3065+
"net/if.h",
3066+
"net/if_arp.h"
3067+
}
3068+
}
30583069

30593070
headers! { cfg:
30603071
"ctype.h",
@@ -3215,6 +3226,9 @@ fn test_neutrino(target: &str) {
32153226
// `c_char_def` is always public but not always reexported.
32163227
"c_char_def" => true,
32173228

3229+
// FIXME: "'__uint128' undeclared" in C
3230+
"__uint128" => true,
3231+
32183232
_ => false,
32193233
}
32203234
});
@@ -3275,6 +3289,9 @@ fn test_neutrino(target: &str) {
32753289
// stack unwinding bug.
32763290
"__my_thread_exit" => true,
32773291

3292+
// Wrong const-ness
3293+
"dl_iterate_phdr" => true,
3294+
32783295
_ => false,
32793296
}
32803297
});

src/unix/mod.rs

Lines changed: 10 additions & 1 deletion
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! {
@@ -357,6 +363,9 @@ cfg_if! {
357363
pub const FNM_NOESCAPE: c_int = 1 << 0;
358364
} else {
359365
pub const FNM_PATHNAME: c_int = 1 << 0;
366+
#[cfg(target_os = "nto")]
367+
pub const FNM_NOESCAPE: c_int = 1 << 2;
368+
#[cfg(not(target_os = "nto"))]
360369
pub const FNM_NOESCAPE: c_int = 1 << 1;
361370
}
362371
}

0 commit comments

Comments
 (0)