Description
Describe the bug
The gettimeofday()
implementation in the POSIX API is incorrectly categorized as part of POSIX_TIMERS
whereas it should be a part of XSI_SINGLE_PROCESS
along with putenv()
and gethostid()
.
https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html
zephyr/lib/posix/options/clock.c
Line 272 in d453fb9
zephyr/lib/posix/options/CMakeLists.txt
Line 116 in d453fb9
Please also mention any information which could help others to understand
the problem you're facing:
- What target platform are you using? any
- What have you tried to diagnose or workaround this issue? looked at the specification
- Is this a regression? I guess not
To Reproduce
Steps to reproduce the behavior:
- look at the spec
- look at the source code
- See error
The most obvious way to produce a compilation error is to remove the line CONFIG_POSIX_TIMERS=y
from tests/lib/time/prj.conf
and observe that there is a missing reference to gettimeofday()
, which the test needed to leverage because Picolibc's time()
function call calls gettimeofday()
, and then you see that it's
Expected behavior
gettimeofday()
should be callable when the option CONFIG_XSI_SINGLE_PROCESS
is enabled, and not via dependency on CONFIG_POSIX_TIMERS
.
Impact
Just a little broken. Some dependency cycles, layering violations, etc.
Logs and console output
Environment (please complete the following information):
- OS: (e.g. Linux, MacOS, Windows): any
- Toolchain (e.g Zephyr SDK, ...): Zephyr SDK v0.17.0
- Commit SHA or Version used: 781011b
Additional context
See also #88555
Encountered in the process of working on #88547