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: threads: do not blanket-define _POSIX_THREADS via cmake #75208

Open
cfriedt opened this issue Jun 29, 2024 · 2 comments
Open

posix: threads: do not blanket-define _POSIX_THREADS via cmake #75208

cfriedt opened this issue Jun 29, 2024 · 2 comments
Assignees
Labels
area: POSIX POSIX API Library bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug

Comments

@cfriedt
Copy link
Member

cfriedt commented Jun 29, 2024

Describe the bug

Prior to #51211, POSIX features were mostly all available all the time when CONFIG_POSIX_API was selected.

As part of the above ticket, POSIX features via Kconfig options that were crafted to resemble standard Options and Option Groups.

With that, we no longer need to blanket-define -D_POSIX_THREADS, which was originally required with external C libraries such as Newlib and Picolibc.

In fact, if _POSIX_THREADS is enabled, and CONFIG_POSIX_THREADS is not selected, it is a bug.

Please also mention any information which could help others to understand
the problem you're facing:

  • What target platform are you using? all
  • What have you tried to diagnose or workaround this issue? a lot
  • Is this a regression? no, it is a workaround that has existed in-tree for many years

To Reproduce

  1. Select minimal Kconfig options in prj.conf
  2. Select CONFIG_EVENTFD=y
  3. Add a preprocessor statement of the form
#if defined(_POSIX_THREADS)
#ifndef CONFIG_POSIX_THREADS
#error Feature _POSIX_THREADS is enabled but CONFIG_POSIX_THREADS is not selected (inconsistence)
#endif
#endif

Expected behavior
POSIX features should match the configuration

Impact
It introduces an element of instability / unexpected behaviour.

Logs and console output

Feature _POSIX_THREADS is enabled but CONFIG_POSIX_THREADS is not selected (inconsistence)

Environment (please complete the following information):

  • OS: any
  • Toolchain (e.g Zephyr SDK, ...): 0.16.8
  • Commit SHA or Version used: 4081098

Additional context

@cfriedt cfriedt added bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug area: POSIX POSIX API Library labels Jun 29, 2024
@cfriedt cfriedt self-assigned this Jun 29, 2024
Copy link

This issue 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 issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

@github-actions github-actions bot added the Stale label Aug 29, 2024
@cfriedt cfriedt removed the Stale label Aug 30, 2024
Copy link

This issue 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 issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

@github-actions github-actions bot added the Stale label Oct 30, 2024
@cfriedt cfriedt removed the Stale label Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: POSIX POSIX API Library bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant