Skip to content

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

Closed
@cfriedt

Description

@cfriedt

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

Metadata

Metadata

Assignees

Labels

area: POSIXPOSIX API LibrarybugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions