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)

@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?

Copy link
Author

Choose a reason for hiding this comment

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

Actually not, thanks!! I think I used as reference the linux_like definition, will remove it,

@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.

@rafaeling rafaeling force-pushed the nto-bpf-ifreq-support branch from 7d27d60 to f62f2d4 Compare November 13, 2025 16:12
@rustbot
Copy link
Collaborator

rustbot commented Nov 13, 2025

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rafaeling
Copy link
Author

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.

@tgross35 Moved structs to src/new, removed __c_anonymous_ifc_ifcu, and ran ./ci/style.sh.
However, the runners are failing, not sure why.

Sorry for the delay in fixing this! I was away for a bit.
I would be willing to support here gradually move things into src/new going forward.

@rafaeling rafaeling force-pushed the nto-bpf-ifreq-support branch from 879b73f to 1687b82 Compare November 13, 2025 16:53
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