]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
select.2: Strengthen the warning regarding the low value of FD_SETSIZE
authorMichael Kerrisk <mtk.manpages@gmail.com>
Wed, 19 May 2021 21:51:18 +0000 (09:51 +1200)
committerMichael Kerrisk <mtk.manpages@gmail.com>
Wed, 19 May 2021 23:00:11 +0000 (11:00 +1200)
All modern code should avoid select(2) in favor of poll(2)
or epoll(7).

For a long history of this problem, see:

https://marc.info/?l=bugtraq&m=110660879328901
    List:       bugtraq
    Subject:    SECURITY.NNOV: Multiple applications fd_set structure bitmap array index overflow
    From:       3APA3A <3APA3A () security ! nnov ! ru>
    Date:       2005-01-24 20:30:08

https://sourceware.org/legacy-ml/libc-alpha/2003-05/msg00171.html
    User-settable FD_SETSIZE and select()
    From: mtk-lists at gmx dot net
    To: libc-alpha at sources dot redhat dot com
    Date: Mon, 19 May 2003 14:49:03 +0200 (MEST)
    Subject: User-settable FD_SETSIZE and select()

https://sourceware.org/bugzilla/show_bug.cgi?id=10352

http://0pointer.net/blog/file-descriptor-limits.html
https://twitter.com/pid_eins/status/1394962183033868292

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
man2/select.2

index b778c48cce0958128ff35ce0cadfc59553d6563a..aee25c52c0b0a335497aa336c6c9cbd69151b78b 100644 (file)
@@ -70,6 +70,18 @@ Feature Test Macro Requirements for glibc (see
     _POSIX_C_SOURCE >= 200112L
 .fi
 .SH DESCRIPTION
+.BR "WARNING" :
+.BR select ()
+can monitor only file descriptors numbers that are less than
+.BR FD_SETSIZE
+(1024)\(eman unreasonably low limit for many modern applications\(emand
+this limitation will not change.
+All modern applications should instead use
+.BR poll (2)
+or
+.BR epoll (7),
+which do not suffer this limitation.
+.PP
 .BR select ()
 allows a program to monitor multiple file descriptors,
 waiting until one or more of the file descriptors become "ready"
@@ -80,15 +92,6 @@ perform a corresponding I/O operation (e.g.,
 or a sufficiently small
 .BR write (2))
 without blocking.
-.PP
-.BR select ()
-can monitor only file descriptors numbers that are less than
-.BR FD_SETSIZE ;
-.BR poll (2)
-and
-.BR epoll (7)
-do not have this limitation.
-See BUGS.
 .\"
 .SS File descriptor sets
 The principal arguments of