| Summary: | POSIX clock_gettime, clock_getres return errno invalid argument for CLOCK_PROF and CLOCK_VIRTUAL | ||
|---|---|---|---|
| Product: | Base System | Reporter: | jonathan <jonathan> |
| Component: | kern | Assignee: | kbyanc |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | 4.2-STABLE | ||
| Hardware: | Any | ||
| OS: | Any | ||
Responsible Changed From-To: freebsd-bugs->freebsd-standards This is a standards issue. Responsible Changed From-To: freebsd-standards->standards Use short names for mailing list to make searches using the web query form work with the shown responsible. This also makes open PR show up in the summery mail. Responsible Changed From-To: standards->freebsd-standards Misattributed PR. State Changed From-To: open->patched Committed support for CLOCK_VIRTUAL and CLOCK_PROF to -current. Responsible Changed From-To: freebsd-standards-> kbyanc I'll take this in order to help remember I need to do the MFC. State Changed From-To: patched->closed What was -current at the time of this PR was made -stable long ago, so this PR is OBE. |
While there is no problem with CLOCK_REALTIME, POSIX clock_gettime, clock_getres return errno invalid argument for CLOCK_PROF and CLOCK_VIRTUAL, which are documented in the man pages (section 2) as being user+system and user time, respectively. Fix: Immediate fix: remove mention of CLOCK_VIRTUAL AND CLOCK_PROF from sys/time.h and man 2 clock_gettime Real fix: implement the documented POSIX functionality How-To-Repeat: /* demonstrates that the clock_get... calls succed for CLOCK_REALTIME but fail for CLOCK_PROF and CLOCK_VIRTUAL */ #include <sys/time.h> #include <stdio.h> int main() { struct timespec t; puts("CLOCK_PROF"); if (clock_gettime(CLOCK_PROF, &t)) perror(NULL); if (clock_getres(CLOCK_PROF, &t)) perror(NULL); puts("\nCLOCK_VIRTUAL"); if (clock_gettime(CLOCK_VIRTUAL, &t)) perror(NULL); if (clock_getres(CLOCK_VIRTUAL, &t)) perror(NULL); puts("\nCLOCK_REALTIME"); if (clock_gettime(CLOCK_REALTIME, &t)) perror(NULL); if (clock_getres(CLOCK_REALTIME, &t)) perror(NULL); }