From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by sourceware.org (Postfix) with ESMTPS id ED9CB385780B for ; Tue, 24 Nov 2020 21:49:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org ED9CB385780B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=lukma@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4Cgd2Z6gRbz1qs1D; Tue, 24 Nov 2020 22:49:10 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4Cgd2Z6DdQz1tF6G; Tue, 24 Nov 2020 22:49:10 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id zyp1BBjFd0SV; Tue, 24 Nov 2020 22:49:09 +0100 (CET) X-Auth-Info: G9PgcLbP+L1tZwZmR8BjpBjAly2yAABzq0BvAmynJhw= Received: from jawa (89-64-5-98.dynamic.chello.pl [89.64.5.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Tue, 24 Nov 2020 22:49:08 +0100 (CET) Date: Tue, 24 Nov 2020 22:48:59 +0100 From: Lukasz Majewski To: Adhemerval Zanella via Libc-alpha Cc: Adhemerval Zanella , Michael Kerrisk Subject: Re: [PATCH 13/13] linux: Return EINVAL for invalid clock for pthread_clockjoin_np Message-ID: <20201124224859.2886599f@jawa> In-Reply-To: <20201123195256.3336217-13-adhemerval.zanella@linaro.org> References: <20201123195256.3336217-1-adhemerval.zanella@linaro.org> <20201123195256.3336217-13-adhemerval.zanella@linaro.org> Organization: denx.de X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/4NokriWDq8h09gwCDveCS.p"; protocol="application/pgp-signature" X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, 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: , X-List-Received-Date: Tue, 24 Nov 2020 21:49:13 -0000 --Sig_/4NokriWDq8h09gwCDveCS.p Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Adhemerval, > The align the GNU extension with the others one that accept specify > which clock to wait for (such as pthread_mutex_clocklock). >=20 > Check on x86_64-linux-gnu. > --- > nptl/pthread_clockjoin.c | 4 ++ > sysdeps/pthread/Makefile | 2 +- > sysdeps/pthread/tst-join15.c | 80 > ++++++++++++++++++++++++++++++++++++ 3 files changed, 85 > insertions(+), 1 deletion(-) create mode 100644 > sysdeps/pthread/tst-join15.c >=20 > diff --git a/nptl/pthread_clockjoin.c b/nptl/pthread_clockjoin.c > index 0baba1e83d..3d54fe588f 100644 > --- a/nptl/pthread_clockjoin.c > +++ b/nptl/pthread_clockjoin.c > @@ -17,12 +17,16 @@ > . */ > =20 > #include > +#include > #include "pthreadP.h" > =20 > int > __pthread_clockjoin_np64 (pthread_t threadid, void **thread_return, > clockid_t clockid, const struct > __timespec64 *abstime) { > + if (!futex_abstimed_supported_clockid (clockid)) > + return EINVAL; > + > return __pthread_clockjoin_ex (threadid, thread_return, > clockid, abstime, true); > } > diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile > index 45a15b0b1a..8f335c13b5 100644 > --- a/sysdeps/pthread/Makefile > +++ b/sysdeps/pthread/Makefile > @@ -77,7 +77,7 @@ tests +=3D tst-cnd-basic tst-mtx-trylock > tst-cnd-broadcast \ tst-getpid3 \ > tst-join1 tst-join2 tst-join3 tst-join4 tst-join5 tst-join6 > tst-join7 \ tst-join8 tst-join9 tst-join10 tst-join11 tst-join12 > tst-join13 \ > - tst-join14 \ > + tst-join14 tst-join15 \ > tst-key1 tst-key2 tst-key3 tst-key4 \ > tst-kill1 tst-kill2 tst-kill3 tst-kill4 tst-kill5 tst-kill6 > \ tst-locale1 tst-locale2 \ > diff --git a/sysdeps/pthread/tst-join15.c > b/sysdeps/pthread/tst-join15.c new file mode 100644 > index 0000000000..4ed767e733 > --- /dev/null > +++ b/sysdeps/pthread/tst-join15.c > @@ -0,0 +1,80 @@ > +/* Check pthread_clockjoin_np clock support. > + Copyright (C) 2020 Free Software Foundation, Inc. > + This file is part of the GNU C Library. > + > + The GNU C Library is free software; you can redistribute it and/or > + modify it under the terms of the GNU Lesser General Public > + License as published by the Free Software Foundation; either > + version 2.1 of the License, or (at your option) any later version. > + > + The GNU C Library is distributed in the hope that it will be > useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + Lesser General Public License for more details. > + > + You should have received a copy of the GNU Lesser General Public > + License along with the GNU C Library; if not, see > + . */ > + > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > + > +static void * > +tf (void *arg) > +{ > + pause (); > + return NULL; > +} > + > + > +static int > +do_test (void) > +{ > + const clockid_t clocks[] =3D { > + CLOCK_REALTIME, > + CLOCK_MONOTONIC, > + CLOCK_PROCESS_CPUTIME_ID, > + CLOCK_THREAD_CPUTIME_ID, > + CLOCK_THREAD_CPUTIME_ID, > + CLOCK_MONOTONIC_RAW, > + CLOCK_REALTIME_COARSE, > + CLOCK_MONOTONIC_COARSE, > +#ifdef CLOCK_BOOTTIME > + CLOCK_BOOTTIME, > +#endif > +#ifdef CLOCK_REALTIME_ALARM > + CLOCK_REALTIME_ALARM, > +#endif > +#ifdef CLOCK_BOOTTIME_ALARM > + CLOCK_BOOTTIME_ALARM, > +#endif > +#ifdef CLOCK_TAI > + CLOCK_TAI > +#endif > + }; > + > + pthread_t thr =3D xpthread_create (NULL, tf, NULL); > + > + for (int t =3D 0; t < array_length (clocks); t++) > + { > + /* A valid timeout so valid clock timeout. */ > + struct timespec tmo =3D timespec_add (xclock_now (clocks[t]), > + make_timespec (0, > 100000000)); + > + int ret =3D clocks[t] =3D=3D CLOCK_REALTIME || clocks[t] =3D=3D > CLOCK_MONOTONIC > + ? ETIMEDOUT : EINVAL; > + > + TEST_COMPARE (pthread_clockjoin_np (thr, NULL, clocks[t], > &tmo), ret); > + } > + > + return 0; > +} > + > +#include Reviewed-by: Lukasz Majewski When can we expect that those patches will be pulled? It seems like we mostly remove dead (i.e. non Y2038 supporting) code in this series. As aio_suspend depends on this patch series I would be great if we would pull those sooner than latter :-). Adhemerval, thanks again for refactoring the futex code. Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de --Sig_/4NokriWDq8h09gwCDveCS.p Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEgAyFJ+N6uu6+XupJAR8vZIA0zr0FAl+9f8sACgkQAR8vZIA0 zr0Q9wgA1HfLAbmyQWBwbgwIvreah5LyTmPpoEg3MZxNRMU1EpXhbt0/3YTUXYA0 IXjQhJWhUUYtJf8q/qSOWHHUeVFVq/1d2i+xO1vNXlAzC8z6JawblKE9ZCGVBBbj Ck6dmChLVlwVyndiZOUO+pVZEDRGu/TGbXgBf5D7W/DGZFhs9E68c9Bsrtqvx6Is xp/uW7+YNmk/I9s4e+j9Zi+y6j38LLMJoSp2BPhEvGZNHl+XT+AvLpfpHBEJQVeD +7bJXZ0yHlBkPUj1U8zaeEtX9bqXIURc1DWRDTTVX1s1Golk/0rZ3Ntn2DKHfQeD a2gYBAAHecyCmr5aEtJPuZP2HSXAzQ== =BndC -----END PGP SIGNATURE----- --Sig_/4NokriWDq8h09gwCDveCS.p--