walnux/fs/vfs
zhangshoukui f57a5a6802 fs/vfs/fs_dup.c: before file_allocate should restore minfd if define FDCHECK
When we use fcntl for dup, an fd is directly passed. If we have opened FDCHECK. we need to restore this file descriptor.

open FDCHECK and test this:

`
int main(int ac, char **av)
{
  int fd1= open("./1.txt", O_WRONLY | O_CREAT, 0666);
  if (fd1 < 0)
    {
      printf("open err\n");
      return fd1;
  }

  int fd2= open("./2.txt", O_WRONLY | O_CREAT, 0666);
  if (fd2 < 0)
    {
      printf("open err\n");
      close(fd1);
      return fd2;
    }

  //close(fd2);
  int fd3 = fcntl(fd1, F_DUPFD, fd2);
  printf("fd3 = %d\n", fd3);
  close(fd1);
  close(fd3);
  return 0;
}
`

Signed-off-by: zhangshoukui <zhangshoukui@xiaomi.com>
2025-05-15 16:51:40 -03:00
..
CMakeLists.txt fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_chstat.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_close.c fs/close: move inode to last to void race condition 2025-05-14 15:02:38 +08:00
fs_dir.c Use lib_get_pathbuffer instead of stack variables 2024-11-12 17:21:42 +08:00
fs_dup.c fs/vfs/fs_dup.c: before file_allocate should restore minfd if define FDCHECK 2025-05-15 16:51:40 -03:00
fs_dup2.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_epoll.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_eventfd.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_fchstat.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_fcntl.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_fstat.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_fstatfs.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_fsync.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_ioctl.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_link.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_lock.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_lseek.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_mkdir.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_open.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_poll.c fs/vfs/fs_poll: Add noinstrument_function to poll_notify function 2025-03-18 09:17:52 +08:00
fs_pread.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_pseudofile.c arch_atomic: only support atomic_xx and atomic64_xx function 2024-12-04 14:03:14 +01:00
fs_pwrite.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_read.c fs/vfs: initialize uio only if lower implement readv/writev 2025-01-22 16:45:46 +08:00
fs_readlink.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_rename.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_rmdir.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_select.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_sendfile.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_signalfd.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_stat.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_statfs.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_symlink.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_syncfs.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_timerfd.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_truncate.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_uio.c fs/uio: do not overwrite the return value 2025-01-22 16:45:46 +08:00
fs_unlink.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_write.c fs/vfs: initialize uio only if lower implement readv/writev 2025-01-22 16:45:46 +08:00
Kconfig fs: add backtrace to where file opens 2024-06-24 23:53:59 +08:00
lock.h fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
Make.defs fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00