-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Description
Describe the bug
In the Base OS, fdtable.h introduced a layering violation (in the first (?) commit) in which the POSIX header <sys/types.h> is included and the POSIX type ssize_t is used in a way that can be described as "below the line" (the line being where the POSIX API lives in the software stack). Such a layering violation creates a dependency cycle at the API level. As noted in the original commit, the wrong types seem to be added to satisfy some need of the native_posix platform.
As part of the base OS, the layering violation spread throughout the Zephyr project into the following areas (and likely more):
- Base OS
- Networking
- Filesystem
- Modem Driversd
- Network Drivers
- Bluetooth simulator
- Native drivers
- C Library
- C++
- POSIX API
Aside from extensive manual testing with twister and CI not catching a strange set of bugs, this layering violation was also the root cause for #75205 (as demonstrated by #75348 archived here with testing details here).
Please also mention any information which could help others to understand
the problem you're facing:
- What target platform are you using? all
- What have you tried to diagnose or workaround this issue? found the root cause
- Is this a regression? Technically no, it was just always broken f484bba
To Reproduce
Steps to reproduce the behavior:
- See multipe tests/posix & tests/lib/c_lib/thrd build failures due to missing time.h definitions #75205
Expected behavior
Developers and reviewers adding code which does not introduce dependency cycles and layering violations.
Impact
This bug caused planned features to be removed from the v3.7.0 release. If it is not fixed, it will mean that the next LTS release cycle will still be quite full of these layering violations and will prevent further bugfixes from being backported to all of the aforementioned areas.
Logs and console output
Environment (please complete the following information):
- OS: any
- Toolchain (e.g Zephyr SDK, ...): all
- Commit SHA or Version used: c9708ff
Additional context
The simpler workaround was deemed to simple. So maintainers asked for the more complicated fix. There is a PR linked to demonstrate the more complicated fix.
This bug is blocking the following (TSC-approved) features from being re-added to v3.7.0.
POSIX_FD_MGMT
- posix: fd_mgmt: implement
ftello()#74100 - posix: fd_mgmt: implement
fseeko()#74099 - posix: fd_mgmt: implement
dup2()#74098 - posix: fd_mgmt: implement
dup()#74097
POSIX_DEVICE_IO
- posix: device_io: implement
fdopen()#66932 - posix: device_io: implement
fileno()#66938 - posix: device_io: implement
pread()#66946 - posix: device_io: implement
pselect()#66947 - posix: device_io: implement
pwrite()#66948
This bug is blocking other architectural fixes that have plagued Zephyr for multiple (actually all) LTS release cycles already
- sockets/posix: poll()/select() implementation should be factored out from sockets subsys into POSIX subsys #24966
- per-file descriptor offsets (still broken for Filesystem)
- numerous problems with libc integration, removing dependency cycles, removing shortcuts
- posix: headers: fix remaining newlib picolibc zephyr pthread inconsistencies #52316 (many remaining inconsistencies)
This bug is also blocking numerous the stability improvements mentioned here.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status