Home

EPOLLOUT

EPOLLOUT is a flag used by the Linux epoll I/O event notification facility. It indicates that a file descriptor is currently ready for write operations; a non-blocking write to the descriptor should not block. It is used with epoll_ctl to register the flag and with epoll_wait to retrieve events. Commonly applied to sockets and pipes, where the write queue has space.

When using non-blocking I/O, you may register for EPOLLOUT when you have data to send, or re-arm

Notes and caveats: For regular files EPOLLOUT is typically always set; epoll may continuously report it, so

it
after
a
failed
write.
If
epoll_wait
returns
an
event
with
EPOLLOUT
set,
you
should
attempt
to
write
as
much
data
as
possible.
If
the
write
returns
EAGAIN
or
EWOULDBLOCK,
you
should
stop
and
wait
for
the
next
EPOLLOUT.
it
is
less
useful
there.
In
edge-triggered
mode
you
must
drain
the
socket
completely
to
avoid
missing
a
future
event;
in
level-triggered
mode
epoll_wait
will
continue
to
report
EPOLLOUT
as
long
as
the
descriptor
remains
writable.
Practically,
many
implementations
enable
EPOLLOUT
only
when
there
is
data
to
send,
and
disable
it
again
once
all
data
has
been
written.