aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2019-05-02 11:42:51 +0200
committerFlorian Weimer <fweimer@redhat.com>2019-05-02 11:42:51 +0200
commit7b807a35a8dc63f9742cecf0fc3db46c30e28b0d (patch)
tree0dce83854245814394b46373b4c8316ab7610b0c
parent20aa5819586ac7ad11f711bab64feda307965191 (diff)
downloadglibc-7b807a35a8dc63f9742cecf0fc3db46c30e28b0d.tar.gz
glibc-7b807a35a8dc63f9742cecf0fc3db46c30e28b0d.tar.xz
glibc-7b807a35a8dc63f9742cecf0fc3db46c30e28b0d.zip
misc: Add twalk_r function
The twalk function is very difficult to use in a multi-threaded program because there is no way to pass external state to the iterator function. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-rw-r--r--ChangeLog69
-rw-r--r--NEWS4
-rw-r--r--include/search.h2
-rw-r--r--manual/examples/twalk.c56
-rw-r--r--manual/search.texi25
-rw-r--r--misc/Versions5
-rw-r--r--misc/search.h7
-rw-r--r--misc/tsearch.c34
-rw-r--r--misc/tst-tsearch.c89
-rw-r--r--sysdeps/mach/hurd/i386/libc.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/aarch64/libc.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/alpha/libc.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/arm/libc.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/csky/libc.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/hppa/libc.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/i386/libc.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/ia64/libc.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/microblaze/libc.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/nios2/libc.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/sh/libc.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/64/libc.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist1
37 files changed, 315 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index d30639abf65..4473569abcd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,72 @@
+2019-05-02 Florian Weimer <fweimer@redhat.com>
+
+ misc: Add twalk_r function.
+ * include/search.h (__twalk_r): Declare.
+ * manual/examples/twalk.c: New file.
+ * manual/search.texi (Tree Search Function): Document twalk_r.
+ * misc/Versions (2.30): Export twalk_r.
+ (GLIBC_PRIVATE): Export __twalk_r.
+ * misc/search.h [__USE_GNU] (twalk_r): Declare.
+ * misc/tsearch.c (trecurse_r, __twalk_r): New functions.
+ (twalk_r): Add weak alias.
+ * misc/tst-tsearch.c (struct walk_trace_element): Define.
+ (walk_trace): New variable.
+ (struct twalk_with_twalk_r_closure): Define.
+ (twalk_with_twalk_r_action): New function.
+ (twalk_with_twalk_r): Likewise.
+ (walk_action): Call walk_trace_add.
+ (walk_tree_with): Rename from walk_tree. Add walk argument.
+ (walk_tree): New function.
+ * sysdeps/mach/hurd/i386/libc.abilist (GLIBC_2.30): Add twalk_r.
+ * sysdeps/unix/sysv/linux/aarch64/libc.abilist (GLIBC_2.30):
+ Likewise.
+ * sysdeps/unix/sysv/linux/alpha/libc.abilist (GLIBC_2.30):
+ Likewise.
+ * sysdeps/unix/sysv/linux/arm/libc.abilist (GLIBC_2.30): Likewise.
+ * sysdeps/unix/sysv/linux/csky/libc.abilist (GLIBC_2.30): Likewise.
+ * sysdeps/unix/sysv/linux/hppa/libc.abilist (GLIBC_2.30): Likewise.
+ * sysdeps/unix/sysv/linux/i386/libc.abilist (GLIBC_2.30): Likewise.
+ * sysdeps/unix/sysv/linux/ia64/libc.abilist (GLIBC_2.30): Likewise.
+ * sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist (GLIBC_2.30):
+ Likewise.
+ * sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist (GLIBC_2.30):
+ Likewise.
+ * sysdeps/unix/sysv/linux/microblaze/libc.abilist (GLIBC_2.30):
+ Likewise.
+ * sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
+ (GLIBC_2.30): Likewise.
+ * sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
+ (GLIBC_2.30): Likewise.
+ * sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
+ (GLIBC_2.30): Likewise.
+ * sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
+ (GLIBC_2.30): Likewise.
+ * sysdeps/unix/sysv/linux/nios2/libc.abilist (GLIBC_2.30):
+ Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+ (GLIBC_2.30): Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+ (GLIBC_2.30): Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
+ (GLIBC_2.30): Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
+ (GLIBC_2.30): Likewise.
+ * sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist (GLIBC_2.30):
+ Likewise.
+ * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist (GLIBC_2.30):
+ Likewise.
+ * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist (GLIBC_2.30):
+ Likewise.
+ * sysdeps/unix/sysv/linux/sh/libc.abilist (GLIBC_2.30): Likewise.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist (GLIBC_2.30):
+ Likewise.
+ * sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist (GLIBC_2.30):
+ Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/64/libc.abilist (GLIBC_2.30):
+ Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist (GLIBC_2.30):
+ Likewise.
+
2019-04-30 Paul Eggert <eggert@cs.ucla.edu>
Make mktime etc. compatible with __time64_t
diff --git a/NEWS b/NEWS
index 792ffb1ec8e..41cffa425c7 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,10 @@ Major new features:
* The dynamic linker accepts the --preload argument to preload shared
objects, in addition to the LD_PRELOAD environment variable.
+* The twalk_r function has been added. It is similar to the existing
+ twalk function, but it passes an additional caller-supplied argument
+ to the callback function.
+
* On Linux, the gettid function has been added.
* Minguo (Republic of China) calendar support has been added as an
diff --git a/include/search.h b/include/search.h
index e17693022d9..72fbc944769 100644
--- a/include/search.h
+++ b/include/search.h
@@ -23,6 +23,8 @@ extern void *__tdelete (const void *__key, void **__rootp,
libc_hidden_proto (__tdelete)
extern void __twalk (const void *__root, __action_fn_t action);
libc_hidden_proto (__twalk)
+extern __typeof__ (twalk_r) __twalk_r;
+libc_hidden_proto (__twalk_r)
extern void __tdestroy (void *__root, __free_fn_t freefct);
libc_hidden_proto (__tdestroy)
#endif
diff --git a/manual/examples/twalk.c b/manual/examples/twalk.c
new file mode 100644
index 00000000000..04e32731d64
--- /dev/null
+++ b/manual/examples/twalk.c
@@ -0,0 +1,56 @@
+/* Implement twalk using twalk_r.
+ 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 General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <search.h>
+
+struct twalk_with_twalk_r_closure
+{
+ void (*action) (const void *, VISIT, int);
+ int depth;
+};
+
+static void
+twalk_with_twalk_r_action (const void *nodep, VISIT which, void *closure0)
+{
+ struct twalk_with_twalk_r_closure *closure = closure0;
+
+ switch (which)
+ {
+ case leaf:
+ closure->action (nodep, which, closure->depth);
+ break;
+ case preorder:
+ closure->action (nodep, which, closure->depth);
+ ++closure->depth;
+ break;
+ case postorder:
+ /* The preorder action incremented the depth. */
+ closure->action (nodep, which, closure->depth - 1);
+ break;
+ case endorder:
+ --closure->depth;
+ closure->action (nodep, which, closure->depth);
+ break;
+ }
+}
+
+void
+twalk (const void *root, void (*action) (const void *, VISIT, int))
+{
+ struct twalk_with_twalk_r_closure closure = { action, 0 };
+ twalk_r (root, twalk_with_twalk_r_action, &closure);
+}
diff --git a/manual/search.texi b/manual/search.texi
index 1574c965628..979732f0272 100644
--- a/manual/search.texi
+++ b/manual/search.texi
@@ -618,5 +618,28 @@ Since the functions used for the @var{action} parameter to @code{twalk}
must not modify the tree data, it is safe to run @code{twalk} in more
than one thread at the same time, working on the same tree. It is also
safe to call @code{tfind} in parallel. Functions which modify the tree
-must not be used, otherwise the behavior is undefined.
+must not be used, otherwise the behavior is undefined. However, it is
+difficult to pass data external to the tree to the callback function
+without resorting to global variables (and thread safety issues), so
+see the @code{twalk_r} function below.
+@end deftypefun
+
+@deftypefun void twalk_r (const void *@var{root}, void (*@var{action}) (const void *@var{key}, VISIT @var{which}, void *@var{closure}), void *@var{closure})
+@standards{GNU, search.h}
+@safety{@prelim{}@mtsafe{@mtsrace{:root}}@assafe{}@acsafe{}}
+For each node in the tree with a node pointed to by @var{root}, the
+@code{twalk_r} function calls the function provided by the parameter
+@var{action}. For leaf nodes the function is called exactly once with
+@var{value} set to @code{leaf}. For internal nodes the function is
+called three times, setting the @var{value} parameter or @var{action} to
+the appropriate value. The @var{closure} parameter is passed down to
+each call of the @var{action} function, unmodified.
+
+It is possible to implement the @code{twalk} function on top of the
+@code{twalk_r} function, which is why there is no separate level
+parameter.
+
+@smallexample
+@include twalk.c.texi
+@end smallexample
@end deftypefun
diff --git a/misc/Versions b/misc/Versions
index 900e4ffb798..e7495823693 100644
--- a/misc/Versions
+++ b/misc/Versions
@@ -158,11 +158,14 @@ libc {
GLIBC_2.26 {
preadv2; preadv64v2; pwritev2; pwritev64v2;
}
+ GLIBC_2.30 {
+ twalk_r;
+ }
GLIBC_PRIVATE {
__madvise;
__mktemp;
__libc_ifunc_impl_list;
- __tdelete; __tfind; __tsearch; __twalk;
+ __tdelete; __tfind; __tsearch; __twalk; __twalk_r;
__mmap; __munmap; __mprotect;
__sched_get_priority_min; __sched_get_priority_max;
__libc_allocate_once_slow;
diff --git a/misc/search.h b/misc/search.h
index 47e8a43436c..4659c59877c 100644
--- a/misc/search.h
+++ b/misc/search.h
@@ -150,6 +150,13 @@ typedef void (*__action_fn_t) (const void *__nodep, VISIT __value,
extern void twalk (const void *__root, __action_fn_t __action);
#ifdef __USE_GNU
+/* Like twalk, but pass down a closure parameter instead of the
+ level. */
+extern void twalk_r (const void *__root,
+ void (*) (const void *__nodep, VISIT __value,
+ void *__closure),
+ void *__closure);
+
/* Callback type for function to free a tree node. If the keys are atomic
data this function should do nothing. */
typedef void (*__free_fn_t) (void *__nodep);
diff --git a/misc/tsearch.c b/misc/tsearch.c
index 5c19082a591..edf0fec9712 100644
--- a/misc/tsearch.c
+++ b/misc/tsearch.c
@@ -719,7 +719,41 @@ __twalk (const void *vroot, __action_fn_t action)
libc_hidden_def (__twalk)
weak_alias (__twalk, twalk)
+/* twalk_r is the same as twalk, but with a closure parameter instead
+ of the level. */
+static void
+trecurse_r (const void *vroot, void (*action) (const void *, VISIT, void *),
+ void *closure)
+{
+ const_node root = (const_node) vroot;
+ if (LEFT(root) == NULL && RIGHT(root) == NULL)
+ (*action) (root, leaf, closure);
+ else
+ {
+ (*action) (root, preorder, closure);
+ if (LEFT(root) != NULL)
+ trecurse_r (LEFT(root), action, closure);
+ (*action) (root, postorder, closure);
+ if (RIGHT(root) != NULL)
+ trecurse_r (RIGHT(root), action, closure);
+ (*action) (root, endorder, closure);
+ }
+}
+
+void
+__twalk_r (const void *vroot, void (*action) (const void *, VISIT, void *),
+ void *closure)
+{
+ const_node root = (const_node) vroot;
+
+ CHECK_TREE ((node) root);
+
+ if (root != NULL && action != NULL)
+ trecurse_r (root, action, closure);
+}
+libc_hidden_def (__twalk_r)
+weak_alias (__twalk_r, twalk_r)
/* The standardized functions miss an important functionality: the
tree cannot be removed easily. We provide a function to do this. */
diff --git a/misc/tst-tsearch.c b/misc/tst-tsearch.c
index 5803a456e0f..9a570dd6c90 100644
--- a/misc/tst-tsearch.c
+++ b/misc/tst-tsearch.c
@@ -25,6 +25,7 @@
#include <string.h>
#include <search.h>
#include <tst-stack-align.h>
+#include <support/check.h>
#define SEED 0
#define BALANCED 1
@@ -74,6 +75,20 @@ static int max_depth;
static int stack_align_check[2];
+/* Used to compare walk traces between the two implementations. */
+struct walk_trace_element
+{
+ const void *key;
+ VISIT which;
+ int depth;
+};
+#define DYNARRAY_STRUCT walk_trace_list
+#define DYNARRAY_ELEMENT struct walk_trace_element
+#define DYNARRAY_PREFIX walk_trace_
+#define DYNARRAY_INITIAL_SIZE 0
+#include <malloc/dynarray-skeleton.c>
+static struct walk_trace_list walk_trace;
+
/* Compare two keys. */
static int
cmp_fn (const void *a, const void *b)
@@ -102,11 +117,54 @@ memfry (int *string)
}
}
+struct twalk_with_twalk_r_closure
+{
+ void (*action) (const void *, VISIT, int);
+ int depth;
+};
+
+static void
+twalk_with_twalk_r_action (const void *nodep, VISIT which, void *closure0)
+{
+ struct twalk_with_twalk_r_closure *closure = closure0;
+
+ switch (which)
+ {
+ case leaf:
+ closure->action (nodep, which, closure->depth);
+ break;
+ case preorder:
+ closure->action (nodep, which, closure->depth);
+ ++closure->depth;
+ break;
+ case postorder:
+ /* The preorder action incremented the depth. */
+ closure->action (nodep, which, closure->depth - 1);
+ break;
+ case endorder:
+ --closure->depth;
+ closure->action (nodep, which, closure->depth);
+ break;
+ }
+}
+
+static void
+twalk_with_twalk_r (const void *root,
+ void (*action) (const void *, VISIT, int))
+{
+ struct twalk_with_twalk_r_closure closure = { action, 0 };
+ twalk_r (root, twalk_with_twalk_r_action, &closure);
+ TEST_COMPARE (closure.depth, 0);
+}
+
static void
walk_action (const void *nodep, const VISIT which, const int depth)
{
int key = **(int **) nodep;
+ walk_trace_add (&walk_trace,
+ (struct walk_trace_element) { nodep, which, depth });
+
if (!stack_align_check[1])
stack_align_check[1] = TEST_STACK_ALIGN () ? -1 : 1;
@@ -128,14 +186,16 @@ walk_action (const void *nodep, const VISIT which, const int depth)
}
static void
-walk_tree (void *root, int expected_count)
+walk_tree_with (void *root, int expected_count,
+ void (*walk) (const void *,
+ void (*) (const void *, VISIT, int)))
{
int i;
memset (z, 0, sizeof z);
max_depth = 0;
- twalk (root, walk_action);
+ walk (root, walk_action);
for (i = 0; i < expected_count; ++i)
if (z[i] != 1)
{
@@ -154,6 +214,31 @@ walk_tree (void *root, int expected_count)
}
}
+static void
+walk_tree (void *root, int expected_count)
+{
+ walk_trace_clear (&walk_trace);
+ walk_tree_with (root, expected_count, twalk);
+ TEST_VERIFY (!walk_trace_has_failed (&walk_trace));
+ size_t first_list_size;
+ struct walk_trace_element *first_list
+ = walk_trace_finalize (&walk_trace, &first_list_size);
+
+ walk_tree_with (root, expected_count, twalk_with_twalk_r);
+
+ /* Compare the two traces. */
+ TEST_COMPARE (first_list_size, walk_trace_size (&walk_trace));
+ for (size_t i = 0; i < first_list_size && i < walk_trace_size (&walk_trace);
+ ++i)
+ {
+ TEST_VERIFY (first_list[i].key == walk_trace_at (&walk_trace, i)->key);
+ TEST_COMPARE (first_list[i].which, walk_trace_at (&walk_trace, i)->which);
+ TEST_COMPARE (first_list[i].depth, walk_trace_at (&walk_trace, i)->depth);
+ }
+
+ walk_trace_free (&walk_trace);
+}
+
/* Perform an operation on a tree. */
static void
mangle_tree (enum order how, enum action what, void **root, int lag)
diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
index dd3cf6f9f26..1fc7ab2433f 100644
--- a/sysdeps/mach/hurd/i386/libc.abilist
+++ b/sysdeps/mach/hurd/i386/libc.abilist
@@ -2175,6 +2175,7 @@ GLIBC_2.3.4 setipv4sourcefilter F
GLIBC_2.3.4 setsourcefilter F
GLIBC_2.3.4 xdr_quad_t F
GLIBC_2.3.4 xdr_u_quad_t F
+GLIBC_2.30 twalk_r F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
index f3b44d723f8..b7283ad486a 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
@@ -2142,3 +2142,4 @@ GLIBC_2.29 getcpu F
GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
GLIBC_2.30 gettid F
+GLIBC_2.30 twalk_r F
diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
index fd81fc4ad0e..a817e683a49 100644
--- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
@@ -2217,6 +2217,7 @@ GLIBC_2.30 __nldbl_vwarnx F
GLIBC_2.30 __nldbl_warn F
GLIBC_2.30 __nldbl_warnx F
GLIBC_2.30 gettid F
+GLIBC_2.30 twalk_r F
GLIBC_2.4 _IO_fprintf F
GLIBC_2.4 _IO_printf F
GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/arm/libc.abilist b/sysdeps/unix/sysv/linux/arm/libc.abilist
index f451fefac93..97b6cbf903e 100644
--- a/sysdeps/unix/sysv/linux/arm/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/libc.abilist
@@ -127,6 +127,7 @@ GLIBC_2.29 getcpu F
GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
GLIBC_2.30 gettid F
+GLIBC_2.30 twalk_r F
GLIBC_2.4 _Exit F
GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
index 018d02b4144..796e622a6d5 100644
--- a/sysdeps/unix/sysv/linux/csky/libc.abilist
+++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
@@ -2086,3 +2086,4 @@ GLIBC_2.29 xencrypt F
GLIBC_2.29 xprt_register F
GLIBC_2.29 xprt_unregister F
GLIBC_2.30 gettid F
+GLIBC_2.30 twalk_r F
diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
index fc3c5d5c270..4e7d71d1125 100644
--- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
@@ -2038,6 +2038,7 @@ GLIBC_2.3.4 setsourcefilter F
GLIBC_2.3.4 xdr_quad_t F
GLIBC_2.3.4 xdr_u_quad_t F
GLIBC_2.30 gettid F
+GLIBC_2.30 twalk_r F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
index f2b04dbbffd..11bd8c601a1 100644
--- a/sysdeps/unix/sysv/linux/i386/libc.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
@@ -2204,6 +2204,7 @@ GLIBC_2.3.4 vm86 F
GLIBC_2.3.4 xdr_quad_t F
GLIBC_2.3.4 xdr_u_quad_t F
GLIBC_2.30 gettid F
+GLIBC_2.30 twalk_r F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
index 10ecf2e47ca..589cce5b8db 100644
--- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
@@ -2070,6 +2070,7 @@ GLIBC_2.3.4 setsourcefilter F
GLIBC_2.3.4 xdr_quad_t F
GLIBC_2.3.4 xdr_u_quad_t F
GLIBC_2.30 gettid F
+GLIBC_2.30 twalk_r F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
index 814e81b9d26..4b3727a91d3 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
@@ -128,6 +128,7 @@ GLIBC_2.29 getcpu F
GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
GLIBC_2.30 gettid F
+GLIBC_2.30 twalk_r F
GLIBC_2.4 _Exit F
GLIBC_2.4 _IO_2_1_stderr_ D 0x98
GLIBC_2.4 _IO_2_1_stdin_ D 0x98
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
index 68e80372e71..4be30c03390 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
@@ -2147,6 +2147,7 @@ GLIBC_2.3.4 setsourcefilter F
GLIBC_2.3.4 xdr_quad_t F
GLIBC_2.3.4 xdr_u_quad_t F
GLIBC_2.30 gettid F
+GLIBC_2.30 twalk_r F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/microblaze/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/libc.abilist
index 31178e4f54e..e0010965a83 100644
--- a/sysdeps/unix/sysv/linux/microblaze/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/libc.abilist
@@ -2134,3 +2134,4 @@ GLIBC_2.29 getcpu F
GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
GLIBC_2.30 gettid F
+GLIBC_2.30 twalk_r F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
index 70745736380..2a62f677419 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
@@ -2121,6 +2121,7 @@ GLIBC_2.3.4 setsourcefilter F
GLIBC_2.3.4 xdr_quad_t F
GLIBC_2.3.4 xdr_u_quad_t F
GLIBC_2.30 gettid F
+GLIBC_2.30 twalk_r F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
index 154f9c77fc5..5a23f11fc9b 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
@@ -2119,6 +2119,7 @@ GLIBC_2.3.4 setsourcefilter F
GLIBC_2.3.4 xdr_quad_t F
GLIBC_2.3.4 xdr_u_quad_t F
GLIBC_2.30 gettid F
+GLIBC_2.30 twalk_r F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
index 97b8f42d5c4..32532a19da0 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
@@ -2127,6 +2127,7 @@ GLIBC_2.3.4 setsourcefilter F
GLIBC_2.3.4 xdr_quad_t F
GLIBC_2.3.4 xdr_u_quad_t F
GLIBC_2.30 gettid F
+GLIBC_2.30 twalk_r F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
index 5b3e85de93e..882f5cb5bf6 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
@@ -2121,6 +2121,7 @@ GLIBC_2.3.4 setsourcefilter F
GLIBC_2.3.4 xdr_quad_t F
GLIBC_2.3.4 xdr_u_quad_t F
GLIBC_2.30 gettid F
+GLIBC_2.30 twalk_r F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
index 04a130a81ca..c99a299bab3 100644
--- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
@@ -2175,3 +2175,4 @@ GLIBC_2.29 getcpu F
GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
GLIBC_2.30 gettid F
+GLIBC_2.30 twalk_r F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
index a701584422b..d5f43641974 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -2177,6 +2177,7 @@ GLIBC_2.30 __nldbl_vwarnx F
GLIBC_2.30 __nldbl_warn F
GLIBC_2.30 __nldbl_warnx F
GLIBC_2.30 gettid F
+GLIBC_2.30 twalk_r F
GLIBC_2.4 _IO_fprintf F
GLIBC_2.4 _IO_printf F
GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
index bbb647cd98a..581fd102903 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
@@ -2210,6 +2210,7 @@ GLIBC_2.30 __nldbl_vwarnx F
GLIBC_2.30 __nldbl_warn F
GLIBC_2.30 __nldbl_warnx F
GLIBC_2.30 gettid F
+GLIBC_2.30 twalk_r F
GLIBC_2.4 _IO_fprintf F
GLIBC_2.4 _IO_printf F
GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
index bb23bf61a83..ce10e0436e3 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
@@ -2040,6 +2040,7 @@ GLIBC_2.30 __nldbl_vwarnx F
GLIBC_2.30 __nldbl_warn F
GLIBC_2.30 __nldbl_warnx F
GLIBC_2.30 gettid F
+GLIBC_2.30 twalk_r F
GLIBC_2.4 _IO_fprintf F
GLIBC_2.4 _IO_printf F
GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
index 7921dda9794..1cc729da7f3 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
@@ -2244,3 +2244,4 @@ GLIBC_2.30 __nldbl_vwarnx F
GLIBC_2.30 __nldbl_warn F
GLIBC_2.30 __nldbl_warnx F
GLIBC_2.30 gettid F
+GLIBC_2.30 twalk_r F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
index da123d3867a..2bda5692f47 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
@@ -2104,3 +2104,4 @@ GLIBC_2.29 getcpu F
GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
GLIBC_2.30 gettid F
+GLIBC_2.30 twalk_r F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
index 2aed339af4e..dddc138a1e5 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -2172,6 +2172,7 @@ GLIBC_2.30 __nldbl_vwarnx F
GLIBC_2.30 __nldbl_warn F
GLIBC_2.30 __nldbl_warnx F
GLIBC_2.30 gettid F
+GLIBC_2.30 twalk_r F
GLIBC_2.4 _IO_fprintf F
GLIBC_2.4 _IO_printf F
GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
index e46feb56e5c..b2c75a48a81 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -2076,6 +2076,7 @@ GLIBC_2.30 __nldbl_vwarnx F
GLIBC_2.30 __nldbl_warn F
GLIBC_2.30 __nldbl_warnx F
GLIBC_2.30 gettid F
+GLIBC_2.30 twalk_r F
GLIBC_2.4 _IO_fprintf F
GLIBC_2.4 _IO_printf F
GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/sh/libc.abilist b/sysdeps/unix/sysv/linux/sh/libc.abilist
index 24a8f934cb7..8b83449b169 100644
--- a/sysdeps/unix/sysv/linux/sh/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/libc.abilist
@@ -2042,6 +2042,7 @@ GLIBC_2.3.4 setsourcefilter F
GLIBC_2.3.4 xdr_quad_t F
GLIBC_2.3.4 xdr_u_quad_t F
GLIBC_2.30 gettid F
+GLIBC_2.30 twalk_r F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index ebdbd2c5aee..a237be9d939 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -2166,6 +2166,7 @@ GLIBC_2.30 __nldbl_vwarnx F
GLIBC_2.30 __nldbl_warn F
GLIBC_2.30 __nldbl_warnx F
GLIBC_2.30 gettid F
+GLIBC_2.30 twalk_r F
GLIBC_2.4 _IO_fprintf F
GLIBC_2.4 _IO_printf F
GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
index 0992349b061..b8506944348 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
@@ -2093,6 +2093,7 @@ GLIBC_2.3.4 setsourcefilter F
GLIBC_2.3.4 xdr_quad_t F
GLIBC_2.3.4 xdr_u_quad_t F
GLIBC_2.30 gettid F
+GLIBC_2.30 twalk_r F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
index af004fcff61..c6f22f0c7b5 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
@@ -2051,6 +2051,7 @@ GLIBC_2.3.4 setsourcefilter F
GLIBC_2.3.4 xdr_quad_t F
GLIBC_2.3.4 xdr_u_quad_t F
GLIBC_2.30 gettid F
+GLIBC_2.30 twalk_r F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
index 84015f0a57a..1184385bcec 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
@@ -2150,3 +2150,4 @@ GLIBC_2.29 getcpu F
GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
GLIBC_2.30 gettid F
+GLIBC_2.30 twalk_r F