From cc82ed28cce2339f8ce5d566c0ca19d0083bc5f1 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Fri, 10 Nov 2023 09:08:44 -0800 Subject: [PATCH] Fix ioctl numbers on BSDs (#926) `` 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 https://github.com/Smithay/drm-rs/pull/180. This also seems to be correct for NetBSD and OpenBSD. --- src/ioctl/bsd.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ioctl/bsd.rs b/src/ioctl/bsd.rs index 66b75b54b..36e6f961f 100644 --- a/src/ioctl/bsd.rs +++ b/src/ioctl/bsd.rs @@ -18,7 +18,10 @@ pub(super) const fn compose_opcode( dir | num | (group << 8) | ((size & IOCPARAM_MASK) << 16) } +// `IOC_VOID` pub const NONE: RawOpcode = 0x2000_0000; -pub const WRITE: RawOpcode = 0x4000_0000; -pub const READ: RawOpcode = 0x8000_0000; +// `IOC_OUT` ("out" is from the perspective of the kernel) +pub const READ: RawOpcode = 0x4000_0000; +// `IOC_IN` +pub const WRITE: RawOpcode = 0x8000_0000; pub const IOCPARAM_MASK: RawOpcode = 0x1FFF;