login
Header Space

 
 

Re: epoll design problems with common fork/exec patterns

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Davide Libenzi <davidel@...>
Cc: David Schwartz <davids@...>, <dada1@...>, Chris "?" Heath <chris@...>, Linux-Kernel@Vger. Kernel. Org <linux-kernel@...>, <linux-man@...>
Date: Tuesday, February 26, 2008 - 11:13 am

Davide Libenzi wrote:

So can I summarize what I understand:

a) Adding the same file descriptor twice to an epoll set will cause an
error (EEXIST).

b) In a separate message to linux-man, Chris Heath says that two threads
*can't* add the same fd twice to an epoll set, despite what the existing
man page text says.  I haven't tested that, but it sounds to me as though
it is likely to be true.  Can you comment please Davide?

c) It is possible to add duplicated file descriptors referring to the same
underlying open file description ("file *").  As you note, this can be a
useful filtering technique, if the two file descriptors specify different
masks.

Assuming that is all correct, for man-pages-2.79, I've reworked the text
for Q1/A1 as follows:

       Q1     What  happens  if you add the same file descriptor
              to an epoll set twice?

       A1     You will probably get EEXIST.  However, it is pos-
              sible   to   add  a  duplicate  (dup(2),  dup2(2),
              fcntl(2) F_DUPFD, fork(2)) descriptor to the  same
              epoll  set.   This  can  be a useful technique for
              filtering events, if the duplicate  file  descrip-
              tors are registered with different events masks.

Seem okay Davide?

Cheers,

Michael

PS I've trimmed the part of this thread about Q6/A6, since I dealt with
that in another thread ("epoll and shared fd's").

-- 
Michael Kerrisk
Maintainer of the Linux man-pages project
http://www.kernel.org/doc/man-pages/
Want to report a man-pages bug?  Look here:
http://www.kernel.org/doc/man-pages/reporting_bugs.html

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
epoll design problems with common fork/exec patterns, Marc Lehmann, (Sat Oct 27, 2:22 am)
Re: epoll design problems with common fork/exec patterns, Davide Libenzi, (Sat Oct 27, 12:59 pm)
RE: epoll design problems with common fork/exec patterns, David Schwartz, (Sun Oct 28, 12:47 am)
RE: epoll design problems with common fork/exec patterns, Davide Libenzi, (Sun Oct 28, 2:48 pm)
RE: epoll design problems with common fork/exec patterns, David Schwartz, (Sun Oct 28, 5:04 pm)
RE: epoll design problems with common fork/exec patterns, Davide Libenzi, (Mon Oct 29, 2:55 pm)
Re: epoll design problems with common fork/exec patterns, Michael Kerrisk, (Tue Feb 26, 11:13 am)
Re: epoll design problems with common fork/exec patterns, Davide Libenzi, (Tue Feb 26, 2:51 pm)
Re: epoll design problems with common fork/exec patterns, Davide Libenzi, (Wed Feb 27, 3:35 pm)
Re: epoll design problems with common fork/exec patterns, Michael Kerrisk, (Thu Feb 28, 9:12 am)
Re: epoll design problems with common fork/exec patterns, Davide Libenzi, (Thu Feb 28, 3:23 pm)
Re: epoll design problems with common fork/exec patterns, Michael Kerrisk, (Fri Feb 29, 11:46 am)
Re: epoll design problems with common fork/exec patterns, Davide Libenzi, (Fri Feb 29, 3:19 pm)
Re: epoll design problems with common fork/exec patterns, Michael Kerrisk, (Fri Feb 29, 3:54 pm)
Re: epoll design problems with common fork/exec patterns, Michael Kerrisk, (Thu Feb 28, 9:23 am)
Re: epoll design problems with common fork/exec patterns, Davide Libenzi, (Thu Feb 28, 3:34 pm)
Re: epoll design problems with common fork/exec patterns, Willy Tarreau, (Sat Oct 27, 1:38 pm)
Re: epoll design problems with common fork/exec patterns, Davide Libenzi, (Sat Oct 27, 2:01 pm)
speck-geostationary