Skip to content

Conversation

cfriedt
Copy link
Member

@cfriedt cfriedt commented Aug 31, 2025

To avoid conflicts between the C library's time.h and signal.h use an "override" header (when necessary) for C libraries that do not themselves provide POSIX definitions in time.h or signal.h.

In order to achieve that, provide posix_time.h and posix_signal.h that define only the POSIX symbols that are not defined by ISO C.

https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html

Required by #88547

@cfriedt cfriedt changed the title posix: options: define _POSIX_TIMERS when configured posix: rename posix/time.h to posix/posix_time.h Aug 31, 2025
@cfriedt cfriedt force-pushed the rename-time-h-to-posix-time-h branch from 2313eed to 85942d5 Compare August 31, 2025 14:26
@cfriedt cfriedt marked this pull request as ready for review August 31, 2025 14:43
@cfriedt cfriedt added area: C Library C Standard Library area: POSIX POSIX API Library labels Aug 31, 2025
@cfriedt cfriedt marked this pull request as draft August 31, 2025 15:06
@cfriedt
Copy link
Member Author

cfriedt commented Aug 31, 2025

  • need to make some minor adjustments still

@cfriedt cfriedt force-pushed the rename-time-h-to-posix-time-h branch from 85942d5 to 68ba062 Compare August 31, 2025 17:01
@cfriedt
Copy link
Member Author

cfriedt commented Aug 31, 2025

  • adjusted to ensure build works without additional defaults

@cfriedt
Copy link
Member Author

cfriedt commented Sep 1, 2025

It looks like #95285 is causing the build failure in twister-build (1).

@cfriedt
Copy link
Member Author

cfriedt commented Sep 1, 2025

The failure in twister build (7) is the result of interdependency between current signal.h and time.h. The signal.h header should not include time.h according to

https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html

I'll see if I can remove that interdependency in a separate PR. If it is not possible, then the signal.h changes will be added to this PR.

@cfriedt cfriedt force-pushed the rename-time-h-to-posix-time-h branch 5 times, most recently from 38a73f6 to 128f1bc Compare September 5, 2025 15:16
Copy link

github-actions bot commented Sep 5, 2025

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff

All manifest checks OK

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@github-actions github-actions bot added manifest manifest-hal_nxp DNM (manifest) This PR should not be merged (controlled by action-manifest) labels Sep 5, 2025
@cfriedt cfriedt changed the title posix: rename posix/time.h to posix/posix_time.h posix: use posix_time.h and posix_signal.h Sep 5, 2025
@cfriedt cfriedt marked this pull request as ready for review September 5, 2025 23:58
@github-actions github-actions bot removed manifest manifest-hal_nxp DNM (manifest) This PR should not be merged (controlled by action-manifest) Binary Blobs Modified labels Sep 9, 2025
Create a header for satisfying POSIX conformance requirements of signal.h
that is named posix_signal.h rather than signal.h.

The primary reason for doing so, is that the de-facto owner of signal.h is
the C library.

This new header only defines required POSIX symbols that form a strict
superset over the ISO C signal.h symbols.

Signed-off-by: Chris Friedt <[email protected]>
To avoid conflicts between the C library's `time.h` and signal.h use an
"override" header (when necessary) for C libraries that do not themselves
provide POSIX definitions in `time.h` or `signal.h`.

Signed-off-by: Chris Friedt <[email protected]>
@cfriedt cfriedt force-pushed the rename-time-h-to-posix-time-h branch from 28c80f3 to 2b318b2 Compare September 12, 2025 11:32
@cfriedt cfriedt requested a review from npitre September 12, 2025 11:33
@cfriedt
Copy link
Member Author

cfriedt commented Sep 12, 2025

@stephanosio - this should basically be ready for you to review. Only minor changes since the last revision.

Copy link

@cfriedt
Copy link
Member Author

cfriedt commented Sep 24, 2025

@stephanosio - are you able to review? If not, is it ok if I reassign to e.g. Keith or someone else?

@cfriedt cfriedt added the dev-review To be discussed in dev-review meeting label Sep 25, 2025
@cfriedt
Copy link
Member Author

cfriedt commented Sep 25, 2025

Just adding the dev-review label (I guess I could have last week already), since it's been 3 weeks with no maintainer reviews.
https://docs.zephyrproject.org/latest/contribute/contributor_expectations.html#getting-prs-reviewed

@cfriedt
Copy link
Member Author

cfriedt commented Sep 25, 2025

And, oddly, adding the dev-review label causes CI to fail 😅 . Hopefully, removing it will help.
https://github.com/zephyrproject-rtos/zephyr/actions/runs/17992925016/job/51186637221?pr=95226

@cfriedt cfriedt removed the dev-review To be discussed in dev-review meeting label Sep 25, 2025
@cfriedt cfriedt assigned cfriedt and unassigned stephanosio Sep 25, 2025
@cfriedt
Copy link
Member Author

cfriedt commented Sep 25, 2025

Self-assigning this, since it

  • has had a couple of rounds of review already
  • follows the same recommendations made by Stephanos as in posix: move limit definitions to posix_limits.h #94612
  • has to do more with POSIX than C library
  • has followed the documented process as well as possible
  • and lastly
    • fixes an issue reported by @fabiobaltieri, and
    • blocks a feature for 4.3.0 that is part of the release plan.

@fabiobaltieri fabiobaltieri merged commit 1eb5c97 into zephyrproject-rtos:main Sep 25, 2025
37 of 38 checks passed
yashi added a commit to yashi/libcsp that referenced this pull request Oct 3, 2025
Zephyr's POSIX time support has been updated (PR #95226) to provide a
new header <zephyr/posix/posix_time.h>. This change ensures that
<time.h> can be included safely, even when a libc previously provided
its own conflicting version.

To maintain compatibility before and after the PR, this patch uses
__has_include to prefer <time.h> when <zephyr/posix/posix_time.h> is
available, and falls back to <zephyr/posix/time.h> otherwise.

This prevents build errors caused by incompatible or incomplete <time.h>
implementations in some environments.

References:
– zephyrproject-rtos/zephyr#95226zephyrproject-rtos/zephyr#96911https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005finclude.html

Signed-off-by: Yasushi SHOJI <[email protected]>
yashi added a commit to libcsp/libcsp that referenced this pull request Oct 3, 2025
Zephyr's POSIX time support has been updated (PR #95226) to provide a
new header <zephyr/posix/posix_time.h>. This change ensures that
<time.h> can be included safely, even when a libc previously provided
its own conflicting version.

To maintain compatibility before and after the PR, this patch uses
__has_include to prefer <time.h> when <zephyr/posix/posix_time.h> is
available, and falls back to <zephyr/posix/time.h> otherwise.

This prevents build errors caused by incompatible or incomplete <time.h>
implementations in some environments.

References:
– zephyrproject-rtos/zephyr#95226zephyrproject-rtos/zephyr#96911https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005finclude.html

Signed-off-by: Yasushi SHOJI <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Build System area: C Library C Standard Library area: POSIX POSIX API Library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants