haskus-system-0.6.0.0: Haskus system programming framework

Safe HaskellNone
LanguageHaskell2010

Haskus.Arch.Linux.Ioctl

Contents

Description

Linux IOCTL

Bindings from asm-generic/ioctl.h

Warning: some constants may be modified depending on the architecture. For now, we only support X86_64.

Synopsis

Command

data Command Source #

An IOCTL command number

The fields are just conventional. Some IOCTLs don't respect them (e.g., use direction=None while they read and/or write, use non corresponding arg size, etc.)

ioctlCommand :: Direction -> Word8 -> Word8 -> Word -> Command Source #

Encode a command (similar to _IO, _IOR, ... macros)

Signal

ioctlSignalCmd :: (Arg a, MonadIO m) => Command -> a -> Handle -> Flow m '[(), ErrorCode] Source #

Signal, use an arbitrary command

ioctlSignal :: (Arg a, MonadIO m) => CommandType -> CommandNumber -> a -> Handle -> Flow m '[(), ErrorCode] Source #

Signal

ioctlSignalCmdRet :: (Arg a, MonadIO m) => Command -> a -> Handle -> Flow m '[Int64, ErrorCode] Source #

Signal, use an arbitrary command

ioctlSignalRet :: (Arg a, MonadIO m) => CommandType -> CommandNumber -> a -> Handle -> Flow m '[Int64, ErrorCode] Source #

Signal, return the valid returned value

Read

ioctlReadCmd :: (Storable a, MonadInIO m) => Command -> Handle -> Flow m '[a, ErrorCode] Source #

Read a storable, use an arbitrary command

ioctlRead :: (Storable a, MonadInIO m) => CommandType -> CommandNumber -> Handle -> Flow m '[a, ErrorCode] Source #

Read a storable

ioctlReadCmdRet :: (MonadInIO m, Storable a) => Command -> Handle -> Flow m '[(Int64, a), ErrorCode] Source #

Read a storable, use an arbitrary command

ioctlReadRet :: forall a m. (MonadInIO m, Storable a) => CommandType -> CommandNumber -> Handle -> Flow m '[(Int64, a), ErrorCode] Source #

Read a storable, return the valid returned value

ioctlReadBytes :: MonadIO m => CommandType -> CommandNumber -> Word -> Ptr a -> Handle -> Flow m '[Int64, ErrorCode] Source #

Build a Read ioctl that reads the given number of bytes

ioctlReadBuffer :: MonadInIO m => CommandType -> CommandNumber -> Word -> Handle -> Flow m '[(Int64, Buffer), ErrorCode] Source #

Build a Read ioctl that reads the given number of bytes and return them in a Buffer

ioctlReadVariableBuffer :: (Liftable '[ErrorCode] '[b, ErrorCode], MonadInIO m) => CommandType -> CommandNumber -> (Word -> Ptr a -> m b) -> Word -> Handle -> Flow m '[b, ErrorCode] Source #

Build a Read ioctl for variable sized buffers. We expect the ioctl to return the length of the data that can be read. We first try to read with a buffer of defn bytes. If there are data left, we retry with a buffer of the appropriate size.

Write

ioctlWriteCmd :: (Storable a, MonadInIO m) => Command -> a -> Handle -> Flow m '[(), ErrorCode] Source #

Write a storable, use an arbitrary command

ioctlWrite :: (Storable a, MonadInIO m) => CommandType -> CommandNumber -> a -> Handle -> Flow m '[(), ErrorCode] Source #

Write a storable

ioctlWriteCmdRet :: (Storable a, MonadInIO m) => Command -> a -> Handle -> Flow m '[Int64, ErrorCode] Source #

Write a storable, use an arbitrary command

ioctlWriteRet :: forall a m. (Storable a, MonadInIO m) => CommandType -> CommandNumber -> a -> Handle -> Flow m '[Int64, ErrorCode] Source #

Write a storable, return the valid returned value

ioctlWriteValue :: (Storable a, Arg a, MonadIO m) => CommandType -> CommandNumber -> a -> Handle -> Flow m '[(), ErrorCode] Source #

Build a Write IOCTL where the value is directly passed in the arg parameter.

Write / Read

ioctlWriteReadCmd :: (MonadInIO m, Storable a) => Command -> a -> Handle -> Flow m '[a, ErrorCode] Source #

Write and read a storable, use an arbitrary command

ioctlWriteRead :: (Storable a, MonadInIO m) => CommandType -> CommandNumber -> a -> Handle -> Flow m '[a, ErrorCode] Source #

Write and read a storable

ioctlWriteReadCmdRet :: (Storable a, MonadInIO m) => Command -> a -> Handle -> Flow m '[(Int64, a), ErrorCode] Source #

Write and read a storable, use an arbitrary command

ioctlWriteReadRet :: forall a m. (MonadInIO m, Storable a) => CommandType -> CommandNumber -> a -> Handle -> Flow m '[(Int64, a), ErrorCode] Source #

Write and read a storable, return the valid returned value