From patchwork Wed Aug 7 14:27:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 33995 Received: (qmail 94583 invoked by alias); 7 Aug 2019 14:35:15 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 94564 invoked by uid 89); 7 Aug 2019 14:35:15 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail.efficios.com DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 734FB2B745B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1565188059; bh=aMbfIEaeRGBd44HFCYDmzoGxD6eV151ZTQuyZxCDDhM=; h=From:To:Date:Message-Id; b=Ea1FXtHS3zUst1UN8wsjStB6o3HVnbiC/msABuiRZTQc3aNhhA/xdewub9n2skfYS PvsIEaZpRAgcOfhb/B55YCwSSxscodePeSQRQDEQ3b3PUbMs5iicb0jZnOD8L6jBvj m9FegPVUe97tNJ+799j/71Z6OWcLGI/j3sUeCO5uVGGIyp92oiT3IQEit8GqAxMWWQ Lxy5yvcyBIrLkwBqFuhI35FMXCedicvmORuKszfV50kzzw8SNuiC9iAAih8AghjpH7 L24laI9l18NqB8J0JGAiE09upCRqcty5X2Xbyv4XcVxlGXZOCX2yW72NrrliwsBu3r WOykobzvVNhaQ== From: Mathieu Desnoyers To: Carlos O'Donell Cc: Florian Weimer , Joseph Myers , Szabolcs Nagy , libc-alpha@sourceware.org, Mathieu Desnoyers Subject: [PATCH glibc 2.31 4/5] support: implement xpthread key create/delete (v3) Date: Wed, 7 Aug 2019 10:27:25 -0400 Message-Id: <20190807142726.2579-5-mathieu.desnoyers@efficios.com> In-Reply-To: <20190807142726.2579-1-mathieu.desnoyers@efficios.com> References: <20190807142726.2579-1-mathieu.desnoyers@efficios.com> Expose xpthread_key_create () and xpthread_key_delete () wrappers for tests. Signed-off-by: Mathieu Desnoyers CC: Carlos O'Donell CC: Florian Weimer CC: Joseph Myers CC: Szabolcs Nagy CC: libc-alpha@sourceware.org --- Changes since v1: - Update ChangeLog. - Wrap long line in xpthread_key_create. Changes since v2: - Rebase on glibc 2.30. --- ChangeLog | 8 ++++++++ support/Makefile | 2 ++ support/xpthread_key_create.c | 25 +++++++++++++++++++++++++ support/xpthread_key_delete.c | 24 ++++++++++++++++++++++++ support/xthread.h | 2 ++ 5 files changed, 61 insertions(+) create mode 100644 support/xpthread_key_create.c create mode 100644 support/xpthread_key_delete.c diff --git a/ChangeLog b/ChangeLog index 128a7b4baa..15fec9d4c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2019-08-06 Mathieu Desnoyers + + * support/Makefile: Add xpthread_key_create and xpthread_key_delete. + * support/xthread.h: Add prototype for xpthread_key_create and + xpthread_key_delete. + * support/xpthread_key_create.c: New file. + * support/xpthread_key_delete.c: New file. + 2019-08-06 Mathieu Desnoyers * sysdeps/unix/sysv/linux/sched_getcpu.c: use rseq cpu_id TLS on diff --git a/support/Makefile b/support/Makefile index ab66913a02..34163667a7 100644 --- a/support/Makefile +++ b/support/Makefile @@ -124,6 +124,8 @@ libsupport-routines = \ xpthread_create \ xpthread_detach \ xpthread_join \ + xpthread_key_create \ + xpthread_key_delete \ xpthread_mutex_consistent \ xpthread_mutex_destroy \ xpthread_mutex_init \ diff --git a/support/xpthread_key_create.c b/support/xpthread_key_create.c new file mode 100644 index 0000000000..fb5a89ab3a --- /dev/null +++ b/support/xpthread_key_create.c @@ -0,0 +1,25 @@ +/* pthread_key_create with error checking. + Copyright (C) 2019 Free Software Foundation, Inc. + + 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 + +void +xpthread_key_create (pthread_key_t *key, void (*destr_function) (void *)) +{ + xpthread_check_return ("pthread_key_create", + pthread_key_create (key, destr_function)); +} diff --git a/support/xpthread_key_delete.c b/support/xpthread_key_delete.c new file mode 100644 index 0000000000..423ff4584d --- /dev/null +++ b/support/xpthread_key_delete.c @@ -0,0 +1,24 @@ +/* pthread_key_delete with error checking. + Copyright (C) 2019 Free Software Foundation, Inc. + + 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 + +void +xpthread_key_delete (pthread_key_t key) +{ + xpthread_check_return ("pthread_key_delete", pthread_key_delete (key)); +} diff --git a/support/xthread.h b/support/xthread.h index 5204f78ed2..fdeb1bc023 100644 --- a/support/xthread.h +++ b/support/xthread.h @@ -87,6 +87,8 @@ void xpthread_rwlock_wrlock (pthread_rwlock_t *rwlock); void xpthread_rwlock_rdlock (pthread_rwlock_t *rwlock); void xpthread_rwlock_unlock (pthread_rwlock_t *rwlock); void xpthread_rwlock_destroy (pthread_rwlock_t *rwlock); +void xpthread_key_create (pthread_key_t *key, void (*destr_function) (void *)); +void xpthread_key_delete (pthread_key_t key); __END_DECLS