mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
feat(freertos/vfs): add Linux cooperative syscall dispatch with VFS FD registration
Rework the syscall interposition architecture so FreeRTOS works standalone (without VFS) and VFS optionally overrides with strong symbols. All kernel FDs are registered with VFS via esp_vfs_register_fd_with_local_fd, so the application only sees VFS-allocated FD numbers, preventing numerical collisions between kernel FDs and VFS-internal FD slots. FreeRTOS side: - Create linux_port_coop_internal.h with LINUX_COOP_IO_LOOP, LINUX_COOP_RESOLVE, linux_coop_yield and FD state table functions - Export cooperative I/O primitives (freertos_linux_coop_read/write/ open/close/fcntl/select/pread/pwrite/readv/writev/recv/send/ recvfrom/sendto/recvmsg/sendmsg/connect/accept/pselect/poll/ socket/socketpair/pipe/pipe2/dup/dup2/syscalls_init) - Define weak POSIX symbols calling through to the cooperative primitives; keep nanosleep/sleep/usleep as strong (not FD-related) - Refactor freertos_linux_coop_syscalls.h into a pure public API header VFS side: - Register the Linux host FS with esp_vfs_register_fs_with_id() as a proper VFS driver; register stdin/stdout/stderr at init (priority 99) - Rewrite vfs_linux.c with strong POSIX symbols dispatching through esp_vfs_* - Add strong overrides for FD-creating syscalls (open, pipe, pipe2, socket, socketpair, dup, dup2, accept) that register returned FDs with VFS - Add strong overrides for FD-translating syscalls (readv, writev, recv, send, recvfrom, sendto, recvmsg, sendmsg, connect, pselect, poll) that translate VFS FD to kernel FD - Delete vfs_coop_syscalls.c (absorbed into FreeRTOS weak + VFS strong) - Update CMakeLists.txt: remove vfs_coop_syscalls.c, add linker hook
This commit is contained in:
@@ -24,6 +24,9 @@ CORE: 10: init_show_cpu_freq in components/esp_system/startup_funcs.c on BIT(0)
|
||||
CORE: 20: init_show_app_info in components/esp_app_format/esp_app_desc.c on BIT(0)
|
||||
CORE: 21: init_efuse_show_app_info in components/efuse/src/esp_efuse_startup.c on BIT(0)
|
||||
|
||||
# Set the standard stream to non blocking and register the default vfs
|
||||
CORE: 99: init_vfs_linux_coop in components/vfs/vfs_linux_default_coop.c on BIT(0)
|
||||
|
||||
# Initialize heap allocator. WARNING: This *needs* to happen *after* the app cpu has booted.
|
||||
# If the heap allocator is initialized first, it will put free memory linked list items into
|
||||
# memory also used by the ROM. Starting the app cpu will let its ROM initialize that memory,
|
||||
|
||||
Reference in New Issue
Block a user