Skip to content

Rewrite Linux syscalls generation #24702

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

The-King-of-Toasters
Copy link
Contributor

Reloaded version of #21440 post writergate. Original description below:


Changes by Arnd Bergmann have migrated all supported architectures to use a table for their syscall lists. This removes the need of calling a C pre-processor and simplifies the logic dramatically.
The side effect is the number of names changed on targets that use the "generic" table. That list (located under scripts/syscall.tbl) adds the _time64 suffix to syscalls taking a timespec64 on 32-bit targets. Similarly, the _time32 suffix has been removed.

The result is a lot of breakage in our Linux wrappers, which makes me worried that the logic for determining the proper timespec to use was subtly broken all this time. Should be a good chance to finish #4726 - we only have 14 12 years after all...

CC @alexrp if things break.

@alexrp alexrp self-assigned this Aug 5, 2025
Changes by Arnd Bergmann have migrated all supported architectures to
use a table for their syscall lists. This removes the need to use the
C pre-processor and simplifies the logic considerably.
@The-King-of-Toasters
Copy link
Contributor Author

The-King-of-Toasters commented Aug 7, 2025

I've modified the tool again to consolidate all the logic into one table and restored the order of the emitted variables for easier diffing. This should fix the x32 syscall abi problems that @rootbeer pointed out.

The generic syscall table has different names for syscalls that take a
timespec64 on 32-bit targets, in that it adds the `_time64` suffix.
Similarly, the `_time32` suffix has been removed.

I'm not sure if the existing logic for determining the proper timespec
struct to use was subtly broken, but it should be a good chance to
finish ziglang#4726 - we only have 12 years after all...

As for the changes since 6.11..6.16:

6.11:
 - x86_64 gets `uretprobe`, a syscall to speed up returning BPF probes.
 - Hexagon gets `clone3`, but don't be fooled: it just returns ENOSYS.
6.13:
 - The `*xattr` family of syscalls have been enhanced with new `*xattrat`
   versions, similar to the other file-based `at` calls.
6.15:
 - Atomically create a detached mount tree and set mount options on it.
Newer 32-bit Linux targets like 32-bit RISC-V only use the 64-bit
time ABI, with these syscalls having `time64` as their suffix.

This is a stopgap solution in favor of a full audit of `std.os.linux` to
prepare for ziglang#4726.

See also ziglang#21440 for prior art.
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.

3 participants