From 2b22933411d2b2506ca981ff98ee068757a1f719 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Tue, 26 Feb 2008 13:29:34 +0000 Subject: [PATCH] Rework Q1/A1, describing what happens when adding the same file descriptor twice to an epoll set, and when adding duplicate file descriptors to the same epoll set. --- man7/epoll.7 | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/man7/epoll.7 b/man7/epoll.7 index 535ba03d2..49150fb4e 100644 --- a/man7/epoll.7 +++ b/man7/epoll.7 @@ -239,9 +239,19 @@ What happens if you add the same file descriptor to an epoll set twice? .B A1 You will probably get .BR EEXIST . -However, it is possible that two -threads may add the same file descriptor twice. -This is a harmless condition. +However, it is possible to add a duplicate +.RB ( dup (2), +.BR dup2 (2), +.BR fcntl (2) +.BR F_DUPFD , +.BR fork (2)) +descriptor to the same +.B epoll +set. +This can be a useful technique for filtering events, +if the duplicate file descriptors are registered with different +.I events +masks. .TP .B Q2 Can two