Skip to content

Linux Raw: Clarify x86_64 linux_raw syscall number.#687

Merged
newpavlov merged 1 commit into
rust-random:masterfrom
briansmith:b/raw-x32
Jun 9, 2025
Merged

Linux Raw: Clarify x86_64 linux_raw syscall number.#687
newpavlov merged 1 commit into
rust-random:masterfrom
briansmith:b/raw-x32

Conversation

@briansmith
Copy link
Copy Markdown
Contributor

The source code didn't mention the x32 ABI by name. Give __X32_SYSCALL_BIT its rightful name so readers can understand what we're doing. Explain why we're not using cfg(target_abi).

For other ILP32 ABIs, it seems like they use the same syscall numbers.

Comment thread src/backends/linux_raw.rs Outdated
// TODO(MSRV-1.78): Add `any(target_abi = "", target_abi = "x32")` above.
const __X32_SYSCALL_BIT: u32 = 1 << 30;
#[allow(clippy::assertions_on_constants)]
const _MATCHES_KERNEL_SOURCE: () = assert!(__X32_SYSCALL_BIT == 0x40000000);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not just write it as const __X32_SYSCALL_BIT: u32 = 0x40000000; ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Why not just write it as const __X32_SYSCALL_BIT: u32 = 0x40000000; ?

Done!

The source code didn't mention the x32 ABI by name. Give
`__X32_SYSCALL_BIT` its rightful name so readers can understand
what we're doing. Explain why we're not using `cfg(target_abi)`.

For other ILP32 ABIs, it seems like they use the same syscall
numbers.
@newpavlov newpavlov merged commit e500436 into rust-random:master Jun 9, 2025
74 checks passed
takumi-earth pushed a commit to earthlings-dev/getrandom that referenced this pull request Jan 27, 2026
The source code didn't mention the x32 ABI by name. Give
`__X32_SYSCALL_BIT` its rightful name so readers can understand what
we're doing. Explain why we're not using `cfg(target_abi)`.

For other ILP32 ABIs, it seems like they use the same syscall numbers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants