This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 5603eacdb3a8d4a5a0bbc1b834d5a7451f6be1a4
Author: Marco Casaroli <[email protected]>
AuthorDate: Tue Oct 27 18:43:18 2026 +0100

    include/sys/select.h: Add fd_mask and NFDBITS.
    
    fd_mask (the element type of fd_set) and NFDBITS (its number of bits)
    are in the <sys/select.h> of the BSDs, glibc and musl, and programs use
    them.  Some configure scripts also look for fd_mask in <sys/select.h> to
    find fd_set there: Tcl's did not find it and took int for the select()
    masks, which then did not compile.
    
    fd_set does not change: its element type was already uint32_t.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 include/sys/select.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/sys/select.h b/include/sys/select.h
index d7c6b7b5496..0dde1decd35 100644
--- a/include/sys/select.h
+++ b/include/sys/select.h
@@ -53,6 +53,10 @@
 
 #define __SELECT_NUINT32 ((FD_SETSIZE + 31) / 32)
 
+/* The number of bits in one fd_mask, the element type of fd_set */
+
+#define NFDBITS (8 * (int)sizeof(fd_mask))
+
 /* These macros map a file descriptor to an index and bit number */
 
 #define _FD_NDX(fd) ((fd) >> 5)
@@ -82,9 +86,11 @@
  * Type Definitions
  ****************************************************************************/
 
+typedef uint32_t fd_mask;
+
 struct fd_set_s
 {
-  uint32_t arr[__SELECT_NUINT32];
+  fd_mask arr[__SELECT_NUINT32];
 };
 
 typedef struct fd_set_s fd_set;

Reply via email to