Skip to content

posix: gettimeofday is not a part of POSIX_TIMERS but XSI_SINGLE_PROCESS #88556

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

Open
cfriedt opened this issue Apr 12, 2025 · 0 comments
Open
Assignees
Labels
area: POSIX POSIX API Library bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@cfriedt
Copy link
Member

cfriedt commented Apr 12, 2025

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

int gettimeofday(struct timeval *tv, void *tz)

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:

  1. look at the spec
  2. look at the source code
  3. 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

@cfriedt cfriedt added the bug The issue is a bug, or the PR is fixing a bug label Apr 12, 2025
@cfriedt cfriedt added the area: POSIX POSIX API Library label Apr 12, 2025
@cfriedt cfriedt self-assigned this Apr 12, 2025
@cfriedt cfriedt added the priority: low Low impact/importance bug label Apr 12, 2025
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: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

1 participant