module

IOCTL

Inherits IOCTLS

Constants

DIRBITS = 2
IOC_DIRMASK = (1 << IOC_DIRBITS) - 1
IOC_DIRSHIFT = IOC_SIZESHIFT + IOC_SIZEBITS
IOC_IN = IOC_WRITE << IOC_DIRSHIF

for the drivers/sound files...

IOC_INOUT = (IOC_WRITE | IOC_READ) << IOC_DIRSHIFT
IOC_NRBITS = 8

The following is for compatibility across the various Linux platforms. The generic ioctl numbering scheme doesn't really enforce a type field. De facto, however, the top 8 bits of the lower 16 bits are indeed used as a type field, so we might just as well make this explicit here. Please be sure to use the decoding macros below from now on.

IOC_NRMASK = (1 << IOC_NRBITS) - 1
IOC_NRSHIFT = 0
IOC_OUT = IOC_READ << IOC_DIRSHIFT
IOC_SIZEBITS = 14

Let any architecture override either of the following before including this file.

IOC_SIZEMASK = (1 << IOC_SIZEBITS) - 1
IOC_SIZESHIFT = IOC_TYPESHIFT + IOC_TYPEBITS
IOC_TYPEBITS = 8
IOC_TYPEMASK = (1 << IOC_TYPEBITS) - 1
IOC_TYPESHIFT = IOC_NRSHIFT + IOC_NRBITS
IOCSIZE_MASK = IOC_SIZEMASK << IOC_SIZESHIFT
IOCSIZE_SHIFT = IOC_SIZESHIFT
VERSION = "0.1.0"

Instance methods

_IO(type : Char | Int, nr : Int) : UInt32
Source
_IOC(dir : IOC, type : Int | Char, nr : Int, size : Int) : UInt32

Used to create numbers.

Source
_IOC_DIR(dir : IOC)

Decodes ioctl dir number.

Source
_IOC_NR(nr : Int)

Decodes ioctl nr number.

Source
_IOC_SIZE(size : Int)

Decodes ioctl size number.

Source
_IOC_TYPE(type : Char | Int)

Decodes ioctl type number.

Source
_IOR(type : Char | Int, nr : Int, size : T.class) : UInt32 forall T

_IOR means userland is reading and kernel is writing.

Source
_IOW(type : Char | Int, nr : Int, size : T.class) : UInt32 forall T

_IOW means userland is writing and kernel is reading.

Source
_IOWR(type : Char | Int, nr : Int, size : T.class) : UInt32 forall T
Source
ioctl(fd : LibC::Int, request : UInt32, *arguments) : Nil

Executes an ioctl call, and raises in case of an error

Source
ioctl?(fd : LibC::Int, request : UInt32, *arguments) : Errno | Nil

Executes an ioctl call, and returns an Errno in case of an error.

Source

Nested types