Skip to content
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

Add Linux ioctl creation utilities #9748

Merged
merged 3 commits into from Sep 18, 2021
Merged

Add Linux ioctl creation utilities #9748

merged 3 commits into from Sep 18, 2021

Conversation

Aransentin
Copy link
Sponsor Contributor

Shamelessly stolen from @mattnite 's now closed #6443 pull request, this adds some utilities for constructing modern IOCTLs, and also uses them in linux.zig for some constants that were previously broken on mips, powerpc, and sparc.

From the ioctl manpages:

Ioctl command values are 32-bit constants. In principle these constants are completely arbitrary, but people have tried to build some structure into them.

Therefore I have kept them as u32 values, and not as packed Request structures. There previous PR had also messed up the flags a little: write is 1 and read is 2, not the inverse.

@MasterQ32
Copy link
Contributor

This is very nice, i needed this in the past quite often already.

lib/std/os/linux/ioctl.zig Outdated Show resolved Hide resolved
lib/std/os/linux/ioctl.zig Outdated Show resolved Hide resolved
Co-authored-by: Veikka Tuominen <git@vexu.eu>
lib/std/os/linux.zig Outdated Show resolved Hide resolved
Co-authored-by: zigazeljko <ziga.zeljko@gmail.com>
@Vexu Vexu merged commit d2b5105 into ziglang:master Sep 18, 2021
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.

None yet

4 participants