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

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


The following commit(s) were added to refs/heads/master by this push:
     new fa3e0faffc fs: Map FD_SETSIZE to OPEN_MAX instead hardcoding 256
fa3e0faffc is described below

commit fa3e0faffcbf07db58c3301737547bef2e084519
Author: Xiang Xiao <xiaoxi...@xiaomi.com>
AuthorDate: Sun Feb 19 10:40:54 2023 +0800

    fs: Map FD_SETSIZE to OPEN_MAX instead hardcoding 256
    
    and change the default value of LIBC_OPEN_MAX to 256.
    Here has more discussion:
    https://www.mail-archive.com/dev@nuttx.apache.org/msg09095.html
    
    Signed-off-by: Xiang Xiao <xiaoxi...@xiaomi.com>
---
 include/sys/select.h     | 3 ++-
 libs/libc/unistd/Kconfig | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/sys/select.h b/include/sys/select.h
index 956b7d1cdf..01997e9037 100644
--- a/include/sys/select.h
+++ b/include/sys/select.h
@@ -27,6 +27,7 @@
 
 #include <nuttx/config.h>
 
+#include <limits.h>
 #include <stdint.h>
 #include <signal.h>
 #include <sys/time.h>
@@ -37,7 +38,7 @@
 
 /* Get the total number of descriptors that we will have to support */
 
-#define FD_SETSIZE 256
+#define FD_SETSIZE OPEN_MAX
 
 /* We will use a 32-bit bitsets to represent the set of descriptors.  How
  * many uint32_t's do we need to span all descriptors?
diff --git a/libs/libc/unistd/Kconfig b/libs/libc/unistd/Kconfig
index 7cc6bacd23..10f92ae85a 100644
--- a/libs/libc/unistd/Kconfig
+++ b/libs/libc/unistd/Kconfig
@@ -145,7 +145,7 @@ config LIBC_HOSTNAME
 
 config LIBC_OPEN_MAX
        int "OPEN_MAX for this device"
-       default 255
+       default 256
        ---help---
                The maximum number of files that a process can have open
                at any time.  Must not be less than _POSIX_OPEN_MAX.

Reply via email to