Skip to content

linux: Export ioctl request generator macros #4325

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

Merged
merged 1 commit into from
Mar 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions libc-test/semver/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3548,9 +3548,13 @@ _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS
_CS_POSIX_V7_LPBIG_OFFBIG_LIBS
_CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS
_CS_POSIX_V7_WIDTH_RESTRICTED_ENVS
_IO
_IOFBF
_IOLBF
_IONBF
_IOR
_IOW
_IOWR
_PC_2_SYMLINKS
_PC_ALLOC_SIZE_MIN
_PC_ASYNC_IO
Expand Down
8 changes: 4 additions & 4 deletions src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5893,22 +5893,22 @@ const fn _IOC(dir: u32, ty: u32, nr: u32, size: usize) -> u32 {
}

/// Build an ioctl number for an argumentless ioctl.
pub(crate) const fn _IO(ty: u32, nr: u32) -> u32 {
pub const fn _IO(ty: u32, nr: u32) -> u32 {
_IOC(_IOC_NONE, ty, nr, 0)
}

/// Build an ioctl number for an read-only ioctl.
pub(crate) const fn _IOR<T>(ty: u32, nr: u32) -> u32 {
pub const fn _IOR<T>(ty: u32, nr: u32) -> u32 {
_IOC(_IOC_READ, ty, nr, size_of::<T>())
}

/// Build an ioctl number for an write-only ioctl.
pub(crate) const fn _IOW<T>(ty: u32, nr: u32) -> u32 {
pub const fn _IOW<T>(ty: u32, nr: u32) -> u32 {
_IOC(_IOC_WRITE, ty, nr, size_of::<T>())
}

/// Build an ioctl number for a read-write ioctl.
pub(crate) const fn _IOWR<T>(ty: u32, nr: u32) -> u32 {
pub const fn _IOWR<T>(ty: u32, nr: u32) -> u32 {
_IOC(_IOC_READ | _IOC_WRITE, ty, nr, size_of::<T>())
}

Expand Down
Loading