Skip to content

Commit cc82ed2

Browse files
authored
Fix ioctl numbers on BSDs (#926)
`<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 on FreeBSD with Smithay/drm-rs#180. This also seems to be correct for NetBSD and OpenBSD.
1 parent 90b2fbd commit cc82ed2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/ioctl/bsd.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ pub(super) const fn compose_opcode(
1818
dir | num | (group << 8) | ((size & IOCPARAM_MASK) << 16)
1919
}
2020

21+
// `IOC_VOID`
2122
pub const NONE: RawOpcode = 0x2000_0000;
22-
pub const WRITE: RawOpcode = 0x4000_0000;
23-
pub const READ: RawOpcode = 0x8000_0000;
23+
// `IOC_OUT` ("out" is from the perspective of the kernel)
24+
pub const READ: RawOpcode = 0x4000_0000;
25+
// `IOC_IN`
26+
pub const WRITE: RawOpcode = 0x8000_0000;
2427
pub const IOCPARAM_MASK: RawOpcode = 0x1FFF;

0 commit comments

Comments
 (0)