@@ -439,6 +439,34 @@ pub const MNT_NODEV: c_int = 0x00000010;
439439pub const MNT_LOCAL : c_int = 0x00001000 ;
440440pub const MNT_QUOTA : c_int = 0x00002000 ;
441441
442+ // sys/ioccom.h in NetBSD and OpenBSD
443+ pub const IOCPARM_MASK : u32 = 0x1fff ;
444+
445+ pub const IOC_VOID : c_ulong = 0x20000000 ;
446+ pub const IOC_OUT : c_ulong = 0x40000000 ;
447+ pub const IOC_IN : c_ulong = 0x80000000 ;
448+ pub const IOC_INOUT : c_ulong = IOC_IN | IOC_OUT ;
449+ pub const IOC_DIRMASK : c_ulong = 0xe0000000 ;
450+
451+ pub const fn _IO ( g : c_ulong , n : c_ulong ) -> c_ulong {
452+ _IOC ( IOC_VOID , g, n, 0 )
453+ }
454+
455+ /// Build an ioctl number for an read-only ioctl.
456+ pub const fn _IOR < T > ( g : c_ulong , n : c_ulong ) -> c_ulong {
457+ _IOC ( IOC_OUT , g, n, mem:: size_of :: < T > ( ) as c_ulong )
458+ }
459+
460+ /// Build an ioctl number for an write-only ioctl.
461+ pub const fn _IOW < T > ( g : c_ulong , n : c_ulong ) -> c_ulong {
462+ _IOC ( IOC_IN , g, n, mem:: size_of :: < T > ( ) as c_ulong )
463+ }
464+
465+ /// Build an ioctl number for a read-write ioctl.
466+ pub const fn _IOWR < T > ( g : c_ulong , n : c_ulong ) -> c_ulong {
467+ _IOC ( IOC_INOUT , g, n, mem:: size_of :: < T > ( ) as c_ulong )
468+ }
469+
442470pub const AF_UNSPEC : c_int = 0 ;
443471pub const AF_LOCAL : c_int = 1 ;
444472pub const AF_UNIX : c_int = AF_LOCAL ;
0 commit comments