Skip to content

linux: add SYS_futex for riscv32 GNU - #5631

Closed
jadhavgaurav wants to merge 1 commit into
rust-lang:mainfrom
jadhavgaurav:riscv32-gnu-sys-futex
Closed

jadhavgaurav wants to merge 1 commit into
rust-lang:mainfrom
jadhavgaurav:riscv32-gnu-sys-futex

Conversation

@jadhavgaurav

@jadhavgaurav jadhavgaurav commented Oct 15, 2026 •

Copy link
Copy Markdown

Description

Add SYS_futex for riscv32gc-unknown-linux-gnu as an alias of SYS_futex_time64, matching the riscv32 musl module. #5455 removed the time32 SYS_futex = 98, which does not exist on riscv32; this does not bring that number back. parking_lot_core uses libc::SYS_futex and no longer builds on this target. time_t is 64-bit on riscv32, so the time64 syscall is the one a SYS_futex caller needs.

Fixes #5627

Checklist

  • Relevant tests in libc-test/semver have been updated (SYS_futex is already listed in linux.txt, no change needed)
  • Commit messages permalink to headers for added or changed API
  • Placeholder or unstable values like *LAST or *MAX have the standard doc comment (not applicable)
  • Tested locally (cargo test -p libc-test --target mytarget): not run, only cargo check -Zbuild-std=core --target riscv32gc-unknown-linux-gnu and cargo fmt --check on nightly

@rustbot label +stable-nominated

@rustbot rustbot added O-gnu O-linux O-linux-like O-riscv O-unix S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Oct 15, 2026
@rustbot

This comment has been minimized.

riscv32 has no time32 futex syscall, so SYS_futex was removed along with
the other time32 numbers. Alias it to SYS_futex_time64, the same way the
riscv32 musl module does, so that users such as parking_lot_core that use
SYS_futex keep building. time_t is 64-bit on this target, so the time64
syscall takes the same timespec layout.

Fixes rust-lang#5627

Sources:
- https://github.com/torvalds/linux/blob/v7.1/include/uapi/asm-generic/unistd.h
- https://github.com/bminor/glibc/blob/glibc-2.42/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h

Signed-off-by: Gaurav Jadhav <gaurav.vjadhav01@gmail.com>
@jadhavgaurav
jadhavgaurav force-pushed the riscv32-gnu-sys-futex branch from 99b5186 to c2fcaca Compare October 15, 2026 19:05
@tgross35

Copy link
Copy Markdown
Member

@tgross35

Copy link
Copy Markdown
Member

@rustbot author for feedback

@rustbot

rustbot commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

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

@jadhavgaurav

Copy link
Copy Markdown
Author

Thanks, you are right. The glibc rv32 arch-syscall.h I cited only defines __NR_futex_time64 (422) and has no __NR_futex, and in Linux's asm-generic unistd.h __NR_futex is gated behind __ARCH_WANT_TIME32_SYSCALLS, which rv32 does not set. The SYS_futex alias exists in musl's own headers, but the gnu module follows glibc, so the alias is not backed there. Closing this one. Sorry for the noise.

@tgross35 tgross35 removed the stable-nominated This PR should be considered for cherry-pick to libc's stable release branch label Oct 16, 2026
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.

missing libc::SYS_futex for riscv32gc-unknown-linux-gnu target

3 participants