You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2020/09/16 09:31:54 UTC

[incubator-nuttx] 01/02: fs/vfs/fs_ioctl.c: Add FIOCLEX/FIONCLEX support

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

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

commit d4ec1ababd275b78da660aad6bd901159daf03bc
Author: Yoshinori Sugino <ys...@gmail.com>
AuthorDate: Wed Sep 16 14:04:20 2020 +0900

    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 b55c9ed..5f549da 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 42ccff7..7397b96 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 **************************************/