From patchwork Sun Jun 7 01:15:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1304638 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49fdkL22Kdz9sRR for ; Sun, 7 Jun 2020 11:16:10 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A00C2384A87E; Sun, 7 Jun 2020 01:16:06 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from hera.aquilenet.fr (hera.aquilenet.fr [185.233.100.1]) by sourceware.org (Postfix) with ESMTPS id 8BE3A3851C17 for ; Sun, 7 Jun 2020 01:15:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8BE3A3851C17 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=samuel.thibault@ens-lyon.org Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id C071111DC; Sun, 7 Jun 2020 03:15:57 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KlpxKkR57_Gj; Sun, 7 Jun 2020 03:15:56 +0200 (CEST) Received: from function (lfbn-bor-1-797-11.w86-234.abo.wanadoo.fr [86.234.239.11]) by hera.aquilenet.fr (Postfix) with ESMTPSA id A3F3611AB; Sun, 7 Jun 2020 03:15:56 +0200 (CEST) Received: from samy by function with local (Exim 4.93) (envelope-from ) id 1jhjul-00GL0J-LL; Sun, 07 Jun 2020 03:15:55 +0200 From: Samuel Thibault To: libc-alpha@sourceware.org Subject: [hurd,commited] htl: Add sem_clockwait support Date: Sun, 7 Jun 2020 03:15:55 +0200 Message-Id: <20200607011555.3893946-1-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: commit-hurd@gnu.org Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" * sysdeps/htl/sem-timedwait.c (__sem_timedwait_internal): Add clock_id parameter instead of hardcoding CLOCK_REALTIME. (__sem_clockwait): New function. (sem_clockwait): New weak alias. * sysdeps/htl/sem-wait.c (__sem_timedwait_internal): Update declaration. (__sem_wait): Update call to __sem_timedwait_internal. * htl/Versions (GLIBC_2.32): Add sem_clockwait. * sysdeps/mach/hurd/i386/libpthread.abilist (sem_clockwait): Add symbol. * nptl/Makefile (tests): Move tst-sem5 to... * sysdeps/pthread/Makefile (tests): ... here. --- htl/Versions | 4 +++- nptl/Makefile | 2 +- sysdeps/htl/sem-timedwait.c | 12 ++++++++++-- sysdeps/htl/sem-wait.c | 3 ++- sysdeps/mach/hurd/i386/libpthread.abilist | 1 + sysdeps/pthread/Makefile | 2 +- {nptl => sysdeps/pthread}/tst-sem5.c | 0 7 files changed, 18 insertions(+), 6 deletions(-) rename {nptl => sysdeps/pthread}/tst-sem5.c (100%) diff --git a/htl/Versions b/htl/Versions index 5fa9ef637c..fd9eefbaee 100644 --- a/htl/Versions +++ b/htl/Versions @@ -143,8 +143,8 @@ libpthread { pthread_hurd_cond_timedwait_np; } - # C11 thread symbols. GLIBC_2.32 { + # C11 thread symbols. thrd_create; thrd_detach; thrd_exit; thrd_join; mtx_init; mtx_lock; mtx_timedlock; mtx_trylock; mtx_unlock; mtx_destroy; call_once; @@ -162,6 +162,8 @@ libpthread { pthread_rwlock_clockrdlock; pthread_rwlock_clockwrlock; pthread_tryjoin_np; pthread_timedjoin_np; pthread_clockjoin_np; + + sem_clockwait; } GLIBC_PRIVATE { diff --git a/nptl/Makefile b/nptl/Makefile index b017cb855b..0e835ae83f 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -275,7 +275,7 @@ tests = tst-attr2 tst-attr3 tst-default-attr \ tst-rwlock9 tst-rwlock10 tst-rwlock11 \ tst-rwlock15 tst-rwlock17 tst-rwlock18 \ tst-once5 \ - tst-sem5 tst-sem17 \ + tst-sem17 \ tst-align tst-align3 \ tst-kill1 tst-kill2 tst-kill3 tst-kill4 tst-kill5 tst-kill6 \ tst-raise1 \ diff --git a/sysdeps/htl/sem-timedwait.c b/sysdeps/htl/sem-timedwait.c index 2d8cf25328..0b1b6d0961 100644 --- a/sysdeps/htl/sem-timedwait.c +++ b/sysdeps/htl/sem-timedwait.c @@ -25,12 +25,12 @@ int __sem_timedwait_internal (sem_t *restrict sem, + clockid_t clock_id, const struct timespec *restrict timeout) { error_t err; int drain; struct __pthread *self; - clockid_t clock_id = CLOCK_REALTIME; __pthread_spin_wait (&sem->__lock); if (sem->__value > 0) @@ -88,10 +88,18 @@ __sem_timedwait_internal (sem_t *restrict sem, return 0; } +int +__sem_clockwait (sem_t *sem, clockid_t clockid, + const struct timespec *restrict timeout) +{ + return __sem_timedwait_internal (sem, clockid, timeout); +} +weak_alias (__sem_clockwait, sem_clockwait); + int __sem_timedwait (sem_t *restrict sem, const struct timespec *restrict timeout) { - return __sem_timedwait_internal (sem, timeout); + return __sem_timedwait_internal (sem, CLOCK_REALTIME, timeout); } weak_alias (__sem_timedwait, sem_timedwait); diff --git a/sysdeps/htl/sem-wait.c b/sysdeps/htl/sem-wait.c index 1db2d9005c..74b39d5b75 100644 --- a/sysdeps/htl/sem-wait.c +++ b/sysdeps/htl/sem-wait.c @@ -20,12 +20,13 @@ #include extern int __sem_timedwait_internal (sem_t *restrict sem, + clockid_t clockid, const struct timespec *restrict timeout); int __sem_wait (sem_t *sem) { - return __sem_timedwait_internal (sem, 0); + return __sem_timedwait_internal (sem, CLOCK_REALTIME, 0); } strong_alias (__sem_wait, sem_wait); diff --git a/sysdeps/mach/hurd/i386/libpthread.abilist b/sysdeps/mach/hurd/i386/libpthread.abilist index a1026f0d1e..a1e0a7183b 100644 --- a/sysdeps/mach/hurd/i386/libpthread.abilist +++ b/sysdeps/mach/hurd/i386/libpthread.abilist @@ -168,6 +168,7 @@ GLIBC_2.32 pthread_rwlock_clockrdlock F GLIBC_2.32 pthread_rwlock_clockwrlock F GLIBC_2.32 pthread_timedjoin_np F GLIBC_2.32 pthread_tryjoin_np F +GLIBC_2.32 sem_clockwait F GLIBC_2.32 thrd_create F GLIBC_2.32 thrd_detach F GLIBC_2.32 thrd_exit F diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile index 3dc88274a7..1d1ddeb099 100644 --- a/sysdeps/pthread/Makefile +++ b/sysdeps/pthread/Makefile @@ -64,7 +64,7 @@ tests += tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \ tst-rwlock1 tst-rwlock4 tst-rwlock5 tst-rwlock12 \ tst-rwlock13 tst-rwlock14 tst-rwlock16 \ tst-rwlock-tryrdlock-stall tst-rwlock-trywrlock-stall \ - tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem6 tst-sem7 \ + tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem5 tst-sem6 tst-sem7 \ tst-sem8 tst-sem9 tst-sem10 tst-sem14 tst-sem15 tst-sem16 \ tst-spin1 tst-spin2 tst-spin3 tst-spin4 \ tst-abstime diff --git a/nptl/tst-sem5.c b/sysdeps/pthread/tst-sem5.c similarity index 100% rename from nptl/tst-sem5.c rename to sysdeps/pthread/tst-sem5.c