diff --git a/arch/sim/src/sim/up_hostfs.c b/arch/sim/src/sim/up_hostfs.c index 151799e58f..c3188c5946 100644 --- a/arch/sim/src/sim/up_hostfs.c +++ b/arch/sim/src/sim/up_hostfs.c @@ -181,6 +181,11 @@ int host_open(const char *pathname, int flags, nuttx_mode_t mode) } #endif + if (flags & NUTTX_O_CLOEXEC) + { + mapflags |= O_CLOEXEC; + } + int ret = open(pathname, mapflags, mode); if (ret == -1) { diff --git a/include/nuttx/fs/hostfs.h b/include/nuttx/fs/hostfs.h index 499565b4c6..6773512ef4 100644 --- a/include/nuttx/fs/hostfs.h +++ b/include/nuttx/fs/hostfs.h @@ -84,6 +84,7 @@ #define NUTTX_O_SYNC (1 << 7) /* Synchronize output on write */ #define NUTTX_O_BINARY (1 << 8) /* Open the file in binary mode. */ #define NUTTX_O_DIRECT (1 << 9) /* Avoid caching, write directly to hardware */ +#define NUTTX_O_CLOEXEC (1 << 10) /* Close on execute */ #define NUTTX_O_RDWR (NUTTX_O_RDONLY | NUTTX_O_WRONLY)