Skip to content

Conversation

@rafaeling
Copy link

Description

These structures are required for working with BPF filters and network interfaces on the QNX8 platform. Their absence currently prevents building or using BPF-related functionality with libc on QNX8 targets.

Sources

Updated src/unix/nto/mod.rs accordingly

Checklist

  • [?] Relevant tests in libc-test/semver have been updated
    -> No tests for QNX?
  • [*] No placeholder or unstable values like *LAST or *MAX are
    included (see #3131)
  • [?] Tested locally (cd libc-test && cargo test --target mytarget); especially relevant for platforms that may not be checked in CI.
    -> even main branch does not work.
    Error: could not execute process /home/user/libc/target/x86_64-pc-nto-qnx800/debug/deps/libc-67e46525c5118905 (never executed)

@rafaeling rafaeling force-pushed the nto-bpf-ifreq-support branch from f1b2a57 to 7d27d60 Compare October 24, 2025 10:07
@tgross35
Copy link
Contributor

This looks fine to me, cc target maintainers @flba-eb @gh-tr @jonathanpallant @japaric to verify things build

Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you actually mind moving this to the src/new module? We're slowly starting to migrate things there since it's easier to match up with what a user can #include. I believe this would be src/new/nto/net/if.h and src/new/nto/net/bpf.h, unless nto has a different structure. You can either move the existing BPF items over or not, your call.

Then this update to src/new/nto/mod.rs:

pub(crate) mod net {
    pub(crate) mod route;
}

And at

libc/src/new/mod.rs

Lines 171 to 186 in 564e0ef

// Per-OS headers we export
cfg_if! {
if #[cfg(target_os = "android")] {
pub use sys::socket::*;
} else if #[cfg(target_os = "linux")] {
pub use linux::can::bcm::*;
pub use linux::can::j1939::*;
pub use linux::can::raw::*;
pub use linux::can::*;
pub use linux::keyctl::*;
#[cfg(target_env = "gnu")]
pub use net::route::*;
} else if #[cfg(target_vendor = "apple")] {
pub use signal::*;
}
}
, add a nto arm and re-export everything from the two modules.

After that and the __c_anonymous_ifc_ifcu removal I'll merge this given we haven't heard back from the maintainers but this is straightforward.

Comment on lines +826 to +829
pub union __c_anonymous_ifc_ifcu {
pub ifcu_buf: *mut c_char,
pub ifcu_req: *mut ifreq,
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noticed something: is this union used at all?

@tgross35
Copy link
Contributor

tgross35 commented Nov 2, 2025

  • [?] Tested locally (cd libc-test && cargo test --target mytarget); especially relevant for platforms that may not be checked in CI.
    -> even main branch does not work.
    Error: could not execute process /home/user/libc/target/x86_64-pc-nto-qnx800/debug/deps/libc-67e46525c5118905 (never executed)

Can you usually cargo run --target ... for nto? The relevant test here woul be cargo test -p libc-test --test ctest --target ... if you want to narrow it down and try executing the binary directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants