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>
_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"
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