Skip to content

libc-test fixes for QNX targets - #5337

Merged
tgross35 merged 2 commits into
rust-lang:mainfrom
ferrocene:qnx-fixes
Aug 4, 2026
Merged

libc-test fixes for QNX targets#5337
tgross35 merged 2 commits into
rust-lang:mainfrom
ferrocene:qnx-fixes

Conversation

@japaric

@japaric japaric commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Description

We started running libc-test for the QNX targets as part of Ferrocene CI (ferrocene/ferrocene#2512) and noticed that the ctest and semver tests were failing. This PR upstreams our fixes. See the commit messages for details about the changes.

Checklist

  • Relevant tests in libc-test/semver have been updated. ➡️ Initial semver files added
  • Commit messages permalink to headers for added or changed API. ➡️ N/A headers are not public
  • Placeholder or unstable values like *LAST or *MAX have the standard
    doc comment. ➡️ N/A no new constant with these names have been added
  • Tested locally (cargo test -p libc-test --target mytarget);
    especially relevant for platforms that may not be checked in CI. ➡️ Done for QNX7.1 and QNX8, both x86_64 and aarch64

@rustbot label +stable-nominated

@rustbot rustbot added O-unix S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Jul 28, 2026

@tgross35 tgross35 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Few small things, otherwise LGTM

View changes since this review

Comment thread src/unix/nto/mod.rs Outdated
Comment on lines +285 to +287
pub gl_errfunc: extern "C" fn(*const c_char, c_int) -> c_int,
pub gl_errfunc: Option<extern "C" fn(*const c_char, c_int) -> c_int>,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since you're changing this, could you make the function unsafe as well?

Comment thread src/unix/nto/mod.rs Outdated
Comment on lines +583 to +588
__reserved0: crate::uintptr_t,
pub __policy: c_int,
pub __param: crate::__sched_param,
pub __guardsize: c_uint,
pub __prealloc: c_uint,
__reserved1: crate::uintptr_t,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wrap spare/reserved fields in Padding

Comment thread src/unix/nto/neutrino.rs Outdated
pub timer_load_max: u64,
pub boot_cc: u64,
pub tick_period_cc: u64,
spare: [u64; 3],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ditto here

@rustbot

rustbot commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@japaric

japaric commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

thanks for the review
@rustbot ready

@tgross35 tgross35 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, please just squash the last commit into the first

View changes since this review

@rustbot

This comment has been minimized.

japaric added 2 commits August 4, 2026 21:18
these are changes required to pass `cargo test -p libc-test --test ctest` on
the QNX targets

libc-test had probably not been run before for QNX8 so quite a few things needed
fixing:
- some constants that were present in QNX7.1 are no longer present in QNX8, e.g.
  `STATE_STACK`, `_NTO_CI_SANDBOX`
- the values of some constants have changed on QNX8, e.g. `FILENAME_MAX`
- some functions that were present in QNX7.1 are no longer present in QNX8, e.g
  `SyncMutexRevive`
- some structs have changed ABI in QNX8, e.g. `_thread_attr`, `mallinfo`,
  `pthread_rwlock_t`
- on QNX8, `inotify_*` functions now live in the `libfsnotify.so` library
- on QNX8, the neutrino API is specified in `sys/neutrino.h`
- some header files (e.g. `sys/malloc.h`, `nbutil.h`) are no longer present on
  QNX8

libc-test probably had not been run in a while for QNX7.1 so there a few
small fixes there as well:

- `ctest` v0.5.x requires that bindings have named arguments but `sysctl` was
  using underscores (`_`) as names; the arguments now have names
- `BPF_{MOD,XOR}` are only defined in `pcap/bpf.h` but the header file cannot
  be included together with `net/bpf.h` due to `ifdef` include guards on the
  C side and `ctest` only generating a single test binary. These constants
  can't be tested by `ctest` on QNX7.1, so they have been added to the
  skip list
- `ctest` does not support anonymous unions so the `ifr_ifru` field in the
  `ifreq` struct needs to be skipped
- the `timezone` struct must be skipped as it's an `extern_ty!`pe
these are based on `unix.txt` without the API not present on QNX

note that `qnx.txt` has extra API that is not present in
`nto.txt`, like `SA_ONSTACK` and `cfsetspeed`

with this change the entirity of `libc-test`'s tests pass on QNX targets
@rustbot

rustbot commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

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.

@japaric

japaric commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

squashed and rebased

@tgross35
tgross35 added this pull request to the merge queue Aug 4, 2026
Merged via the queue into rust-lang:main with commit e27c7f1 Aug 4, 2026
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-unix stable-nominated This PR should be considered for cherry-pick to libc's stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants