Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/817690/?format=api
{ "id": 817690, "url": "http://patchwork.ozlabs.org/api/patches/817690/?format=api", "web_url": "http://patchwork.ozlabs.org/project/glibc/patch/1506112024-22601-6-git-send-email-adhemerval.zanella@linaro.org/", "project": { "id": 41, "url": "http://patchwork.ozlabs.org/api/projects/41/?format=api", "name": "GNU C Library", "link_name": "glibc", "list_id": "libc-alpha.sourceware.org", "list_email": "libc-alpha@sourceware.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1506112024-22601-6-git-send-email-adhemerval.zanella@linaro.org>", "list_archive_url": null, "date": "2017-09-22T20:27:01", "name": "[5/8] nptl: Add C11 threads tss_* functions", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "16a6fe8006e06b428f3d91dc9e8c3798883aac24", "submitter": { "id": 66065, "url": "http://patchwork.ozlabs.org/api/people/66065/?format=api", "name": "Adhemerval Zanella Netto", "email": "adhemerval.zanella@linaro.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/glibc/patch/1506112024-22601-6-git-send-email-adhemerval.zanella@linaro.org/mbox/", "series": [ { "id": 4704, "url": "http://patchwork.ozlabs.org/api/series/4704/?format=api", "web_url": "http://patchwork.ozlabs.org/project/glibc/list/?series=4704", "date": "2017-09-22T20:26:56", "name": "Add support for ISO C threads.h", "version": 7, "mbox": "http://patchwork.ozlabs.org/series/4704/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/817690/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/817690/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<libc-alpha-return-84878-incoming=patchwork.ozlabs.org@sourceware.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "mailing list libc-alpha@sourceware.org" ], "Authentication-Results": [ "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=sourceware.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=libc-alpha-return-84878-incoming=patchwork.ozlabs.org@sourceware.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org; dkim=pass (1024-bit key;\n\tsecure) header.d=sourceware.org header.i=@sourceware.org\n\theader.b=\"rWrv2vqY\"; dkim-atps=neutral", "sourceware.org; auth=none" ], "Received": [ "from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xzQ676hybz9t32\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 23 Sep 2017 06:28:15 +1000 (AEST)", "(qmail 66512 invoked by alias); 22 Sep 2017 20:27:24 -0000", "(qmail 66459 invoked by uid 89); 22 Sep 2017 20:27:24 -0000" ], "DomainKey-Signature": "a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id\n\t:list-unsubscribe:list-subscribe:list-archive:list-post\n\t:list-help:sender:from:to:subject:date:message-id:in-reply-to\n\t:references; q=dns; s=default; b=lWNiq1I9fUchkYN1Mw1TxdtFet2FRr6\n\tQhtpDmsCCj0F1BFoNKDhyKur9RGiTcI4GIYcXn0RIhebc+Y0w/1cGrHTEX5DFPE7\n\tVW8KsiJHZROmrUtXbmvSICIbrANxygQdTgfAV6rUVjw5g19dRlTqgtjECXCr2jyY\n\t4/wQk7kF71TI=", "DKIM-Signature": "v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id\n\t:list-unsubscribe:list-subscribe:list-archive:list-post\n\t:list-help:sender:from:to:subject:date:message-id:in-reply-to\n\t:references; s=default; bh=rvlGDzBX7D4ieG6o1+hbAB0tsko=; b=rWrv2\n\tvqYDehRnHgSMkHZKVW8iivbCwewJALdpXwyAQ+aUZoAXZzJeXy19UauZ3R3PCNTC\n\tYRfeDsjQcb7LQ5YVr4Wp8JkBBmaQLMbIZsxfEBEcCOhq2r+viRM8sBLqEmmsTe+c\n\tBJ8bw4s+4bvKv5dbTbJ3b5y1t1RHBHwYqll8mg=", "Mailing-List": "contact libc-alpha-help@sourceware.org; run by ezmlm", "Precedence": "bulk", "List-Id": "<libc-alpha.sourceware.org>", "List-Unsubscribe": "<mailto:libc-alpha-unsubscribe-incoming=patchwork.ozlabs.org@sourceware.org>", "List-Subscribe": "<mailto:libc-alpha-subscribe@sourceware.org>", "List-Archive": "<http://sourceware.org/ml/libc-alpha/>", "List-Post": "<mailto:libc-alpha@sourceware.org>", "List-Help": "<mailto:libc-alpha-help@sourceware.org>,\n\t<http://sourceware.org/ml/#faqs>", "Sender": "libc-alpha-owner@sourceware.org", "X-Virus-Found": "No", "X-Spam-SWARE-Status": "No, score=-26.4 required=5.0 tests=BAYES_00, GIT_PATCH_0,\n\tGIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_SORBS_SPAM,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=", "X-HELO": "mail-qk0-f172.google.com", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=uWLaFcEXgUeTBDuJf7Yo4Fa7i4ae6L4piyxTJcP7tTY=;\n\tb=f9Xo35Z+U48KFHFPFnIMeM9DUjqKL/yFS7+bXthlVXzGkq4nlafkCkXdSaHKHHTxrO\n\tcIRlZHukEXnQNJsDD09S2ZU4SHGW0LeohKzd7OWK4J1nC7P+ESDI8wlqxw4UjurrDtGd\n\t0kZKzNNCS1SY37rzErf4Z8SIAP1Zxqxy41EjMkt4Ly6bBKM7WZPC76xs01nrRxrJkmsG\n\t/42Og9Rf5laGdKEAtFmQ+T1qwmK0xYhqzCBu7XEY2dIKcv5Mfe4DWVHvXBy6WtGBBTWG\n\tlowuUFhlhvbszI/H7Kmrlze1NZb2zLy4ffSxwNJ2BzDvErZ+koz6t/SvUYtQRA6AKvE8\n\tlErg==", "X-Gm-Message-State": "AHPjjUhKD0eaBAZlYfjQnKg7wFTifUi6E4qPwbZ+DccCcqwBNC71P++j\n\tUixtJC2FP5FR0a0gTFcOutqpHN6ShPU=", "X-Google-Smtp-Source": "AOwi7QCfBvYax5Dlc5CWVOj+dmqNqtDZkcbliCXaAYFqyw3e5hhTIFO1uKKOsKpdYl5zvY5dv4tAJQ==", "X-Received": "by 10.55.156.147 with SMTP id f141mr585181qke.72.1506112039616; \n\tFri, 22 Sep 2017 13:27:19 -0700 (PDT)", "From": "Adhemerval Zanella <adhemerval.zanella@linaro.org>", "To": "libc-alpha@sourceware.org", "Subject": "[PATCH 5/8] nptl: Add C11 threads tss_* functions", "Date": "Fri, 22 Sep 2017 17:27:01 -0300", "Message-Id": "<1506112024-22601-6-git-send-email-adhemerval.zanella@linaro.org>", "In-Reply-To": "<1506112024-22601-1-git-send-email-adhemerval.zanella@linaro.org>", "References": "<1506112024-22601-1-git-send-email-adhemerval.zanella@linaro.org>" }, "content": "This patch adds the tss_* definitions from C11 threads (ISO/IEC 9899:2011),\nmore specifically tss_create, tss_delete, tss_get, tss_set, and required\ntypes.\n\nMostly of the definitions are composed based on POSIX conterparts, including\ntss_t (pthread_key_t).\n\nChecked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu,\narm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu, m68k-linux-gnu,\nmicroblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu,\npowerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu,\ntile{pro,gx}-linux-gnu, and x86_64-linux-gnu).\n\nAlso ran a full check on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu,\narm-linux-gnueabhf, and powerpc64le-linux-gnu.\n\n\t* conform/data/threads.h-data (thread_local): New macro.\n\t(TSS_DTOR_ITERATIONS): Likewise.\n\t(tss_t): New type.\n\t(tss_dtor_t): Likewise.\n\t(tss_create): New function.\n\t(tss_get): Likewise.\n\t(tss_set): Likewise.\n\t(tss_delete): Likewise.\n\t* nptl/Makefile (libpthread-routines): Add tss_create, tss_delete,\n\ttss_get, and tss_set objects.\n\t* nptl/Versions (libpthread) [GLIBC_2.27]: Likewise.\n\t* nptl/tss_create.c: New file.\n\t* nptl/tss_delete.c: Likewise.\n\t* nptl/tss_get.c: Likewise.\n\t* nptl/tss_set.c: Likewise.\n\t* sysdeps/nptl/threads.h (thread_local): New define.\n\t(TSS_DTOR_ITERATIONS): Likewise.\n\t(tss_t): New typedef.\n\t(tss_dtor_t): Likewise.\n\t(tss_create): New prototype.\n\t(tss_get): Likewise.\n\t(tss_set): Likewise.\n\t(tss_delete): Likewise.\n---\n ChangeLog | 24 ++++++++++++++++++++++++\n conform/data/threads.h-data | 9 +++++++++\n nptl/Makefile | 3 ++-\n nptl/Versions | 3 ++-\n nptl/tss_create.c | 31 +++++++++++++++++++++++++++++++\n nptl/tss_delete.c | 27 +++++++++++++++++++++++++++\n nptl/tss_get.c | 27 +++++++++++++++++++++++++++\n nptl/tss_set.c | 28 ++++++++++++++++++++++++++++\n sysdeps/nptl/threads.h | 23 +++++++++++++++++++++++\n 9 files changed, 173 insertions(+), 2 deletions(-)\n create mode 100644 nptl/tss_create.c\n create mode 100644 nptl/tss_delete.c\n create mode 100644 nptl/tss_get.c\n create mode 100644 nptl/tss_set.c", "diff": "diff --git a/conform/data/threads.h-data b/conform/data/threads.h-data\nindex d7c562e..406e497 100644\n--- a/conform/data/threads.h-data\n+++ b/conform/data/threads.h-data\n@@ -1,6 +1,8 @@\n #if defined ISO11\n \n macro ONCE_FLAG_INIT\n+macro thread_local\n+macro-int-constant TSS_DTOR_ITERATIONS\n \n constant thrd_success\n constant thrd_busy\n@@ -17,6 +19,8 @@ type thrd_start_t\n type mtx_t\n type once_flag\n type cnd_t\n+type tss_t\n+type tss_dtor_t\n \n function int thrd_create (thrd_t*, thrd_start_t, void*)\n function int thrd_equal (thrd_t, thrd_t)\n@@ -43,6 +47,11 @@ function int cnd_wait (cnd_t*, mtx_t*)\n function int cnd_timedwait (cnd_t*, mtx_t*, const struct timespec*)\n function void cnd_destroy (cnd_t*)\n \n+function int tss_create (tss_t*, tss_dtor_t)\n+function {void*} tss_get (tss_t)\n+function int tss_set (tss_t, void*)\n+function void tss_delete (tss_t)\n+\n #include \"time.h-data\"\n \n #endif\ndiff --git a/nptl/Makefile b/nptl/Makefile\nindex ddef534..0bf46ce 100644\n--- a/nptl/Makefile\n+++ b/nptl/Makefile\n@@ -143,7 +143,8 @@ libpthread-routines = nptl-init vars events version pt-interp \\\n \t\t thrd_exit thrd_join thrd_sleep thrd_yield \\\n \t\t mtx_destroy mtx_init mtx_lock mtx_timedlock \\\n \t\t mtx_trylock mtx_unlock call_once cnd_broadcast \\\n-\t\t cnd_destroy cnd_init cnd_signal cnd_timedwait cnd_wait\n+\t\t cnd_destroy cnd_init cnd_signal cnd_timedwait cnd_wait \\\n+\t\t tss_create tss_delete tss_get tss_set\n #\t\t pthread_setuid pthread_seteuid pthread_setreuid \\\n #\t\t pthread_setresuid \\\n #\t\t pthread_setgid pthread_setegid pthread_setregid \\\ndiff --git a/nptl/Versions b/nptl/Versions\nindex 53e6b9a..d4dc750 100644\n--- a/nptl/Versions\n+++ b/nptl/Versions\n@@ -270,7 +270,8 @@ libpthread {\n thrd_create; thrd_current; thrd_detach; thrd_equal; thrd_exit; thrd_join;\n thrd_sleep; thrd_yield; mtx_init; mtx_lock; mtx_timedlock; mtx_trylock;\n mtx_unlock; mtx_destroy; call_once; cnd_broadcast; cnd_destroy; cnd_init;\n- cnd_signal; cnd_timedwait; cnd_wait; mtx_destroy;\n+ cnd_signal; cnd_timedwait; cnd_wait; mtx_destroy; tss_create; tss_delete;\n+ tss_get; tss_set;\n }\n \n GLIBC_PRIVATE {\ndiff --git a/nptl/tss_create.c b/nptl/tss_create.c\nnew file mode 100644\nindex 0000000..ef6d7bb\n--- /dev/null\n+++ b/nptl/tss_create.c\n@@ -0,0 +1,31 @@\n+/* C11 threads thread-specific creation implementation.\n+ Copyright (C) 2017 Free Software Foundation, Inc.\n+ This file is part of the GNU C Library.\n+\n+ The GNU C Library is free software; you can redistribute it and/or\n+ modify it under the terms of the GNU Lesser General Public\n+ License as published by the Free Software Foundation; either\n+ version 2.1 of the License, or (at your option) any later version.\n+\n+ The GNU C Library is distributed in the hope that it will be useful,\n+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n+ Lesser General Public License for more details.\n+\n+ You should have received a copy of the GNU Lesser General Public\n+ License along with the GNU C Library; if not, see\n+ <http://www.gnu.org/licenses/>. */\n+\n+#include \"thrd_priv.h\"\n+\n+/* Create new thread-specific storage key and stores it in the object\n+ pointed by tss_id. If destructor is not NULL, destructor function is\n+ called when the thread terminates. */\n+int\n+tss_create (tss_t *tss_id, tss_dtor_t destructor)\n+{\n+ _Static_assert (sizeof (tss_t) == sizeof (pthread_key_t), \"tss_t size\");\n+\n+ int err_code = __pthread_key_create (tss_id, destructor);\n+ return thrd_err_map (err_code);\n+}\ndiff --git a/nptl/tss_delete.c b/nptl/tss_delete.c\nnew file mode 100644\nindex 0000000..bcbc748\n--- /dev/null\n+++ b/nptl/tss_delete.c\n@@ -0,0 +1,27 @@\n+/* C11 threads thread-specific delete implementation.\n+ Copyright (C) 2017 Free Software Foundation, Inc.\n+ This file is part of the GNU C Library.\n+\n+ The GNU C Library is free software; you can redistribute it and/or\n+ modify it under the terms of the GNU Lesser General Public\n+ License as published by the Free Software Foundation; either\n+ version 2.1 of the License, or (at your option) any later version.\n+\n+ The GNU C Library is distributed in the hope that it will be useful,\n+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n+ Lesser General Public License for more details.\n+\n+ You should have received a copy of the GNU Lesser General Public\n+ License along with the GNU C Library; if not, see\n+ <http://www.gnu.org/licenses/>. */\n+\n+#include \"thrd_priv.h\"\n+\n+/* Destroys the thread-specific storage identified by tss_id. The\n+ destructor is not called until thrd_exit is called. */\n+void\n+tss_delete (tss_t tss_id)\n+{\n+ __pthread_key_delete (tss_id);\n+}\ndiff --git a/nptl/tss_get.c b/nptl/tss_get.c\nnew file mode 100644\nindex 0000000..784a1cf\n--- /dev/null\n+++ b/nptl/tss_get.c\n@@ -0,0 +1,27 @@\n+/* C11 threads thread-specific get implementation.\n+ Copyright (C) 2017 Free Software Foundation, Inc.\n+ This file is part of the GNU C Library.\n+\n+ The GNU C Library is free software; you can redistribute it and/or\n+ modify it under the terms of the GNU Lesser General Public\n+ License as published by the Free Software Foundation; either\n+ version 2.1 of the License, or (at your option) any later version.\n+\n+ The GNU C Library is distributed in the hope that it will be useful,\n+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n+ Lesser General Public License for more details.\n+\n+ You should have received a copy of the GNU Lesser General Public\n+ License along with the GNU C Library; if not, see\n+ <http://www.gnu.org/licenses/>. */\n+\n+#include \"thrd_priv.h\"\n+\n+/* Return the value held in thread-specific storage for the current\n+ thread identified by tss_id. */\n+void *\n+tss_get (tss_t tss_id)\n+{\n+ return __pthread_getspecific (tss_id);\n+}\ndiff --git a/nptl/tss_set.c b/nptl/tss_set.c\nnew file mode 100644\nindex 0000000..16a0b04\n--- /dev/null\n+++ b/nptl/tss_set.c\n@@ -0,0 +1,28 @@\n+/* C11 threads thread-specific set implementation.\n+ Copyright (C) 2017 Free Software Foundation, Inc.\n+ This file is part of the GNU C Library.\n+\n+ The GNU C Library is free software; you can redistribute it and/or\n+ modify it under the terms of the GNU Lesser General Public\n+ License as published by the Free Software Foundation; either\n+ version 2.1 of the License, or (at your option) any later version.\n+\n+ The GNU C Library is distributed in the hope that it will be useful,\n+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n+ Lesser General Public License for more details.\n+\n+ You should have received a copy of the GNU Lesser General Public\n+ License along with the GNU C Library; if not, see\n+ <http://www.gnu.org/licenses/>. */\n+\n+#include \"thrd_priv.h\"\n+\n+/* Sets the value of the thread-specific storage identified by tss_id for\n+ the current thread to val. */\n+int\n+tss_set (tss_t tss_id, void *val)\n+{\n+ int err_code = __pthread_setspecific (tss_id, val);\n+ return thrd_err_map (err_code);\n+}\ndiff --git a/sysdeps/nptl/threads.h b/sysdeps/nptl/threads.h\nindex 568e2d4..9ca3695 100644\n--- a/sysdeps/nptl/threads.h\n+++ b/sysdeps/nptl/threads.h\n@@ -28,6 +28,10 @@ __BEGIN_DECLS\n #include <bits/types/struct_timespec.h>\n \n #define ONCE_FLAG_INIT 0\n+#define thread_local _Thread_local\n+#define TSS_DTOR_ITERATIONS 4\n+typedef unsigned int tss_t;\n+typedef void (*tss_dtor_t) (void*);\n \n typedef unsigned long int thrd_t;\n typedef int (*thrd_start_t) (void*);\n@@ -170,6 +174,25 @@ extern int cnd_timedwait (cnd_t *__restrict __cond,\n resources. */\n extern void cnd_destroy (cnd_t *__cond);\n \n+/* Thread specific storage functions. */\n+\n+/* Create new thread-specific storage key and stores it in the object pointed\n+ by __tss_id. If __destructor is not NULL, __destructor function is called\n+ when the thread terminates. */\n+extern int tss_create (tss_t *__tss_id, tss_dtor_t __destructor);\n+\n+/* Return the value held in thread-specific storage for the current thread\n+ identified by __tss_id. */\n+extern void *tss_get (tss_t __tss_id);\n+\n+/* Sets the value of the thread-specific storage identified by __tss_id for\n+ the current thread to __val. */\n+extern int tss_set (tss_t __tss_id, void *__val);\n+\n+/* Destroys the thread-specific storage identified by __tss_id. The\n+ destructor is not called until thrd_exit is called. */\n+extern void tss_delete (tss_t __tss_id);\n+\n __END_DECLS\n \n #endif /* _THREADS_H */\n", "prefixes": [ "5/8" ] }