fcntl/O_CLOEXEC: add O_CLOEXEC map for hostfs

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
Jiuzhu Dong 2022-07-29 22:30:31 +08:00 committed by Xiang Xiao
parent 31bb362aab
commit 094e986bbd
2 changed files with 6 additions and 0 deletions

View File

@ -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)
{

View File

@ -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)