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 cfriedt added the area: POSIX POSIX API Library label Mar 6, 2024
@zephyrbot zephyrbot requested a review from ycsin March 6, 2024 19:17
@cfriedt cfriedt force-pushed the full-sysconf branch 4 times, most recently from 0a8222d to a366d42 Compare March 8, 2024 08:39
@cfriedt cfriedt requested a review from jukkar March 10, 2024 12:24
@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
Member

@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
Member

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 <[email protected]>
@cfriedt cfriedt requested a review from ycsin March 11, 2024 18:21
Copy link
Collaborator

@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
@cfriedt cfriedt deleted the full-sysconf branch August 11, 2024 12:37
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.

5 participants