Commit Graph

10 Commits

Author SHA1 Message Date
Tomáš Rohlínek
68b34d9883 fix(stdio): check close_p return before decrementing fd count
If entry->ops->close_p() fails, do not decrement s_open_count
to prevent FD count corruption. Return early with the error code
instead.
2026-06-02 10:37:16 +02:00
Tomáš Rohlínek
42f3ed4d51 refactor(stdio): remove fd table, forward opens to primary backend
Remove the internal fd table (fd_entry_t, is_fd_valid, fd_allows_read/write,
ESP_STDIO_BASIC_MODE tracking) from the console VFS.

Instead, console_open forwards directly to the primary backend's open_p,
so each open("/dev/console") creates a real fd in the underlying driver.
Read/write/fstat/fcntl/fsync all operate on the per-open fd from the
primary, not a stored init-time fd.

Structure:
- s_primary: separate variable for the primary backend entry
- s_auxiliary[]: slot-based array for auxiliary sinks (NULL = free)
- Scans all slots (no count variable) with NULL guards
- Auxiliaries opened lazily on first console open
- Closed when last console fd is closed (refcounted via s_open_count)
- Write and fsync fan-out protected by s_lock
2026-06-02 10:37:16 +02:00
Tomáš Rohlínek
9bc2b3d7ee fix(esp_stdio): add fd-table locking, per-fd flag checks, and Kconfig cleanup 2026-05-27 11:37:56 +02:00
Tomáš Rohlínek
52004409ce fix(esp_stdio): remap console select fd bits to sink device
Map logical /dev/console fds to the primary sink fd for select.
This avoids probing UART1/UART2 for stdout/stderr and keeps UART select state consistent.
Add stdio regression checks for logical fd mapping and symmetric uart_end_select teardown.
2026-05-27 11:37:56 +02:00
Tomáš Rohlínek
8605931afc feat(system/esp_stdio): Add test coverage for esp_stdio refactor 2026-05-27 11:37:56 +02:00
Tomáš Rohlínek
e08bed82c6 feat(storage/stdio): Refactor stdio_vfs multiplexer 2026-05-27 11:37:56 +02:00
Guillaume Souchere
5fac0b7386 feat(console): Move IO initialization outside of the console component
- Move the linux repl chip and deprecate chip related functions
- Update location of driver specific default config
- Add missing comments on the newly added functions in the affected components.
2026-03-17 08:30:23 +01:00
Tomáš Rohlínek
a46fec8d96 feat(storage/vfs): Remove usage of context less VFS APIs 2026-03-11 11:03:43 +01:00
Marius Vikhammer
d209293856 feat(stdio): updated CMakelists.txt to support cmake v2 build system 2025-11-14 10:13:38 +08:00
Marius Vikhammer
a257812e14 feat(stdio): added esp_stdio component
esp_stdio contains everything the old esp_vfs_console contained (the vfs stdio glue layer)
as well as other functionality related to stdio (previously referred to as console)
2025-10-16 10:01:59 +08:00