From 69eb01fd6186acb8b6522cb44feab66b04f1f8f7 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Sat, 16 Jun 2007 05:58:39 +0000 Subject: [PATCH] rewordings/edits --- man7/epoll.7 | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/man7/epoll.7 b/man7/epoll.7 index 23766780e..e965e1386 100644 --- a/man7/epoll.7 +++ b/man7/epoll.7 @@ -50,33 +50,28 @@ The .B epoll event distribution interface is able to behave both as edge-triggered (ET) and level-triggered (LT). -The difference between ET and LT -event distribution mechanism can be described as follows. +The difference between the two mechanisms +can be described as follows. Suppose that this scenario happens : -.TP -.B 1 +.IP 1. 3 The file descriptor that represents the read side of a pipe .RI ( rfd ) is added inside the .B epoll device. -.TP -.B 2 -A pipe writer writes 2Kb of data on the write side of the pipe. -.TP -.B 3 +.IP 2. +A pipe writer writes 2 kB of data on the write side of the pipe. +.IP 3. A call to .BR epoll_wait (2) is done that will return .I rfd as a ready file descriptor. -.TP -.B 4 -The pipe reader reads 1Kb of data from +.IP 4. +The pipe reader reads 1 kB of data from .IR rfd . -.TP -.B 5 +.IP 5. A call to .BR epoll_wait (2) is done. @@ -89,14 +84,14 @@ interface using the .B EPOLLET flag, the call to .BR epoll_wait (2) -done in step +done in step .B 5 will probably hang despite the available data still present in the file input buffer; meanwhile the remote peer might be expecting a response based on the data it already sent. -The reason for this is that edge-triggered event -distribution delivers events only when events happens on the monitored file. +The reason for this is that edge-triggered mode only +delivers events when changes occur on the monitored file descriptor. So, in step .B 5 the caller might end up waiting for some data that is already present inside @@ -131,7 +126,7 @@ interface is as follows: with non-blocking file descriptors .TP .B ii -by going to wait for an event only after +by waiting for an event only after .BR read (2) or .BR write (2) @@ -218,7 +213,7 @@ for(;;) { When used as an edge-triggered interface, for performance reasons, it is possible to add the file descriptor inside the epoll interface .RB ( EPOLL_CTL_ADD ) -) once by specifying +once by specifying .RB ( EPOLLIN | EPOLLOUT ). This allows you to avoid continuously switching between @@ -232,7 +227,7 @@ with .SS Questions and Answers .TP .B Q1 -What happens if you add the same file descriptor to an epoll_set twice? +What happens if you add the same file descriptor to an epoll set twice? .TP .B A1 You will probably get EEXIST.