From d4ec1ababd275b78da660aad6bd901159daf03bc Mon Sep 17 00:00:00 2001 From: Yoshinori Sugino Date: Wed, 16 Sep 2020 14:04:20 +0900 Subject: [PATCH] fs/vfs/fs_ioctl.c: Add FIOCLEX/FIONCLEX support --- fs/vfs/fs_ioctl.c | 6 ++++++ include/nuttx/fs/ioctl.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/fs/vfs/fs_ioctl.c b/fs/vfs/fs_ioctl.c index b55c9ed940..5f549daad0 100644 --- a/fs/vfs/fs_ioctl.c +++ b/fs/vfs/fs_ioctl.c @@ -194,6 +194,12 @@ int nx_vioctl(int fd, int req, va_list ap) nx_fcntl(fd, F_GETFL) & ~O_NONBLOCK); } break; + case FIOCLEX: + ret = nx_fcntl(fd, F_SETFD, FD_CLOEXEC); + break; + case FIONCLEX: + ret = nx_fcntl(fd, F_SETFD, 0); + break; } } diff --git a/include/nuttx/fs/ioctl.h b/include/nuttx/fs/ioctl.h index 42ccff79fb..7397b96de9 100644 --- a/include/nuttx/fs/ioctl.h +++ b/include/nuttx/fs/ioctl.h @@ -184,6 +184,12 @@ * OUT: Integer that contains device * minor number */ +#define FIOCLEX _FIOC(0x000d) /* IN: None + * OUT: None + */ +#define FIONCLEX _FIOC(0x000e) /* IN: None + * OUT: None + */ /* NuttX file system ioctl definitions **************************************/