Skip to content

Conversation

cfriedt
Copy link
Member

@cfriedt cfriedt commented Sep 25, 2025

This is version 2 of #95226

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

Testing Done:

west build -p -b native_sim/native tests/net/wifi/configs -T wifi.build.hostapd_ap
west build -p -b native_sim/native tests/posix/signals -T portability.posix.signals.big_nsig
twister -c -O /tmp/twister-out -T tests/posix -T tests/lib/c_lib -T tests/net/wifi
Deleting output directory /tmp/twister-out
INFO    - Using Ninja..
INFO    - Zephyr version: v4.2.0-4459-g0b25fd0fd992
INFO    - Using 'zephyr' toolchain.
INFO    - Selecting default platforms per testsuite scenario
INFO    - Building initial testsuite list...
INFO    - Writing JSON report /tmp/twister-out/testplan.json
INFO    - JOBS: 32
INFO    - Adding tasks to the queue...
INFO    - Added initial list of jobs to queue
INFO    - Total complete:  1615/1615  100%  built (not run):   13, filtered: 4979, failed:    0, error:    0

Also, grepped through all module sources to make sure that none were still pulling in zephyr/posix/time.h or zephyr/posix/signal.h.

@cfriedt cfriedt force-pushed the rename-time-h-to-posix-time-h-v2 branch from e8704a7 to 5e37e7e Compare September 25, 2025 20:19
Copy link

github-actions bot commented Sep 25, 2025

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

Name Old Revision New Revision Diff
hostap zephyrproject-rtos/hostap@0798bf0 zephyrproject-rtos/hostap@61182a4 zephyrproject-rtos/[email protected]

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-hostap DNM (manifest) This PR should not be merged (controlled by action-manifest) labels Sep 25, 2025
@cfriedt
Copy link
Member Author

cfriedt commented Sep 25, 2025

Identical to the previous version aside from

@cfriedt cfriedt force-pushed the rename-time-h-to-posix-time-h-v2 branch 2 times, most recently from 8dd1251 to dc5dc6a Compare September 25, 2025 21:35
Assuming that the `posix` tag will trigger `posix` tests to be run
when this testsuite is changed.

Signed-off-by: Chris Friedt <[email protected]>
Create a header for satisfying POSIX conformance requirements of time.h
that is named posix_time.h rather than time.h.

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

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

V2

Signed-off-by: Chris Friedt <[email protected]>
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.

V2

Signed-off-by: Chris Friedt <[email protected]>
@cfriedt cfriedt force-pushed the rename-time-h-to-posix-time-h-v2 branch 3 times, most recently from 33ad822 to fa6eb36 Compare September 27, 2025 12:30
@cfriedt cfriedt changed the title posix: headers: create a more conformant posix_time.h posix: use posix_time.h and posix_signal.h [v2] Sep 27, 2025
@github-actions github-actions bot removed the DNM (manifest) This PR should not be merged (controlled by action-manifest) label Sep 27, 2025
@cfriedt
Copy link
Member Author

cfriedt commented Sep 27, 2025

  • fixed error in test_signal_strsignal to use correct values for SIGHUP and SIGSYS

Update the hostap module to use non-prefixed paths for the ISO C time.h
and signal.h headers.

Signed-off-by: Chris Friedt <[email protected]>
@cfriedt cfriedt force-pushed the rename-time-h-to-posix-time-h-v2 branch 2 times, most recently from 615605c to 911602d Compare September 27, 2025 13:29
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`.

V2

Signed-off-by: Chris Friedt <[email protected]>
@cfriedt cfriedt force-pushed the rename-time-h-to-posix-time-h-v2 branch from 911602d to 0b25fd0 Compare September 27, 2025 13:42
@cfriedt
Copy link
Member Author

cfriedt commented Sep 27, 2025

  • add check signo_fits() in signal.c for detecting a sigset_t that is too small
  • skipped testing SIGRTMIN - SIGRTMAX when the size of sigset_t is insufficient (e.g. some libc's use 1 long on 32-bit systems, so cannot represent realtime signals)
  • undefine sigaddset(), sigdelset(), and sigismember() macros in newlib/include/signal.h since they are non-conformant

Copy link

@cfriedt
Copy link
Member Author

cfriedt commented Sep 28, 2025

@jukkar @ycsin @fabiobaltieri @jhedberg - please (re-)review when you have time

@stephanosio stephanosio assigned cfriedt and unassigned stephanosio Sep 30, 2025
@cfriedt
Copy link
Member Author

cfriedt commented Sep 30, 2025

@stephanosio - can you review this today? If not I'll self-assign again.

@jhedberg jhedberg merged commit 5cbb2a4 into zephyrproject-rtos:main Oct 1, 2025
56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants