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

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

commit 5e499e03add866d7afad6c46bdb12899a4869726
Author: Marco Casaroli <[email protected]>
AuthorDate: Wed Oct 28 17:06:20 2026 +0100

    include/unistd.h: Include <sys/select.h>.
    
    Programs written for other systems use fd_set, FD_SETSIZE, the FD_xxx()
    macros and select() without <sys/select.h>: glibc and the BSDs give
    them through <sys/types.h>, macOS through <unistd.h>.  The earlier
    standard (SUSv2) also lists only <sys/time.h>, <sys/types.h> and
    <unistd.h> for select().  Commit 7b898450356 made <sys/time.h> include
    <sys/select.h> for this reason.  CPython's selectmodule.c, for example,
    includes only <unistd.h> and <sys/types.h>, and does not compile.
    
    Include <sys/select.h> in <unistd.h>, as macOS does.  <sys/types.h>
    cannot include it: <signal.h> includes <time.h>, which includes
    <sys/types.h> before sigset_t and struct timespec are defined, and
    <sys/select.h> needs both.  Nothing that <sys/select.h> includes
    includes <unistd.h>, so there is no include cycle.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 include/unistd.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/unistd.h b/include/unistd.h
index c9bd9b37699..7d949a5e1bd 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -31,6 +31,10 @@
 #include <nuttx/compiler.h>
 #include <limits.h>
 
+/* Programs use fd_set and select() after <unistd.h> alone */
+
+#include <sys/select.h>
+
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/

Reply via email to