Notice: We have migrated to GitLab launching 2024-05-01 see here: https://gitlab.rtems.org/

#4993 assigned defect

Increase FD_SETSIZE to 256

Reported by: Chris Johns Owned by: Joel Sherrill
Priority: highest Milestone: 6.1
Component: tool/newlib Version: 6
Severity: blocker Keywords:
Cc: Blocked By:
Blocking:

Description (last modified by Chris Johns)

The default for FD_SETSIZE in newlib is 64. This is proving to be too small for EPICS applications. EPICS limits the number of descriptors here for RTEMS 6 builds. The comment in EPICS base is:

/* Note: The select() system call can only be used with the first FD_SETSIZE
 *       File Descriptors (newlib default is 64).  Beginning RTEMS 5.1, FDs are
 *       allocated sequentially.  So changing this CONFIGURE parameter such
 *       that CONFIGURE_MAXIMUM_FILE_DESCRIPTORS >= FD_SETSIZE will likely
 *       cause applications making select() calls to fault at some point.
 *
 *       IOC core components (libca and RSRV) do not make select() calls.
 *
 *       Applications and driver code using poll() or other socket
 *       multiplexers do not share this limitation.
 *
 *       cf. https://github.com/epics-base/epics-base/issues/300
 */

Increasing FD_SETSIZE to 256 will increase the set but 64 is too small for RTEMS and we do not need 1024 that systems like FreeBSD have.

Attachments (2)

0001-RTEMS-Increase-FS_SETSIZE-to-256-bits.patch (690 bytes) - added by Chris Johns on 02/20/24 at 23:23:53.
Newlib patch to increase the FD_SETSIZE from 64 to 256 bits per set
0001-rtems-newlib-Increase-FD_SETSIZE-to-256.patch (1.0 KB) - added by Chris Johns on 02/20/24 at 23:36:43.
RSB patch to apply the newlib patch. Please use for testing.

Download all attachments as: .zip

Change History (8)

comment:1 Changed on 02/19/24 at 22:38:17 by Chris Johns

Owner: set to Chris Johns
Status: newassigned

Changed on 02/20/24 at 23:23:53 by Chris Johns

Newlib patch to increase the FD_SETSIZE from 64 to 256 bits per set

comment:2 Changed on 02/20/24 at 23:24:12 by Chris Johns

Summary: Increase FD_SIZE to 256Increase FD_SETSIZE to 256

comment:3 Changed on 02/20/24 at 23:24:35 by Chris Johns

Description: modified (diff)

Changed on 02/20/24 at 23:36:43 by Chris Johns

RSB patch to apply the newlib patch. Please use for testing.

comment:4 Changed on 02/20/24 at 23:43:41 by Chris Johns

LibBSD select() call is https://git.rtems.org/rtems-libbsd/tree/freebsd/sys/kern/sys_generic.c?h=6-freebsd-12#n998 and it says:

/*
 * The magic 2048 here is chosen to be just enough for FD_SETSIZE
 * infds with the new FD_SETSIZE of 1024, and more than enough for
 * FD_SETSIZE infds, outfds and exceptfds with the old FD_SETSIZE
 * of 256.
 */

comment:5 Changed on 02/28/24 at 22:56:01 by Chris Johns

Owner: changed from Chris Johns to Joel Sherrill

comment:6 Changed on 02/28/24 at 23:03:31 by Joel Sherrill

Patch submitted to newlib. When I get acked to push it, I will let you know so you can bump the newlib hash to pick the change to 256 up.

Note: See TracTickets for help on using tickets.