NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/59127: clock_getres(2) returns EINVAL for CLOCK_{PROCESS,THREAD}_CPUTIME_ID
>Number: 59127
>Category: kern
>Synopsis: clock_getres(2) returns EINVAL for CLOCK_{PROCESS,THREAD}_CPUTIME_ID
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Tue Mar 04 13:05:00 +0000 2025
>Originator: PHO
>Release: 10 and CURRENT
>Organization:
TNF
>Environment:
NetBSD yukari.cielonegro.org 10.0 NetBSD 10.0 (GENERIC64) #0: Thu Mar 28 08:33:33 UTC 2024 mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/evbarm/compile/GENERIC64 evbarm
>Description:
clock_getres(2) returns EINVAL for CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID instead of returning resolutions. The syscall should support these clocks too, as clock_gettime(2) supports them.
>How-To-Repeat:
#include <time.h>
#include <stdio.h>
int main() {
struct timespec ts;
int ret = clock_getres(CLOCK_PROCESS_CPUTIME_ID, &ts);
printf("clock_getres() returned %d\n", ret);
return 0;
}
>Fix:
A patch is here:
https://github.com/depressed-pho/netbsd-src/commit/ebf335048a3a4684b05c4efd07acaeae2b8c0cf0
I believe the patch is correct, because the time values that clock_gettime(2) obtains ultimately come from timecounter(9) through calcru() or addrulwp(). But correct me if I'm wrong, as I'm not familiar with these things.
Home |
Main Index |
Thread Index |
Old Index