diff --git a/man7/epoll.7 b/man7/epoll.7 index a4f423da5..8c8e19020 100644 --- a/man7/epoll.7 +++ b/man7/epoll.7 @@ -377,34 +377,32 @@ when using the flag (edge-triggered behavior) ? .TP .B A9 -The answer depends on whether the file descriptor refers to a -stream-oriented file, or to a packet/token-oriented file. -.sp -For a stream oriented file (pipe, FIFO, stream socket): no you don't. Receiving an event from .BR epoll_wait (2) -should suggest to you that such file descriptor is ready -for the requested I/O operation. -You have simply to consider it ready until you will receive the -next +should suggest to you that such +file descriptor is ready for the requested I/O operation. +You have simply to consider it ready until you receive the next .BR EAGAIN . -When and how you will use such file descriptor is entirely up -to you. -Also, the condition that the read/write I/O space is exhausted can -be detected by checking the amount of data read from / written to the target -file descriptor. +When and how you will use the file descriptor is entirely up to you. +.sp +For stream oriented files (e.g., pipe, FIFO, stream socket), the +condition that the read/write I/O space is exhausted can also be detected by +checking the amount of data read from / written to the target file +descriptor. For example, if you call .BR read (2) -by asking to read a certain amount of data and +by asking to read a certain amount of data and .BR read (2) -returns a lower number of bytes, -you can be sure of having exhausted the read -I/O space for such file descriptor. -The same is true when writing using +returns a lower number of bytes, you +can be sure of having exhausted the read I/O space for the file +descriptor. +The same is true when writing using .BR write (2). .sp -For a packet/token-oriented file (e.g., datagram socket, -terminal in canonical mode): yes you do. +For packet/token oriented files (e.g., datagram socket, +terminal in canonical mode), you need to continue to read/write until +.BR EAGAIN , +in order to detect the end of the read/write I/O space. .SS Possible Pitfalls and Ways to Avoid Them .TP .B o Starvation (edge-triggered)