Skip to content

Commit

Permalink
Fix ioctl numbers on BSDs
Browse files Browse the repository at this point in the history
`<sys/ioccom.h>` defines `IOC_OUT` as `0x40000000UL`. But this is "out"
from the perspective of the kernel, not the application. So this
corresponds to `READ` rather than `WRITE`.

Tested with Smithay/drm-rs#180. This also seems
to be correct for NetBSD and OpenBSD.
  • Loading branch information
ids1024 committed Nov 9, 2023
1 parent e1d66b5 commit 9f3dfb1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ioctl/bsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ pub(super) const fn compose_opcode(
}

pub const NONE: RawOpcode = 0x2000_0000;
pub const WRITE: RawOpcode = 0x4000_0000;
pub const READ: RawOpcode = 0x8000_0000;
pub const READ: RawOpcode = 0x4000_0000;
pub const WRITE: RawOpcode = 0x8000_0000;
pub const IOCPARAM_MASK: RawOpcode = 0x1FFF;

0 comments on commit 9f3dfb1

Please sign in to comment.