NetBSD Problem Report #58670
From www@netbsd.org Tue Sep 10 23:51:09 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
client-signature RSA-PSS (2048 bits) client-digest SHA256)
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id C22381A923B
for <gnats-bugs@gnats.NetBSD.org>; Tue, 10 Sep 2024 23:51:08 +0000 (UTC)
Message-Id: <20240910235107.94F011A9243@mollari.NetBSD.org>
Date: Tue, 10 Sep 2024 23:51:07 +0000 (UTC)
From: furkanonder@protonmail.com
Reply-To: furkanonder@protonmail.com
To: gnats-bugs@NetBSD.org
Subject: clock_getres function does not recognize CLOCK_THREAD_CPUTIME_ID, leading to an 'Invalid argument' error.
X-Send-Pr-Version: www-1.0
>Number: 58670
>Category: lib
>Synopsis: clock_getres function does not recognize CLOCK_THREAD_CPUTIME_ID, leading to an 'Invalid argument' error.
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: lib-bug-people
>State: open
>Class: support
>Submitter-Id: net
>Arrival-Date: Tue Sep 10 23:55:00 +0000 2024
>Originator: Furkan Onder
>Release: NetBSD 10.0
>Organization:
>Environment:
NetBSD localhost.home 10.0 NetBSD 10.0 (GENERIC) #0: Thu Mar 28 08:33:33 UTC 2024 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
According to the documentation (https://man.netbsd.org/clock_gettime.2), CLOCK_THREAD_CPUTIME_ID is supported by clock_getres. However, when using clock_getres with the CLOCK_THREAD_CPUTIME_ID clock ID, the function returns -1 and sets errno to EINVAL.
>How-To-Repeat:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main() {
struct timespec res;
if (clock_getres(CLOCK_THREAD_CPUTIME_ID, &res) == -1) {
perror("clock_getres");
return EXIT_FAILURE;
}
printf("Resolution of CLOCK_THREAD_CPUTIME_ID: %ld.%09ld seconds\n", res.tv_sec, res.tv_nsec);
return EXIT_SUCCESS;
}
$ gcc -o test_clock test_clock.c
$ ./test_clock
>Fix:
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.