Skip to content
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

posix: sysconf: add a "small" implementation option #69882

Merged
merged 1 commit into from Mar 12, 2024

Conversation

cfriedt
Copy link
Member

@cfriedt cfriedt commented Mar 6, 2024

Previously, sysconf() was only available as a macro (i.e. the "extra-small" option).

That has the advantage of being compile-time constant, optimized for both space and speed. One disadvantage is that a querying an _SC_ value that was invalid or unsupported would result in a compile error.

Provide a "small" implementation of sysconf() (via Kconfig choice) as a normal addressable function.

See also #56670

@cfriedt
Copy link
Member Author

cfriedt commented Mar 10, 2024

Was hoping to tag @awojasinski for review here as well.

@cfriedt cfriedt changed the title posix: sysconf: add a "full" implementation option posix: sysconf: add a "small" implementation option Mar 10, 2024
ycsin
ycsin previously approved these changes Mar 11, 2024
Copy link
Collaborator

@ycsin ycsin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -99,6 +99,7 @@ extern "C" {
#define _POSIX2_C_BIND _POSIX_VERSION
#define _POSIX2_C_DEV (-1L)
#define _POSIX2_CHAR_TERM (-1L)
#define _POSIX2_DELAYTIMER_MAX (-1L)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#define _POSIX2_DELAYTIMER_MAX (-1L)
#define _POSIX2_DELAYTIMER_MAX (-1L)

Previously, sysconf() was only available as a macro (i.e. the
"extra-small" option).

This has the advantage of being compile-time constant, and
optimized for both space and speed. One disadvantage is that
querying an `_SC_` value that was invalid or unsupported
would result in a compile error.

Provide a "small" implementation of sysconf() (via Kconfig
choice) as a normal addressable function.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
@cfriedt cfriedt requested a review from ycsin March 11, 2024 18:21
Copy link
Contributor

@awojasinski awojasinski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fabiobaltieri fabiobaltieri merged commit cdc36d0 into zephyrproject-rtos:main Mar 12, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: POSIX POSIX API Library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants