Home

EPOLLIN

EPOLLIN is a flag used with the Linux epoll I/O event notification facility. It indicates that a monitored file descriptor is currently ready for reading and that a read operation will not block. In practice, EPOLLIN is set for sockets, pipes, or other file descriptors when there is data available to be read, or when the other end has closed the connection (end-of-file).

EPOLLIN is specified in the events mask of an epoll_event structure used with epoll_ctl to add or

Edge-triggered vs level-triggered: In level-triggered mode (default), EPOLLIN remains set as long as there is data

EPOLLIN is Linux-specific and defined in include/linux/epoll.h or sys/epoll.h, part of the epoll API introduced in

modify
interest
in
a
file
descriptor,
and
is
returned
by
epoll_wait
when
the
condition
is
met.
When
epoll_wait
reports
EPOLLIN,
a
subsequent
read
call
on
the
descriptor
will
usually
return
immediately
with
the
data.
If
the
peer
has
performed
an
orderly
shutdown,
a
read
may
return
0.
to
read,
which
may
cause
repeated
events
if
you
don't
drain
the
data.
In
edge-triggered
mode
(EPOLLET),
epoll_wait
emits
a
single
notification
when
the
state
changes
to
ready,
requiring
the
code
to
drain
the
file
descriptor
completely,
repeatedly
reading
until
EAGAIN.
Linux
2.6.
Related
flags
include
EPOLLOUT
(ready
for
write),
EPOLLERR
(error),
EPOLLHUP
(hang
up),
EPOLLRDHUP
(remote
hang
up),
and
EPOLLET
(edge-triggered
behavior).