walnux/include
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
..
android
arpa
crypto style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
cxx fix a typo 2024-12-15 17:53:48 -03:00
net net: use bps units for bitrate in SocketCAN interfaces. 2025-04-16 11:07:27 -03:00
netinet include/netinet/arp.h: change the type of arp_dev from uint8_t to char 2024-12-26 23:29:23 +08:00
netpacket netpacket/sockaddr_ll: Add valid packet types for sll_pkttype 2024-12-31 09:41:39 +08:00
nuttx fs/vfs: Separate file descriptors from file descriptions 2025-06-12 18:12:42 +08:00
ssp
sys fs/poll: remove poll_fdsetup 2025-05-26 18:49:45 +08:00
.gitignore include/.gitignore: add openlibm to gitignore 2024-10-13 02:27:28 +08:00
aio.h
alloca.h
assert.h assert: add header files to resolve compile failed 2024-10-12 09:29:37 +08:00
byteswap.h
ctype.h libcxx: fix compile error 2024-10-23 09:42:57 +08:00
debug.h libc/stream: Support lowsyslog. 2025-04-02 12:01:46 +08:00
dirent.h
dlfcn.h
dsp.h style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
dspb16.h style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
elf.h modlib:Standardized module loading method 2024-10-05 15:22:02 +08:00
elf32.h modlib:Standardized module loading method 2024-10-05 15:22:02 +08:00
elf64.h modlib:Standardized module loading method 2024-10-05 15:22:02 +08:00
endian.h
err.h
errno.h
execinfo.h sched: support backtrace record 2024-10-11 00:37:27 +08:00
fcntl.h
fixedmath.h style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
fnmatch.h
ftw.h
gcov.h Fix compilation errors 2024-11-26 19:25:24 +08:00
getopt.h
glob.h
grp.h
hex2bin.h
iconv.h
ifaddrs.h
imx_container.h arch/arm64/imx9: Add ROMAPI and AHAB support for i.MX9 2025-05-09 19:21:17 +08:00
inttypes.h
iso646.h
langinfo.h
libgen.h
libintl.h
limits.h Add LINE_MAX configuration 2024-12-26 13:25:19 +08:00
locale.h
lzf.h
malloc.h memdump: add dump for the orphan nodes(neighbor of free node) 2024-10-08 23:55:59 +08:00
mqueue.h [POSIX][Bug] mqueue.h: Include file does not conform the standard 2024-12-09 21:21:09 +08:00
netdb.h
nl_types.h
nxflat.h
obstack.h libs/libc/obstack: fix allocated chunk overrun due to invalid limit 2024-10-30 11:53:18 -03:00
poll.h
pthread.h Clean up the nxmutex library 2025-05-08 16:00:05 +08:00
pty.h
pwd.h libs/libc/pwd: add new member to passwd struct 2024-10-16 11:15:25 +08:00
regex.h
resolv.h
sched.h sched: remove csection and reduce the interrupt disabling time in sched_[un]lock 2025-01-23 19:58:49 +08:00
search.h include/search: migrate to SPDX identifier 2024-12-16 14:18:35 +08:00
semaphore.h style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
shadow.h libs/libc/unistd: add getspnam function 2024-10-16 11:15:25 +08:00
signal.h signal: add include/sys/signal.h to the signal 2024-12-20 11:46:14 -03:00
spawn.h
stdbool.h
stddef.h
stdint.h
stdio.h libc: add nx_strdup() & nx_strndup() support 2024-10-15 01:16:48 +08:00
stdlib.h include/stdlib.h: define system()'s prototype for the flat build 2025-02-07 09:03:14 +08:00
stdnoreturn.h
string.h fix misspelled names in locally scoped code 2025-05-15 10:12:12 +08:00
strings.h libc/strings: fix compile warning if enable -Wshadow 2025-03-05 11:20:01 -03:00
syscall.h
syslog.h setlogmask: fix setlogmask behavior according to POSIX standard 2025-05-02 16:29:08 +02:00
termios.h
threads.h include/threads.h: Replace thrd_ defines by actual function definitions 2024-12-19 21:56:02 +08:00
time.h
unistd.h nuttx: add get_current_dir_name implementation 2024-12-19 20:55:51 +08:00
utime.h
uuid.h
wait.h wait: add wait.h header file 2024-12-20 11:46:14 -03:00
wchar.h fix misspelled names in locally scoped code 2025-05-15 10:12:12 +08:00
wctype.h