| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Linux.Epoll
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 (a :: Exchange) where
- data Event (a :: Exchange) b where
- data Exchange
- class PrimEpollData a
- closeOnExec :: EpollFlags
- add :: ControlOperation
- modify :: ControlOperation
- delete :: ControlOperation
- input :: forall (e :: Exchange). Events e
- output :: forall (e :: Exchange). Events e
- priority :: forall (e :: Exchange). Events e
- hangup :: Events 'Response
- readHangup :: forall (e :: Exchange). Events e
- error :: Events 'Response
- edgeTriggered :: Events 'Request
- containsAnyEvents :: forall (e :: Exchange). Events e -> Events e -> Bool
- containsAllEvents :: forall (e :: Exchange). Events e -> Events e -> Bool
- sizeofEvent :: Int
- peekEventEvents :: forall (e :: Exchange). 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 #
Arguments
| :: EpollFlags | Flags |
| -> IO (Either Errno Fd) |
Wait
Arguments
| :: 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 #
Arguments
| :: 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 #
Arguments
| :: 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 #
Constructors
| EpollFlags CInt |
Instances
newtype ControlOperation Source #
Constructors
| ControlOperation CInt |
Instances
| Eq ControlOperation Source # | |
Defined in Linux.Epoll.Types Methods (==) :: ControlOperation -> ControlOperation -> Bool # (/=) :: ControlOperation -> ControlOperation -> Bool # | |
newtype Events (a :: Exchange) where Source #
Instances
data Event (a :: Exchange) b 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.
Constructors
| Event | |
Instances
| PrimEpollData a => Prim (Event e a) Source # | |
Defined in Linux.Epoll.Types Methods sizeOfType# :: Proxy (Event e a) -> Int# # sizeOf# :: Event e a -> Int# # alignmentOfType# :: Proxy (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 #
Minimal complete definition
indexByteArrayEpoll, readByteArrayEpoll, writeByteArrayEpoll, indexOffAddrEpoll, readOffAddrEpoll, writeOffAddrEpoll
Instances
| PrimEpollData Word64 Source # | Since |
Defined in Linux.Epoll.Types Methods indexByteArrayEpoll :: forall (e :: Exchange). ByteArray# -> Int# -> Event e Word64 readByteArrayEpoll :: forall s (e :: Exchange). MutableByteArray# s -> Int# -> State# s -> (# State# s, Event e Word64 #) writeByteArrayEpoll :: forall s (e :: Exchange). MutableByteArray# s -> Int# -> Event e Word64 -> State# s -> State# s indexOffAddrEpoll :: forall (e :: Exchange). Addr# -> Int# -> Event e Word64 readOffAddrEpoll :: forall s (e :: Exchange). Addr# -> Int# -> State# s -> (# State# s, Event e Word64 #) writeOffAddrEpoll :: forall (e :: Exchange) s. Addr# -> Int# -> Event e Word64 -> State# s -> State# s | |
| PrimEpollData Fd Source # | |
Defined in Linux.Epoll.Types Methods indexByteArrayEpoll :: forall (e :: Exchange). ByteArray# -> Int# -> Event e Fd readByteArrayEpoll :: forall s (e :: Exchange). MutableByteArray# s -> Int# -> State# s -> (# State# s, Event e Fd #) writeByteArrayEpoll :: forall s (e :: Exchange). MutableByteArray# s -> Int# -> Event e Fd -> State# s -> State# s indexOffAddrEpoll :: forall (e :: Exchange). Addr# -> Int# -> Event e Fd readOffAddrEpoll :: forall s (e :: Exchange). Addr# -> Int# -> State# s -> (# State# s, Event e Fd #) writeOffAddrEpoll :: forall (e :: Exchange) s. Addr# -> Int# -> Event e Fd -> State# s -> State# s | |
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.
input :: forall (e :: Exchange). Events e Source #
The EPOLLIN event. Can appear in a request or a response.
output :: forall (e :: Exchange). Events e Source #
The EPOLLOUT event. Can appear in a request or a response.
priority :: forall (e :: Exchange). Events e Source #
The EPOLLPRI event. Can appear in a request or a response.
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 :: forall (e :: Exchange). 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 :: forall (e :: Exchange). Events e -> Events e -> Bool Source #
Does the first event set contain any of the events from the second one?
containsAllEvents :: forall (e :: Exchange). 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 #