xiaoxiang781216 commented on code in PR #16361:
URL: https://github.com/apache/nuttx/pull/16361#discussion_r2094175112


##########
fs/vfs/fs_fcntl.c:
##########
@@ -91,7 +91,7 @@ static int file_vfcntl(FAR struct file *filep, int cmd, 
va_list ap)
          */
 
         {
-          ret = filep->f_oflags & O_CLOEXEC ? FD_CLOEXEC : 0;
+          ret = nx_fcntl(fd, F_GETFD, 0);

Review Comment:
   where do we implement nx_fcntl



##########
include/nuttx/fs/fs.h:
##########
@@ -466,6 +466,15 @@ struct file
   off_t             f_pos;      /* File position */
   FAR struct inode *f_inode;    /* Driver or file system interface */
   FAR void         *f_priv;     /* Per file driver private data */
+#if CONFIG_FS_LOCK_BUCKET_SIZE > 0
+  bool              locked;     /* Filelock state: false - unlocked, true - 
locked */
+#endif
+};
+
+struct fd
+{
+  FAR struct file  *f_file;      /* The file associated with descriptor */
+  bool              f_cloexec;   /* Close on exec */
 #ifdef CONFIG_FDSAN

Review Comment:
   move after line 484 to reduce the whole between fields



##########
fs/vfs/fs_fcntl.c:
##########
@@ -46,7 +46,7 @@
  * Name: file_vfcntl
  ****************************************************************************/
 
-static int file_vfcntl(FAR struct file *filep, int cmd, va_list ap)
+static int file_vfcntl(FAR struct file *filep, int cmd, va_list ap, int fd)

Review Comment:
   remove fd, we should move the handle of 
F_DUPFD/F_DUPFD_CLOEXEC/F_GETFD/F_SETFD to fcntl and call dup instead



##########
fs/vfs/fs_ioctl.c:
##########
@@ -43,7 +43,7 @@
  * Name: file_vioctl
  ****************************************************************************/
 
-static int file_vioctl(FAR struct file *filep, int req, va_list ap)
+static int file_vioctl(FAR struct file *filep, int req, va_list ap, int fd)

Review Comment:
   remove fd, we should move 
FIOCLEX/FIONCLEX/FIOC_SETTAG_FDSAN/FIOC_GETTAG_FDSAN/FIOC_SETTAG_FDCHECK/FIOC_GETTAG_FDCHECK
 to ioctl



##########
fs/vfs/fs_open.c:
##########
@@ -372,7 +372,7 @@ int file_open(FAR struct file *filep, FAR const char *path, 
int oflags, ...)
 
   if (ret >= OK)
     {
-      FS_ADD_BACKTRACE(filep);
+      FS_ADD_BACKTRACE(fdlist_fdget(nxsched_get_fdlist(), ret));

Review Comment:
   need move to nx_vopen



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to