walnux/fs/procfs
Ville Juven b8e30b54ec fs/vfs: Separate file descriptors from file descriptions
This patch is a rework of the NuttX file descriptor implementation. The
goal is two-fold:

1. Improve POSIX compliance. The old implementation tied file description
to inode only, not the file struct. POSIX however dictates otherwise.
2. Fix a bug with descriptor duplication (dup2() and dup3()). There is
an existing race condition with this POSIX API that currently results
in a kernel side crash.

The crash occurs when a partially open / closed file descriptor is
duplicated. The reason for the crash is that even if the descriptor is
closed, the file might still be in use by the kernel (due to e.g. ongoing
write to file). The open file data is changed by file_dup3() and this
causes a crash in the device / drivers themselves as they lose access to
the inode and private data.

The fix is done by separating struct file into file and file descriptor
structs. The file struct can live on even if the descriptor is closed,
fixing the crash. This also fixes the POSIX issue, as two descriptors
can now point to the same file.

Signed-off-by: Ville Juven <ville.juven@unikie.com>
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-06-12 18:12:42 +08:00
..
CMakeLists.txt fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_procfs.c fs/procfs: Improve subdirectory recognition 2025-05-02 09:28:06 -03:00
fs_procfscpuinfo.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_procfscpuload.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_procfscritmon.c spelling: fix spelling typo premp -> preemp 2024-11-25 22:05:05 +08:00
fs_procfsfdt.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_procfsiobinfo.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_procfsmeminfo.c procfs/meminfo: align page fields to columns 2025-01-22 20:29:07 +08:00
fs_procfspressure.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_procfsproc.c fs/vfs: Separate file descriptors from file descriptions 2025-06-12 18:12:42 +08:00
fs_procfstcbinfo.c arch: remove up_current_regs in common code 2024-11-15 18:25:35 +08:00
fs_procfsuptime.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_procfsutil.c style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
fs_procfsversion.c fs/procfs: The procfsversion should be under control of FS_PROCFS_EXCLUDE_VERSION 2024-11-13 12:31:46 -03:00
fs_skeleton.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
Kconfig fs/procfs: Supports any number of thread displays 2024-08-28 14:01:25 +08:00
Make.defs fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00