-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lib: posix: add include/posix to search path and drop posix header prefix #43987
Conversation
797aa26
to
82c6301
Compare
Required module changes
Unrelated failures
Tests of primary concern
Compliance and Coding Style test failures are false positives. |
07b56bf
to
1596433
Compare
More or less what I anticipated as well, because newlib had similar overlap. The hazards look entirely manageable though, @keith-packard. I would say the one that could potentially be (hand-wavy) is open, but mainly because of Probably should not be used in the Zephyr (yet?) Probably should not be used in Zephyr If there is any discrepancy, we will likely use the picolibc definitions Likely fine (Note: we use libc's <time.h>): |
Zephyr currently has conflicting definitions for many of these APIs as it defines them as aliases for static inline functions. That means code including picolibc headers will not get the correct definitions, they'll get external function references, which may (or may not) work, but will certainly be less efficient. I think what would be best would be for the standard posix headers to define the standard posix APIs generating the right code to operate in Zephyr. That means inline code for syscalls, for instance. Given that the Zephyr SDK is already using a new GNU triplet including '-zephyr-', it's reasonable to expect the libraries in that SDK to be zephyr-specific, so if the C library is built as part of that toolchain, it can (and should) understand the Zephyr syscall interface, defining the functions correctly for use in Zephyr. Similarly, a C library built as part of Zephyr should use the Zephyr syscall interface. Including hacks in Zephyr to work around libraries not designed for it is reasonable where you can't fix the library. In this case, the upstream projects would all be happy to accept Zephyr OS support. |
7d9c35e
to
36889dd
Compare
This change fixes that.
This change fixes that too.
That is a reasonable long-term goal. Some work depends on this being resolved in the short-term.
Upstreamers welcome :-) |
13c5de0
to
caaeca8
Compare
caaeca8
to
c1bf413
Compare
This is a temporary workaround until the mountain of tech-debt is flattened w.r.t the following: zephyrproject-rtos/zephyr#43987 zephyrproject-rtos/gsoc-2022-thrift#62 zephyrproject-rtos/zephyr#43998 zephyrproject-rtos/zephyr#46910 zephyrproject-rtos/zephyr#45100 but also around the mountain of tech-debt as a result of poor arch/posix software architecture, CONFIG_ARCH_POSIX and CONFIG_POSIX_API incompatibility, and the resultant spillover of moving POSIX definitions into the network subsystem as a result. Fixes zephyrproject-rtos/gsoc-2022-thrift#129 Signed-off-by: Christopher Friedt <[email protected]>
This is a temporary workaround until the mountain of tech-debt is flattened w.r.t the following: zephyrproject-rtos/zephyr#43987 #62 zephyrproject-rtos/zephyr#43998 zephyrproject-rtos/zephyr#46910 zephyrproject-rtos/zephyr#45100 but also around the mountain of tech-debt as a result of poor arch/posix software architecture, CONFIG_ARCH_POSIX and CONFIG_POSIX_API incompatibility, and the resultant spillover of moving POSIX definitions into the network subsystem as a result. Fixes #129 Signed-off-by: Christopher Friedt <[email protected]>
This is a temporary workaround until the mountain of tech-debt is flattened w.r.t the following: zephyrproject-rtos/zephyr#43987 #62 zephyrproject-rtos/zephyr#43998 zephyrproject-rtos/zephyr#46910 zephyrproject-rtos/zephyr#45100 but also around the mountain of tech-debt as a result of poor arch/posix software architecture, CONFIG_ARCH_POSIX and CONFIG_POSIX_API incompatibility, and the resultant spillover of moving POSIX definitions into the network subsystem as a result. Fixes #129 Signed-off-by: Christopher Friedt <[email protected]>
This is a temporary workaround until the mountain of tech-debt is flattened w.r.t the following: zephyrproject-rtos/zephyr#43987 #62 zephyrproject-rtos/zephyr#43998 zephyrproject-rtos/zephyr#46910 zephyrproject-rtos/zephyr#45100 but also around the mountain of tech-debt as a result of poor arch/posix software architecture, CONFIG_ARCH_POSIX and CONFIG_POSIX_API incompatibility, and the resultant spillover of moving POSIX definitions into the network subsystem as a result. Fixes #129 Signed-off-by: Christopher Friedt <[email protected]>
Currently doing a rework of this to separate it into a series of several easily-reviewable commits. |
This is a temporary workaround until the mountain of tech-debt is flattened w.r.t the following: zephyrproject-rtos/zephyr#43987 #62 zephyrproject-rtos/zephyr#43998 zephyrproject-rtos/zephyr#46910 zephyrproject-rtos/zephyr#45100 but also around the mountain of tech-debt as a result of poor arch/posix software architecture, CONFIG_ARCH_POSIX and CONFIG_POSIX_API incompatibility, and the resultant spillover of moving POSIX definitions into the network subsystem as a result. Fixes #129 Signed-off-by: Christopher Friedt <[email protected]>
c1bf413
to
6d9936a
Compare
…efix It is a pain point to prefix standard POSIX APIs (e.g. `#include <posix/unistd.h>`). This is true, in particular, when integrating third-party code into an external module. With this, if users choose to include standard POSIX headers via Kconfig, then those headers will be part of the default search path. The headers themselves do not move. POSIX headers will not appear in the default search path unless so configured. Additional changes: * removed `posix/time.h` to circumvent `#include_next` workaround * gathered `NSEC_PER_MSEC` and `USEC_PER_MSEC` defs into `sys_clock.h` * restructured some syscalls (unistd, ioctl, clock_getttime) * sprinkled `#include <unistd.h>` where `close()` is used * removed a fair amount of duplicate code Fixes zephyrproject-rtos#43998 Signed-off-by: Christopher Friedt <[email protected]>
6d9936a
to
407691d
Compare
This is a temporary workaround until the mountain of tech-debt is flattened w.r.t the following: zephyrproject-rtos/zephyr#43987 zephyrproject-rtos/gsoc-2022-thrift#62 zephyrproject-rtos/zephyr#43998 zephyrproject-rtos/zephyr#46910 zephyrproject-rtos/zephyr#45100 but also around the mountain of tech-debt as a result of poor arch/posix software architecture, CONFIG_ARCH_POSIX and CONFIG_POSIX_API incompatibility, and the resultant spillover of moving POSIX definitions into the network subsystem as a result. Fixes zephyrproject-rtos/gsoc-2022-thrift#129 Signed-off-by: Christopher Friedt <[email protected]>
This is a temporary workaround until the mountain of tech-debt is flattened w.r.t the following: zephyrproject-rtos/zephyr#43987 zephyrproject-rtos/gsoc-2022-thrift#62 zephyrproject-rtos/zephyr#43998 zephyrproject-rtos/zephyr#46910 zephyrproject-rtos/zephyr#45100 but also around the mountain of tech-debt as a result of poor arch/posix software architecture, CONFIG_ARCH_POSIX and CONFIG_POSIX_API incompatibility, and the resultant spillover of moving POSIX definitions into the network subsystem as a result. Fixes zephyrproject-rtos/gsoc-2022-thrift#129 Signed-off-by: Christopher Friedt <[email protected]>
This is a temporary workaround until the mountain of tech-debt is flattened w.r.t the following: zephyrproject-rtos/zephyr#43987 zephyrproject-rtos/gsoc-2022-thrift#62 zephyrproject-rtos/zephyr#43998 zephyrproject-rtos/zephyr#46910 zephyrproject-rtos/zephyr#45100 but also around the mountain of tech-debt as a result of poor arch/posix software architecture, CONFIG_ARCH_POSIX and CONFIG_POSIX_API incompatibility, and the resultant spillover of moving POSIX definitions into the network subsystem as a result. Fixes zephyrproject-rtos/gsoc-2022-thrift#129 Signed-off-by: Christopher Friedt <[email protected]>
This is a temporary workaround until the mountain of tech-debt is flattened w.r.t the following: zephyrproject-rtos/zephyr#43987 zephyrproject-rtos/gsoc-2022-thrift#62 zephyrproject-rtos/zephyr#43998 zephyrproject-rtos/zephyr#46910 zephyrproject-rtos/zephyr#45100 but also around the mountain of tech-debt as a result of poor arch/posix software architecture, CONFIG_ARCH_POSIX and CONFIG_POSIX_API incompatibility, and the resultant spillover of moving POSIX definitions into the network subsystem as a result. Fixes zephyrproject-rtos/gsoc-2022-thrift#129 Signed-off-by: Christopher Friedt <[email protected]>
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
It is a pain point to prefix standard POSIX APIs (e.g.
#include <zephyr/posix/unistd.h>
). This is true, in particular, when integrating third-party code into an external module. However, using the POSIX API should also not be a default in Zephyr.With this, if users choose to include standard POSIX headers via Kconfig, then those headers will be part of the default search path. The headers themselves do not move. POSIX headers will not appear in the default search path unless so configured.
Additional changes:
posix/time.h
to mitigate need for#include_next
workaroundNSEC_PER_MSEC
andUSEC_PER_MSEC
defs intosys_clock.h
#include <unistd.h>
whereclose()
is used or usezsock_close()
insteadFixes #43998