From patchwork Sun Jan 12 22:32:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 104637 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DF06C3858408 for ; Sun, 12 Jan 2025 22:38:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DF06C3858408 X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sonata.ens-lyon.org (domu-toccata.ens-lyon.fr [140.77.166.138]) by sourceware.org (Postfix) with ESMTPS id 38A813858408 for ; Sun, 12 Jan 2025 22:32:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 38A813858408 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bounce.ens-lyon.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 38A813858408 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=140.77.166.138 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736721177; cv=none; b=kQ2JZTJEy1txF5gPsWuqOHcAThH4IVmXRMkRDzoWMaCPlDwU3QpAhV56JtRUlNNEhhWZRy6HqwgbgwGWfB8r7RUbt0rZbGuBqP01zXJodYkwUsM1PmO+z+QBvnN01JDDahisrn3qEnCqeGpV35gFoCubelaZmuH6XTDfBbw3D38= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736721177; c=relaxed/simple; bh=UhGFrnH/ENmwBQuCqU+rJyMvKzL94YPzPk5uYSrIwNM=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=r6mspC5qZK1POAQoneQyka+pHjFmqI4cw06RWoeIbhKGtrvKvIMSVpGqShqKKGNz4oxbFl82q2FLMj/q+vMnKDTl5V0N3IJrqrtkRbjMKTnyNdy0pyXKXaWOuNxegL6oxqrtyKUIJM0/b/O+xXlmUdIxjcRi8meq8OScmjsEHYs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 38A813858408 Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 5B887A49CB; Sun, 12 Jan 2025 23:32:56 +0100 (CET) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Z_AL-EECmGJn; Sun, 12 Jan 2025 23:32:56 +0100 (CET) Received: from begin (aamiens-653-1-40-48.w83-192.abo.wanadoo.fr [83.192.199.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id E75F6A49CC; Sun, 12 Jan 2025 23:32:55 +0100 (CET) Received: from samy by begin with local (Exim 4.98) (envelope-from ) id 1tX6Vr-0000000Ch4D-1oaA; Sun, 12 Jan 2025 23:32:55 +0100 From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Zhaoming Luo , commit-hurd@gnu.org Subject: [hurd, commited 1/4] mach: Add CLOCK_MONOTONIC case in clock_gettime() Date: Sun, 12 Jan 2025 23:32:51 +0100 Message-ID: <20250112223254.3025467-2-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250112223254.3025467-1-samuel.thibault@ens-lyon.org> References: <20250112223254.3025467-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org From: Zhaoming Luo The Mach RPC host_get_uptime64() is implemented. It returns the elapsed time value since bootup. See https://git.savannah.gnu.org/cgit/hurd/gnumach.git/commit/?id=fc494bfe3fb6363e1077dc035eb119970d84a9d1 In this patch, the RPC is used to implement the monotonic clock for mach. * config.h.in: Add HAVE_HOST_GET_UPTIME64 config entry * sysdeps/mach/clock_gettime.c: Add CLOCK_MONOTONIC case * sysdeps/mach/configure: Check the existence of host_get_uptime64 RPC * sysdeps/mach/configure.ac: Check the existence of host_get_uptime64 RPC Message-ID: <20250106043907.1046-1-zhmingluo@163.com> --- config.h.in | 3 +++ sysdeps/mach/clock_gettime.c | 24 ++++++++++++++++++++++++ sysdeps/mach/configure | 30 ++++++++++++++++++++++++++++++ sysdeps/mach/configure.ac | 2 ++ 4 files changed, 59 insertions(+) diff --git a/config.h.in b/config.h.in index c26f98ccd6..cdbd555366 100644 --- a/config.h.in +++ b/config.h.in @@ -163,6 +163,9 @@ /* Mach specific: define if the `host_page_size' RPC is available. */ #undef HAVE_HOST_PAGE_SIZE +/* Mach specific: define if the `host_get_uptime64' RPC is available. */ +#undef HAVE_HOST_GET_UPTIME64 + /* Mach specific: define if the `thread_set_name' RPC is available. */ #undef HAVE_MACH_THREAD_SET_NAME diff --git a/sysdeps/mach/clock_gettime.c b/sysdeps/mach/clock_gettime.c index 1392475963..d8c6681ec5 100644 --- a/sysdeps/mach/clock_gettime.c +++ b/sysdeps/mach/clock_gettime.c @@ -20,6 +20,7 @@ #include #include #include +#include /* Get the current time of day, putting it into *TS. Returns 0 on success, -1 on errors. */ @@ -31,6 +32,29 @@ __clock_gettime (clockid_t clock_id, struct timespec *ts) switch (clock_id) { + case CLOCK_MONOTONIC: + /* If HAVE_HOST_GET_UPTIME64 is not defined or not available, + CLOCK_MONOTONIC will be equivalent to CLOCK_REALTIME. */ +#ifdef HAVE_HOST_GET_UPTIME64 + { + time_value64_t tv; + err = __host_get_uptime64 (__mach_host_self (), &tv); + + if (err != MIG_BAD_ID) + { + if (err) + { + __set_errno (err); + return -1; + } + + TIME_VALUE64_TO_TIMESPEC (&tv, ts); + return 0; + } + } + /* FALLTHROUGH */ +#endif + case CLOCK_REALTIME: { /* __host_get_time can only fail if passed an invalid host_t. diff --git a/sysdeps/mach/configure b/sysdeps/mach/configure index abfe084fda..8aa6bbb18b 100644 --- a/sysdeps/mach/configure +++ b/sysdeps/mach/configure @@ -461,6 +461,36 @@ if test $libc_cv_mach_rpc_host_page_size = yes; then fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for host_get_uptime64 in mach_host.defs" >&5 +printf %s "checking for host_get_uptime64 in mach_host.defs... " >&6; } +if test ${libc_cv_mach_rpc_host_get_uptime64+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP_TRADITIONAL "host_get_uptime64" >/dev/null 2>&1 +then : + libc_cv_mach_rpc_host_get_uptime64=yes +else case e in #( + e) libc_cv_mach_rpc_host_get_uptime64=no ;; +esac +fi +rm -rf conftest* + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mach_rpc_host_get_uptime64" >&5 +printf "%s\n" "$libc_cv_mach_rpc_host_get_uptime64" >&6; } +if test $libc_cv_mach_rpc_host_get_uptime64 = yes; then + printf "%s\n" "#define HAVE_HOST_GET_UPTIME64 1" >>confdefs.h + +fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for thread_set_name in gnumach.defs" >&5 printf %s "checking for thread_set_name in gnumach.defs... " >&6; } if test ${libc_cv_mach_rpc_thread_set_name+y} diff --git a/sysdeps/mach/configure.ac b/sysdeps/mach/configure.ac index 6dfa2b3518..08e5fdefe9 100644 --- a/sysdeps/mach/configure.ac +++ b/sysdeps/mach/configure.ac @@ -92,6 +92,8 @@ fi mach_RPC_CHECK(mach_host.defs, host_page_size, HAVE_HOST_PAGE_SIZE) +mach_RPC_CHECK(mach_host.defs, host_get_uptime64, + HAVE_HOST_GET_UPTIME64) mach_RPC_CHECK(gnumach.defs, thread_set_name, HAVE_MACH_THREAD_SET_NAME) mach_RPC_CHECK(gnumach.defs, thread_get_name, From patchwork Sun Jan 12 22:32:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 104635 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CA7403857BB0 for ; Sun, 12 Jan 2025 22:35:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CA7403857BB0 X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sonata.ens-lyon.org (sonata.ens-lyon.org [140.77.166.138]) by sourceware.org (Postfix) with ESMTPS id 146143858D3C for ; Sun, 12 Jan 2025 22:32:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 146143858D3C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bounce.ens-lyon.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 146143858D3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=140.77.166.138 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736721177; cv=none; b=TUfnXe79t24xBmEShzPCvfX6E5koWBgjjfi986/GydjJRY+81Ox5y29acxbQMbjcZxnIu/hTjPjU8GOzuDye6cp909CvOuKSPpDQ8s+NI/gZiprnylkJ0MHOjG5GVz78SugckNPi/+cBdiugw7rrF8HBi+Kxm8tvvfD7QJAk8BY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736721177; c=relaxed/simple; bh=lYvyIuO3VkXDblOFWDCPk3WQmemI35dpFi1kWOBGPP8=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=pGnkZuCGdaXXLlTg/t843O9l2GouZoruSy88WeSVjRbgoDfZsstF7eH+umfj9uv33QvvkBsM4dT2J7iCrE8zigJJyb7yz0PcIf8dIY6gGbyCoh15NjOwQGXXhy0wRVtAcJZBNGigSmEYeF8FSvO8HgvQdcquww8OQld4KtyQqdA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 146143858D3C Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 1E315A49D9; Sun, 12 Jan 2025 23:32:56 +0100 (CET) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xHLhiBjbZXxr; Sun, 12 Jan 2025 23:32:56 +0100 (CET) Received: from begin (aamiens-653-1-40-48.w83-192.abo.wanadoo.fr [83.192.199.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id E01C8A0294; Sun, 12 Jan 2025 23:32:55 +0100 (CET) Received: from samy by begin with local (Exim 4.98) (envelope-from ) id 1tX6Vr-0000000Ch4G-1tyr; Sun, 12 Jan 2025 23:32:55 +0100 From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault , commit-hurd@gnu.org Subject: [hurd,commited 2/4] hurd: Add CLOCK_MONOTONIC support to lll Date: Sun, 12 Jan 2025 23:32:52 +0100 Message-ID: <20250112223254.3025467-3-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250112223254.3025467-1-samuel.thibault@ens-lyon.org> References: <20250112223254.3025467-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org --- hurd/hurdlock.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hurd/hurdlock.c b/hurd/hurdlock.c index a97144348c..374e4d107a 100644 --- a/hurd/hurdlock.c +++ b/hurd/hurdlock.c @@ -47,7 +47,7 @@ int __lll_abstimed_wait (void *ptr, int val, const struct timespec *tsp, int flags, int clk) { - if (clk != CLOCK_REALTIME) + if (clk != CLOCK_REALTIME && clk != CLOCK_MONOTONIC) return EINVAL; int mlsec = compute_reltime (tsp, clk); @@ -58,7 +58,7 @@ int __lll_abstimed_wait_intr (void *ptr, int val, const struct timespec *tsp, int flags, int clk) { - if (clk != CLOCK_REALTIME) + if (clk != CLOCK_REALTIME && clk != CLOCK_MONOTONIC) return EINVAL; int mlsec = compute_reltime (tsp, clk); @@ -69,7 +69,7 @@ int __lll_abstimed_xwait (void *ptr, int lo, int hi, const struct timespec *tsp, int flags, int clk) { - if (clk != CLOCK_REALTIME) + if (clk != CLOCK_REALTIME && clk != CLOCK_MONOTONIC) return EINVAL; int mlsec = compute_reltime (tsp, clk); @@ -81,7 +81,7 @@ int __lll_abstimed_lock (void *ptr, const struct timespec *tsp, int flags, int clk) { - if (clk != CLOCK_REALTIME) + if (clk != CLOCK_REALTIME && clk != CLOCK_MONOTONIC) return EINVAL; if (__lll_trylock (ptr) == 0) @@ -167,7 +167,7 @@ __lll_robust_abstimed_lock (void *ptr, int wait_time = 25; unsigned int val; - if (clk != CLOCK_REALTIME) + if (clk != CLOCK_REALTIME && clk != CLOCK_MONOTONIC) return EINVAL; while (1) From patchwork Sun Jan 12 22:32:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 104636 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E61B5385840F for ; Sun, 12 Jan 2025 22:35:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E61B5385840F X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sonata.ens-lyon.org (domu-toccata.ens-lyon.fr [140.77.166.138]) by sourceware.org (Postfix) with ESMTPS id 31E623858C33 for ; Sun, 12 Jan 2025 22:32:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 31E623858C33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bounce.ens-lyon.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 31E623858C33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=140.77.166.138 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736721177; cv=none; b=UWO2IJBqfEMnCOkGyZ8v7cyLAUgKrwYVowu6J5yMDOUdmXsL1+Mpd1k8krWbY/IsM1XJUmMMsn492XYAVXsD99IEeT70Vna52JFbE3+4niSp2JO28KMxb/z1JZJhjsLMgGI9K3IrJZZuPQj6t3WHgeZf1HL0Idfun26V/Vjxwu0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736721177; c=relaxed/simple; bh=7p8zoc8FhJcHYyyczZtfw1p8Xtb5ZCYnkRo+gQuzDsU=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=VJ2xN1BzVjcIBYBQwdqrUtNUj/kLyadTv5Xnv/0KQ3Jmhfbo+x9Ksm5dYCR6FNHv2ucHXtZQbC1X+XUNUF+1zmR8uJaTnZtgYhgKnnPrPfgoyVx9aAIDKG88X/Aw1yjDCDdW5o1q/nyNHuoJJbxbOevVnQsFDjpTomyWpmLpBx0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 31E623858C33 Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 42078A0294; Sun, 12 Jan 2025 23:32:56 +0100 (CET) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MXljPpsuFhr4; Sun, 12 Jan 2025 23:32:56 +0100 (CET) Received: from begin (aamiens-653-1-40-48.w83-192.abo.wanadoo.fr [83.192.199.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id E4551A49CB; Sun, 12 Jan 2025 23:32:55 +0100 (CET) Received: from samy by begin with local (Exim 4.98) (envelope-from ) id 1tX6Vr-0000000Ch4J-1zbl; Sun, 12 Jan 2025 23:32:55 +0100 From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault , commit-hurd@gnu.org Subject: [hurd,commited 3/4] hurd: Add CLOCK_MONOTONIC to clock_nanosleep Date: Sun, 12 Jan 2025 23:32:53 +0100 Message-ID: <20250112223254.3025467-4-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250112223254.3025467-1-samuel.thibault@ens-lyon.org> References: <20250112223254.3025467-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org --- sysdeps/mach/clock_nanosleep.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sysdeps/mach/clock_nanosleep.c b/sysdeps/mach/clock_nanosleep.c index 567e24d836..c9373ed1d9 100644 --- a/sysdeps/mach/clock_nanosleep.c +++ b/sysdeps/mach/clock_nanosleep.c @@ -25,7 +25,7 @@ #include static int -nanosleep_call (const struct timespec *req, struct timespec *rem) +nanosleep_call (clockid_t clock_id, const struct timespec *req, struct timespec *rem) { mach_port_t recv; struct timespec before; @@ -38,7 +38,7 @@ nanosleep_call (const struct timespec *req, struct timespec *rem) recv = __mach_reply_port (); if (rem != NULL) - __clock_gettime (CLOCK_REALTIME, &before); + __clock_gettime (clock_id, &before); int cancel_oldtype = LIBC_CANCEL_ASYNC(); err = __mach_msg (NULL, MACH_RCV_MSG|MACH_RCV_TIMEOUT|MACH_RCV_INTERRUPT, @@ -52,7 +52,7 @@ nanosleep_call (const struct timespec *req, struct timespec *rem) if (rem != NULL) { struct timespec after, elapsed; - __clock_gettime (CLOCK_REALTIME, &after); + __clock_gettime (clock_id, &after); timespec_sub (&elapsed, &after, &before); timespec_sub (rem, req, &elapsed); } @@ -67,7 +67,7 @@ int __clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req, struct timespec *rem) { - if (clock_id != CLOCK_REALTIME + if ((clock_id != CLOCK_REALTIME && clock_id != CLOCK_MONOTONIC) || req->tv_sec < 0 || !valid_nanoseconds (req->tv_nsec) || (flags != 0 && flags != TIMER_ABSTIME)) @@ -105,7 +105,7 @@ __clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req, rem = NULL; } - return nanosleep_call (req, rem); + return nanosleep_call (clock_id, req, rem); } libc_hidden_def (__clock_nanosleep) versioned_symbol (libc, __clock_nanosleep, clock_nanosleep, GLIBC_2_17); From patchwork Sun Jan 12 22:32:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 104638 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 284C33858432 for ; Sun, 12 Jan 2025 22:38:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 284C33858432 X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sonata.ens-lyon.org (domu-toccata.ens-lyon.fr [140.77.166.138]) by sourceware.org (Postfix) with ESMTPS id 2DB273858C48 for ; Sun, 12 Jan 2025 22:32:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2DB273858C48 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bounce.ens-lyon.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2DB273858C48 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=140.77.166.138 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736721177; cv=none; b=HpMo0gbTJRPEqUUDoiD2l6sbPbsEDpZGD5+P+cbIsBs+BIsvxHyLf10Ku8JgGFj/K+vgDXvZn9eMwC/rMHPlb90WsStDDFcFUD9cwFHabNojLpwkATQtMzP4ZmAQe0pr0eeRUp5HRI7Rk+EiT4m5lurcbqCqIFaGHPvkLoJ0y7I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736721177; c=relaxed/simple; bh=P1JaI1qgM37QlEJnC7fB/2047P8VgyOEeUYKy0zrwlk=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=nyntaL0gLvwdzs4FXr+qOdg6THcLgrKeeLk6xDrLutirzp+8C6q/wdj/VfF3u8KpeSbwVRkRnaFOC1A6awOFscAUiZ0wM8r5v8Zya4Mk7vZ4I6bN+nKil8j5C4071xZwI1wzq8Lx/3jvWqSnNVKwV7eEYa0MkXMcrnYSQgnbyKI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2DB273858C48 Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 408ADA01A2; Sun, 12 Jan 2025 23:32:56 +0100 (CET) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CZsqGG9GcEwi; Sun, 12 Jan 2025 23:32:56 +0100 (CET) Received: from begin (aamiens-653-1-40-48.w83-192.abo.wanadoo.fr [83.192.199.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id EAB7EA49D8; Sun, 12 Jan 2025 23:32:55 +0100 (CET) Received: from samy by begin with local (Exim 4.98) (envelope-from ) id 1tX6Vr-0000000Ch4M-250R; Sun, 12 Jan 2025 23:32:55 +0100 From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault , commit-hurd@gnu.org Subject: [hurd,commited 4/4] hurd: Set _POSIX_MONOTONIC_CLOCK to 200809L Date: Sun, 12 Jan 2025 23:32:54 +0100 Message-ID: <20250112223254.3025467-5-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250112223254.3025467-1-samuel.thibault@ens-lyon.org> References: <20250112223254.3025467-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org Now that CLOCK_MONOTONIC is supported. --- sysdeps/mach/hurd/bits/posix_opt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sysdeps/mach/hurd/bits/posix_opt.h b/sysdeps/mach/hurd/bits/posix_opt.h index 17197b1cbb..b7f80e32e1 100644 --- a/sysdeps/mach/hurd/bits/posix_opt.h +++ b/sysdeps/mach/hurd/bits/posix_opt.h @@ -163,7 +163,7 @@ #define _POSIX_THREAD_PROCESS_SHARED -1 /* The monotonic clock might be available. */ -#define _POSIX_MONOTONIC_CLOCK 0 +#define _POSIX_MONOTONIC_CLOCK 200809L /* The clock selection interfaces are available. */ #define _POSIX_CLOCK_SELECTION 200809L