From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 7B3881F463 for ; Fri, 20 Dec 2019 21:39:20 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=eBQgBWreqeDIZMGLkXP1cRt/hDzp5Ni PPQh9Pq4veZ1rD7BOOnvyO/PYJRMuQDB5NjcuPEB4nJBiUhy8zAKsfZ+Ib44Oh68 XIG6GyCVLTcYOqWJMer9V0SXXn45BN7A1i55yT+o938O211U+mqx9OgR9nxUQHn8 9LF1W5KOc54o= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=Ux5X/+1AqS9dv9k7oU8dRTPdqvE=; b=Sva3L orBKI71MbTV/QhKYuNirTXyQJz5I0OsyvSNEvzD/gG8EU86OdvDyUHC41OQIER7t xo69MLx+qZalquaIouXQpNYx41QoG9WzRmHYKrBRBj8Vtv5LltvgGGmpttzO9Ohr FzOJ2hMyhER+C7lHaYSt5x1n0pZ7WAu9uwba/U= Received: (qmail 129029 invoked by alias); 20 Dec 2019 21:38:35 -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 Received: (qmail 128936 invoked by uid 89); 20 Dec 2019 21:38:34 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mail.efficios.com DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 8EE70690A5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1576877906; bh=DQReyWGL0WhYg0+OoZTeoFAmtaicmOMVArhHrv7ZtRs=; h=From:To:Date:Message-Id; b=o4VYA8PASFe2wG78tIwzotZ9jdiQ1s3JNz5QaLy/zGagHZ8FvyoO2bccQfbSdVq4a AStBhvzvN3U0oB0g/xSP7urDIW6PY0IrIRdJRd2nQRCM/+0cfbp0J/XqDSfQ28lqyU gZryejxAE5qWkUTaglPUcoCCAPe8nC7mPiANnS7r9pPmngvDDs7lqlOS1Hzk2cuh/m 6PDlnhb9jikBiuH0vkd2bcluzUyPy0qj+i1r5F3Dk3OMNO6bomBkXQkZwDHf6oL0HS O3nZuG083qBykQoiBu7HAuxmSyg8YQuuiV2thvIZ34A4JltURZ+XQ9s5JoFocnZHU/ /ewzL6HRocnkg== From: Mathieu Desnoyers To: Carlos O'Donell Cc: Florian Weimer , Joseph Myers , Szabolcs Nagy , libc-alpha@sourceware.org, Mathieu Desnoyers Subject: [RFC PATCH glibc 12/13] support: implement xpthread key create/delete (v3) Date: Fri, 20 Dec 2019 16:36:49 -0500 Message-Id: <20191220213650.11281-13-mathieu.desnoyers@efficios.com> In-Reply-To: <20191220213650.11281-1-mathieu.desnoyers@efficios.com> References: <20191220213650.11281-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.old/ChangeLog.19 | 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.old/ChangeLog.19 b/ChangeLog.old/ChangeLog.19 index 07c6aff585..ae2e4af636 100644 --- a/ChangeLog.old/ChangeLog.19 +++ b/ChangeLog.old/ChangeLog.19 @@ -1,3 +1,11 @@ +2019-12-17 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-12-17 Mathieu Desnoyers * sysdeps/unix/sysv/linux/sched_getcpu.c: use rseq cpu_id TLS on diff --git a/support/Makefile b/support/Makefile index 23c6d74627..affc598c65 100644 --- a/support/Makefile +++ b/support/Makefile @@ -127,6 +127,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 f39720cb23..4be86b39a0 100644 --- a/support/xthread.h +++ b/support/xthread.h @@ -95,6 +95,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 -- 2.17.1