Further work on Q6/A6, plus added some .\" comments for Q1/A1.

This commit is contained in:
Michael Kerrisk 2008-02-29 16:08:02 +00:00
parent 146c1764f0
commit d377b54d0a
1 changed files with 11 additions and 10 deletions

View File

@ -247,7 +247,7 @@ set?
.B A0 .B A0
The key is the combination of the file descriptor number and The key is the combination of the file descriptor number and
the open file description the open file description
(also known as "open file handle", (also known as an "open file handle",
the kernel's internal representation of an open file). the kernel's internal representation of an open file).
.TP .TP
.B Q1 .B Q1
@ -267,7 +267,8 @@ descriptor to the same
.B epoll .B epoll
set. set.
.\" But a descriptor duplicated by fork(2) can't be added to the .\" But a descriptor duplicated by fork(2) can't be added to the
.\" set, which is an ugly inconsistency. On the one hand, a child process .\" set, because the [file *, fd] pair is already in the epoll set.
.\" That is a somewhat ugly inconsistency. On the one hand, a child process
.\" cannot add the duplicate file descriptor to the epoll set. (In every .\" cannot add the duplicate file descriptor to the epoll set. (In every
.\" other case that I can think of, descriptors duplicated by fork have .\" other case that I can think of, descriptors duplicated by fork have
.\" similar semantics to descriptors duplicated by dup() and friends.) On .\" similar semantics to descriptors duplicated by dup() and friends.) On
@ -275,11 +276,10 @@ set.
.\" descriptor means that even if the parent closes its descriptor, then .\" descriptor means that even if the parent closes its descriptor, then
.\" epoll_wait() in the parent will continue to receive notifications for .\" epoll_wait() in the parent will continue to receive notifications for
.\" that descriptor because of the duplicated descriptor in the child. .\" that descriptor because of the duplicated descriptor in the child.
.\"
.\" The choice of [file *, fd] as the key for epoll sets really does seem
.\" unfortunate. Keying on [pid, fd] would probably have given saner
.\" semantics. Obviously it can't be changed now though.
.\" .\"
.\" See http://thread.gmane.org/gmane.linux.kernel/596462/
.\" "epoll design problems with common fork/exec patterns"
.\"
.\" mtk, Feb 2008 .\" mtk, Feb 2008
This can be a useful technique for filtering events, This can be a useful technique for filtering events,
if the duplicate file descriptors are registered with different if the duplicate file descriptors are registered with different
@ -354,12 +354,13 @@ a new file descriptor referring to the same open file description is
created. created.
An open file description continues to exist until all An open file description continues to exist until all
file descriptors referring to it have been closed. file descriptors referring to it have been closed.
The A file descriptor is removed from an
.B epoll
interface automatically removes a file descriptor from an
.B epoll .B epoll
set only after all the file descriptors referring to the underlying set only after all the file descriptors referring to the underlying
open file description have been closed. open file description have been closed
(or after if the descriptor is explicitly removed using
.BR epoll_ctl ()
.BR EPOLL_CTL_DEL ).
This means that even after a file descriptor that is part of an This means that even after a file descriptor that is part of an
.B epoll .B epoll
set has been closed, set has been closed,