public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/azanella/bz30944-memcpy-zen] elf: Add a way to check if tunable is set (BZ 27069)
@ 2023-10-27 12:29 Adhemerval Zanella
0 siblings, 0 replies; only message in thread
From: Adhemerval Zanella @ 2023-10-27 12:29 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=51da90c20d54c5098d9e1b01950a43bd2197813d
commit 51da90c20d54c5098d9e1b01950a43bd2197813d
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Fri Oct 27 00:07:10 2023 -0300
elf: Add a way to check if tunable is set (BZ 27069)
The tunable already keep a field whether it is initialized. Add
the TUNABLE_IS_INITIALIZED to query it.
Checked on x86_64-linux-gnu.
Diff:
---
elf/dl-tunables.c | 7 +++++++
elf/dl-tunables.h | 12 ++++++++++++
2 files changed, 19 insertions(+)
diff --git a/elf/dl-tunables.c b/elf/dl-tunables.c
index cae67efa0a..fb40d3138a 100644
--- a/elf/dl-tunables.c
+++ b/elf/dl-tunables.c
@@ -145,6 +145,13 @@ tunable_initialize (tunable_t *cur, const char *strval)
do_tunable_update_val (cur, &val, NULL, NULL);
}
+bool
+__tunable_is_initialized (tunable_id_t id)
+{
+ return tunable_list[id].initialized;
+}
+rtld_hidden_def (__tunable_is_initialized)
+
void
__tunable_set_val (tunable_id_t id, tunable_val_t *valp, tunable_num_t *minp,
tunable_num_t *maxp)
diff --git a/elf/dl-tunables.h b/elf/dl-tunables.h
index 45c191e021..4187ffc525 100644
--- a/elf/dl-tunables.h
+++ b/elf/dl-tunables.h
@@ -45,11 +45,13 @@ typedef void (*tunable_callback_t) (tunable_val_t *);
extern void __tunables_init (char **);
extern void __tunables_print (void);
+extern bool __tunable_is_initialized (tunable_id_t);
extern void __tunable_get_val (tunable_id_t, void *, tunable_callback_t);
extern void __tunable_set_val (tunable_id_t, tunable_val_t *, tunable_num_t *,
tunable_num_t *);
rtld_hidden_proto (__tunables_init)
rtld_hidden_proto (__tunables_print)
+rtld_hidden_proto (__tunable_is_initialized)
rtld_hidden_proto (__tunable_get_val)
rtld_hidden_proto (__tunable_set_val)
@@ -57,6 +59,8 @@ rtld_hidden_proto (__tunable_set_val)
TUNABLE_NAMESPACE are defined. This is useful shorthand to get and set
tunables within a module. */
#if defined TOP_NAMESPACE && defined TUNABLE_NAMESPACE
+# define TUNABLE_IS_INITIALIZED(__id) \
+ TUNABLE_IS_INITIALIZED_FULL(TOP_NAMESPACE, TUNABLE_NAMESPACE, __id)
# define TUNABLE_GET(__id, __type, __cb) \
TUNABLE_GET_FULL (TOP_NAMESPACE, TUNABLE_NAMESPACE, __id, __type, __cb)
# define TUNABLE_SET(__id, __val) \
@@ -65,6 +69,8 @@ rtld_hidden_proto (__tunable_set_val)
TUNABLE_SET_WITH_BOUNDS_FULL (TOP_NAMESPACE, TUNABLE_NAMESPACE, __id, \
__val, __min, __max)
#else
+# define TUNABLE_IS_INITIALIZED(__top, __ns, __id) \
+ TUNABLE_IS_INITIALIZED_FULL(__top, __ns, __id)
# define TUNABLE_GET(__top, __ns, __id, __type, __cb) \
TUNABLE_GET_FULL (__top, __ns, __id, __type, __cb)
# define TUNABLE_SET(__top, __ns, __id, __val) \
@@ -73,6 +79,12 @@ rtld_hidden_proto (__tunable_set_val)
TUNABLE_SET_WITH_BOUNDS_FULL (__top, __ns, __id, __val, __min, __max)
#endif
+#define TUNABLE_IS_INITIALIZED_FULL(__top, __ns, __id) \
+({ \
+ tunable_id_t id = TUNABLE_ENUM_NAME (__top, __ns, __id); \
+ __tunable_is_initialized (id); \
+})
+
/* Get and return a tunable value. If the tunable was set externally and __CB
is defined then call __CB before returning the value. */
#define TUNABLE_GET_FULL(__top, __ns, __id, __type, __cb) \
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-10-27 12:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-27 12:29 [glibc/azanella/bz30944-memcpy-zen] elf: Add a way to check if tunable is set (BZ 27069) Adhemerval Zanella
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).