Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- uninterruptibleCreate :: CInt -> IO (Either Errno Fd)
- uninterruptibleCreate1 :: EpollFlags -> IO (Either Errno Fd)
- waitMutablePrimArray :: Fd -> MutablePrimArray RealWorld (Event Response a) -> CInt -> CInt -> IO (Either Errno CInt)
- uninterruptibleWaitMutablePrimArray :: Fd -> MutablePrimArray RealWorld (Event Response a) -> CInt -> IO (Either Errno CInt)
- uninterruptibleControlMutablePrimArray :: Fd -> ControlOperation -> Fd -> MutablePrimArray RealWorld (Event Request a) -> IO (Either Errno ())
- newtype EpollFlags = EpollFlags CInt
- newtype ControlOperation = ControlOperation CInt
- newtype Events :: Exchange -> Type where
- data Event :: Exchange -> Type -> Type where
- data Exchange
- class PrimEpollData a
- closeOnExec :: EpollFlags
- add :: ControlOperation
- modify :: ControlOperation
- delete :: ControlOperation
- input :: Events e
- output :: Events e
- priority :: Events e
- hangup :: Events Response
- readHangup :: Events e
- error :: Events Response
- edgeTriggered :: Events Request
- containsAnyEvents :: Events e -> Events e -> Bool
- containsAllEvents :: Events e -> Events e -> Bool
- sizeofEvent :: Int
- peekEventEvents :: Addr -> IO (Events e)
- peekEventDataFd :: Addr -> IO Fd
- peekEventDataPtr :: Addr -> IO Addr
- peekEventDataU32 :: Addr -> IO Word32
- peekEventDataU64 :: Addr -> IO Word64
- pokeEventDataU64 :: Addr -> Word64 -> IO ()
Functions
Create
uninterruptibleCreate1 Source #
:: EpollFlags | Flags |
-> IO (Either Errno Fd) |
Wait
:: Fd | EPoll file descriptor |
-> MutablePrimArray RealWorld (Event Response a) | Event buffer, must be pinned |
-> CInt | Maximum events |
-> CInt | Timeout in milliseconds, use |
-> IO (Either Errno CInt) | Number of events received |
Wait for an I/O event on an epoll file descriptor. The Linux man page includes more details. The event buffer must be a pinned byte array.
uninterruptibleWaitMutablePrimArray Source #
:: Fd | EPoll file descriptor |
-> MutablePrimArray RealWorld (Event Response a) | Event buffer |
-> CInt | Maximum events |
-> IO (Either Errno CInt) | Number of events received |
Wait for an I/O event on an epoll file descriptor. The
Linux man page
includes more details. The timeout
argument is omitted
since it is nonsense to choose anything other than 0 when
using the unsafe FFI.
Control
uninterruptibleControlMutablePrimArray Source #
:: Fd | EPoll file descriptor ( |
-> ControlOperation | Operation: |
-> Fd | File descriptor whose registration will be affected |
-> MutablePrimArray RealWorld (Event Request a) | A single event. This is read from, not written to. |
-> IO (Either Errno ()) |
Add, modify, or remove entries in the interest list of the
epoll instance referred to by the file descriptor epfd
.
Linux man page
includes more details.
Types
newtype EpollFlags Source #
Instances
newtype ControlOperation Source #
Instances
Eq ControlOperation Source # | |
Defined in Linux.Epoll.Types (==) :: ControlOperation -> ControlOperation -> Bool # (/=) :: ControlOperation -> ControlOperation -> Bool # |
newtype Events :: Exchange -> Type where Source #
Instances
data Event :: Exchange -> Type -> Type where Source #
A data type corresponding to struct epoll_event
. Linux
defines this as:
typedef union epoll_data { void *ptr; int fd; uint32_t u32; uint64_t u64; } epoll_data_t; struct epoll_event { uint32_t events; /* Epoll events */ epoll_data_t data; /* User data variable */ };
It is a little difficult to capture what this type conveys, but
we make an attempt. The second argument to the Event
type
constructor is either Addr
, Fd
, Word32
, or Word64
. This
corresponds to the four possibilities in the epoll_data
union
type. As long as the user monomorphizes this type when using
it, there should not be any performance penalty for the
flexibility afforded by this approach.
Instances
PrimEpollData a => Prim (Event e a) Source # | |
Defined in Linux.Epoll.Types sizeOf# :: Event e a -> Int# # alignment# :: Event e a -> Int# # indexByteArray# :: ByteArray# -> Int# -> Event e a # readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (#State# s, Event e a#) # writeByteArray# :: MutableByteArray# s -> Int# -> Event e a -> State# s -> State# s # setByteArray# :: MutableByteArray# s -> Int# -> Int# -> Event e a -> State# s -> State# s # indexOffAddr# :: Addr# -> Int# -> Event e a # readOffAddr# :: Addr# -> Int# -> State# s -> (#State# s, Event e a#) # writeOffAddr# :: Addr# -> Int# -> Event e a -> State# s -> State# s # setOffAddr# :: Addr# -> Int# -> Int# -> Event e a -> State# s -> State# s # |
Classes
class PrimEpollData a Source #
indexByteArrayEpoll, readByteArrayEpoll, writeByteArrayEpoll, indexOffAddrEpoll, readOffAddrEpoll, writeOffAddrEpoll
Instances
Constants
closeOnExec :: EpollFlags Source #
The EPOLL_CLOEXEC
flag.
add :: ControlOperation Source #
The EPOLL_CTL_ADD
control operation.
modify :: ControlOperation Source #
The EPOLL_CTL_MOD
control operation.
delete :: ControlOperation Source #
The EPOLL_CTL_DEL
control operation.
hangup :: Events Response Source #
The EPOLLHUP
event. The
epoll_ctl documentation says
"epoll_wait
will always wait for this event; it is not necessary to set it in events
".
Consequently, in this library, it has been marked as only appearing in Response
positions.
readHangup :: Events e Source #
The EPOLLRDHUP
event. Can appear in a request or a response.
error :: Events Response Source #
The EPOLLERR
event. The
epoll_ctl documentation says
"epoll_wait
will always wait for this event; it is not necessary to set it in events
".
Consequently, in this library, it has been marked as only appearing in Response
positions.
edgeTriggered :: Events Request Source #
The EPOLLET
event. Only appears in requests.
Events Combinators
containsAnyEvents :: Events e -> Events e -> Bool Source #
Does the first event set contain any of the events from the second one?
containsAllEvents :: Events e -> Events e -> Bool Source #
Does the first event set entirely contain the second one? That is, is the second argument a subset of the first?
Marshalling
sizeofEvent :: Int Source #