Skip to content

unistd: handle required _SC* values in sysconf - #520

Open
adamgreloch wants to merge 6 commits into
masterfrom
adamgreloch/RTOS-1438
Open

adamgreloch wants to merge 6 commits into
masterfrom
adamgreloch/RTOS-1438

Conversation

@adamgreloch

@adamgreloch adamgreloch commented Aug 26, 2026 •

Copy link
Copy Markdown
Member

TASK: RTOS-1438
Fixes: phoenix-rtos/phoenix-rtos-project#1458

Description

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (refactoring, style fixes, git/CI config, submodule management, no code logic changes)

How Has This Been Tested?

  • Already covered by automatic testing.
  • New test added: (add PR link here).
  • Tested by hand on: (list targets here).

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing linter checks and tests passed.
  • My changes generate no new compilation warnings for any of the targets.

Special treatment

  • This PR needs additional PRs to work (list the PRs, preferably in merge-order).
  • I will merge this PR by myself when appropriate.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request expands the sysconf implementation by defining and adding support for numerous POSIX system configuration constants (_SC_*). It also updates _SC_OPEN_MAX to return -1 for POSIX compliance. The review feedback highlights several areas for improvement: ensuring that limits associated with unsupported options also return -1 to comply with POSIX standards, returning defined limits like NGROUPS_MAX and PTHREAD_DESTRUCTOR_ITERATIONS instead of their POSIX minimums, and adding the missing _SC_CLK_TCK case to the sysconf switch statement.

Comment thread unistd/conf.c
Comment thread unistd/conf.c Outdated
Comment thread unistd/conf.c Outdated
Comment thread include/unistd.h
@github-actions

github-actions Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

Unit Test Results

13 730 tests  ±0   12 871 ✅ ±0   55m 26s ⏱️ - 1m 6s
   780 suites ±0      859 💤 ±0 
     1 files   ±0        0 ❌ ±0 

Results for commit 132609e. ± Comparison against base commit 9bffcee.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

Unit Test Results (nightly)

     1 files   3 206 suites   6h 14m 7s ⏱️
29 540 tests 25 423 ✅ 4 116 💤 1 ❌
29 726 runs  25 570 ✅ 4 155 💤 1 ❌

For more details on these failures, see this check.

Results for commit 2ec657f.

♻️ This comment has been updated with latest results.

@adamgreloch

Copy link
Copy Markdown
Member Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request expands POSIX compliance by defining numerous _SC_* configuration constants in include/unistd.h and implementing their handling in sysconf within unistd/conf.c. Additionally, _SC_OPEN_MAX now returns -1 to remain POSIX-compliant. The review feedback suggests improving sysconf by returning the defined PTHREAD_DESTRUCTOR_ITERATIONS and NGROUPS_MAX constants instead of returning -1 or fallback values, respectively.

Comment thread unistd/conf.c Outdated
Comment thread unistd/conf.c Outdated
@adamgreloch

Copy link
Copy Markdown
Member Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request expands POSIX compliance by defining numerous SC* configuration macros in include/unistd.h and implementing them in sysconf inside unistd/conf.c. It also updates _SC_OPEN_MAX to return -1 to remain POSIX-compliant. Feedback suggests simplifying the large block of contiguous switch cases for unsupported options in sysconf by using a range check in the default block to improve readability.

Comment thread unistd/conf.c
@adamgreloch
adamgreloch marked this pull request as ready for review September 21, 2026 17:53
@adamgreloch
adamgreloch requested a review from a team September 21, 2026 17:53

@Darchiv Darchiv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, but clean up first

@adamgreloch
adamgreloch force-pushed the adamgreloch/RTOS-1438 branch from b674acc to 132609e Compare October 2, 2026 15:21
@adamgreloch
adamgreloch requested a review from Darchiv October 2, 2026 15:22
Comment thread unistd/conf.c Outdated
@adamgreloch
adamgreloch force-pushed the adamgreloch/RTOS-1438 branch from 132609e to 2ec657f Compare October 2, 2026 17:39
@adamgreloch

Copy link
Copy Markdown
Member Author

Reworked the PR a bit. Running nightly once more to make sure the changed definitions don't break lsb_vsx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sysconf() fails with EINVAL on not supported _SC_* constants

2 participants