-
Notifications
You must be signed in to change notification settings - Fork 7.4k
lib: posix: path to deprecate POSIX_API
#88541
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
base: main
Are you sure you want to change the base?
Conversation
9ce8376
to
da74c74
Compare
This will be good for weeding-out the last remaining users of |
51c9cea
to
4ebcb89
Compare
it would be nice to not have any of the POSIX kconfig options show up in the .config when POSIX is not enabled, i.e. when I build hello world (
Why any of this needs to ALWAYS be in the .config if POSIX is not enabled? We do not do this for Bluetooth or for Networking, why do we need to have all those options in the resulting To illustrate this, when you build
which is fine, because you we have enabled BT. when you build hello world:
Thats how it should be We should do something about this. |
I agree with this statement, but as you note this is the current state both on main and in this PR. This PR is trying to limit the number of features that are enabled for users that need some individual piece of the POSIX API, not trying to fix the issue you describe. |
7cad044
to
d6b73ee
Compare
@cfriedt The remaining |
Why do we need to manually enable |
It is not a given that everyone that uses |
Yes, I have heard about this. I have not yet understood why as the
Perhaps we could do |
right, not suggesting this should be done as part of this PR :) btw, there is another issue with how kconfigs of posix are implemented, for example I can now do:
|
d6b73ee
to
fc238c5
Compare
In #88547, POSIX Option Groups that do not require involvement from the os (e.g. string manipulation functions) are separated from POSIX Option Groups that do require OS involvement. This allows us to very clearly gate most POSIX Option Groups with a Kconfig, removing most of them entirely from e.g. hello world. I chose |
`x509_crt.c` relies on an implementation of `inet_pton`, unless `MBEDTLS_TEST_SW_INET_PTON` is defined. Since `inet_pton` is only defined when `POSIX_NETWORKING` is, define the software fallback if it is not. Signed-off-by: Jordan Yates <jordan@embeint.com>
`http_server_core.c` uses `EVENTFD` functions. Signed-off-by: Jordan Yates <jordan@embeint.com>
fc238c5
to
f5052a7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is useful for highlighting places where CONFIG_POSIX_API
should be removed, but I don't think it's the right approach.
The deprecation of CONFIG_POSIX_API
has been documented and processing for some time. I don't think we should be using it going forward, since it has a conflicting definition that has been used previously.
Zephyr does use a few "standalone" POSIX API calls by default as per coding guidelines. These are mainly for string processing (strnlen, srtok_r). Some time functions are also used (clock_gettime, clock_settime, gmtime_r, gettimeofday), only one of which is included in the coding guidelines. The remaining time functions should be factored-out of the various areas and native Zephyr functions should be used instead.
A more standards-compatible approach that is congruent with what Zephyr uses should be available soon in #88547. Maybe this option could be used as a stepping stone, but I kind of fear it would add a lot of unnecessary churn for an API that should be considered frozen / deprecated.
A few PRs are waiting to be reviewed / merged before 88547 will be open for review.
Thanks for highlighting many of the places where CONFIG_POSIX_API
is still used in-tree.
I don't want my NAK here to be seen as n native though by any means. Thanks @JordanYates for helping to move this forward🙏
lib/posix/options/Kconfig.profile
Outdated
select POSIX_BASE_DEFINITIONS # clock_gettime(), pthread_create(), sem_get(), etc | ||
select POSIX_AEP_REALTIME_MINIMAL # CLOCK_MONOTONIC, pthread_attr_setstack(), etc | ||
select POSIX_NETWORKING if NETWORKING # inet_ntoa(), socket(), etc | ||
imply EVENTFD # eventfd(), eventfd_read(), eventfd_write() | ||
imply POSIX_FD_MGMT # open(), close(), read(), write() | ||
imply POSIX_MULTI_PROCESS # sleep(), getpid(), etc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say the right strategy here is to deprecate the option and remove it in-tree rather than change its behaviour.
lib/posix/options/Kconfig.profile
Outdated
@@ -20,6 +14,7 @@ config POSIX_API | |||
|
|||
choice POSIX_AEP_CHOICE | |||
prompt "POSIX Subprofile" | |||
depends on POSIX_API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not the ideal direction. See #88547
Only validate `POSIX_RTSIG_MAX` if `POSIX_REALTIME_SIGNALS` is enabled. Signed-off-by: Jordan Yates <jordan@embeint.com>
Explicitly enable all required POSIX features, instead of relying on `POSIX_API` to enable defaults. Signed-off-by: Jordan Yates <jordan@embeint.com>
Explicitly enable the features required for the tests to pass, rather than relying on `POSIX_API` to enable defaults. Signed-off-by: Jordan Yates <jordan@embeint.com>
Explicitly enable all required POSIX features, instead of relying on `POSIX_API` to enable defaults. Signed-off-by: Jordan Yates <jordan@embeint.com>
Add a dedicated symbol for including the POSIX system headers path directly into the include path, enabling (for example) `#include <time.h>` instead of `#include <zephyr/posix/time.h>`. Signed-off-by: Jordan Yates <jordan@embeint.com>
These libraries only need the `zephyr/posix` system headers on path, not the various implied options in the `POSIX_API` symbol. Signed-off-by: Jordan Yates <jordan@embeint.com>
f5052a7
to
9a10b22
Compare
POSIX_API
Updated to no longer change the The actual deprecation of |
Cleanup a bunch of in-tree users of
POSIX_API
by explicitly enabling the POSIX features they need, instead of the relying on the options enabled byPOSIX_API
.Add a dedicated symbol for injecting
include/zephyr/posix
into the include path, so that users can opt-in to the headers without also gettingPOSIX_API
.