История изменений
Исправление dhampire, (текущая версия) :
в q1/a1 и q6/a6 man 7 epoll разве не это описано ?
1. What happens if you register the same file descriptor on an
epoll instance twice?
You will probably get EEXIST. However, it is possible to add
a duplicate (dup(2), dup2(2), fcntl(2) F_DUPFD) file
descriptor to the same epoll instance. This can be a useful
technique for filtering events, if the duplicate file
descriptors are registered with different events masks.
6. Will closing a file descriptor cause it to be removed from
all epoll interest lists?
Yes, but be aware of the following point. A file descriptor
is a reference to an open file description (see open(2)).
Whenever a file descriptor is duplicated via dup(2), dup2(2),
fcntl(2) F_DUPFD, or fork(2), a new file descriptor referring
to the same open file description is created. An open file
description continues to exist until all file descriptors
referring to it have been closed.
A file descriptor is removed from an interest list only after
all the file descriptors referring to the underlying open
file description have been closed. This means that even
after a file descriptor that is part of an interest list has
been closed, events may be reported for that file descriptor
if other file descriptors referring to the same underlying
file description remain open. To prevent this happening, the
file descriptor must be explicitly removed from the interest
list (using epoll_ctl(2) EPOLL_CTL_DEL) before it is
duplicated. Alternatively, the application must ensure that
all file descriptors are closed (which may be difficult if
file descriptors were duplicated behind the scenes by library
functions that used dup(2) or fork(2)).
добавлено впервые a6 https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/?id=a4a120c7681a80594f6d9f58c83c0aec7525e261
с этого комммита вроде никаких изменений нет https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/?id=d1d87801792096cd68e73811ee0022c0524f6c69
Исходная версия dhampire, :
в q1/a1 и q6/a6 man 7 epoll разве не это описано ?
1. What happens if you register the same file descriptor on an
epoll instance twice?
You will probably get EEXIST. However, it is possible to add
a duplicate (dup(2), dup2(2), fcntl(2) F_DUPFD) file
descriptor to the same epoll instance. This can be a useful
technique for filtering events, if the duplicate file
descriptors are registered with different events masks.
6. Will closing a file descriptor cause it to be removed from
all epoll interest lists?
Yes, but be aware of the following point. A file descriptor
is a reference to an open file description (see open(2)).
Whenever a file descriptor is duplicated via dup(2), dup2(2),
fcntl(2) F_DUPFD, or fork(2), a new file descriptor referring
to the same open file description is created. An open file
description continues to exist until all file descriptors
referring to it have been closed.
A file descriptor is removed from an interest list only after
all the file descriptors referring to the underlying open
file description have been closed. This means that even
after a file descriptor that is part of an interest list has
been closed, events may be reported for that file descriptor
if other file descriptors referring to the same underlying
file description remain open. To prevent this happening, the
file descriptor must be explicitly removed from the interest
list (using epoll_ctl(2) EPOLL_CTL_DEL) before it is
duplicated. Alternatively, the application must ensure that
all file descriptors are closed (which may be difficult if
file descriptors were duplicated behind the scenes by library
functions that used dup(2) or fork(2)).
добавлено впервые q6 https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/?id=a4a120c7681a80594f6d9f58c83c0aec7525e261
с этого комммита вроде никаких изменений нет https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/?id=d1d87801792096cd68e73811ee0022c0524f6c69