Update translations from the Translation Project
[glibc.git] / elf / dl-tunables.h
blobe07825c44362b77ff216d5d1e6b2425ebf63bc68
1 /* The tunable framework. See the README to know how to use the tunable in
2 a glibc module.
4 Copyright (C) 2016-2017 Free Software Foundation, Inc.
5 This file is part of the GNU C Library.
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with the GNU C Library; if not, see
19 <http://www.gnu.org/licenses/>. */
21 #ifndef _TUNABLES_H_
22 #define _TUNABLES_H_
24 #if !HAVE_TUNABLES
25 static inline void
26 __always_inline
27 __tunables_init (char **unused __attribute__ ((unused)))
29 /* This is optimized out if tunables are not enabled. */
31 #else
33 # include <stddef.h>
34 # include "dl-tunable-types.h"
36 /* A tunable. */
37 struct _tunable
39 const char *name; /* Internal name of the tunable. */
40 tunable_type_t type; /* Data type of the tunable. */
41 tunable_val_t val; /* The value. */
42 const char *strval; /* The string containing the value,
43 points into envp. */
44 bool is_secure; /* Whether the tunable must be read
45 even for setuid binaries. Note that
46 even if the tunable is read, it may
47 not get used by the target module if
48 the value is considered unsafe. */
49 /* Compatibility elements. */
50 const char *env_alias; /* The compatibility environment
51 variable name. */
54 typedef struct _tunable tunable_t;
56 /* Full name for a tunable is top_ns.tunable_ns.id. */
57 # define TUNABLE_NAME_S(top,ns,id) #top "." #ns "." #id
59 # define TUNABLE_ENUM_NAME(top,ns,id) TUNABLE_ENUM_NAME1 (top,ns,id)
60 # define TUNABLE_ENUM_NAME1(top,ns,id) top ## _ ## ns ## _ ## id
62 # include "dl-tunable-list.h"
64 extern void __tunables_init (char **);
65 extern void __tunable_set_val (tunable_id_t, void *, tunable_callback_t);
67 /* Check if the tunable has been set to a non-default value and if it is, copy
68 it over into __VAL. */
69 # define TUNABLE_SET_VAL(__id,__val) \
70 ({ \
71 __tunable_set_val \
72 (TUNABLE_ENUM_NAME (TOP_NAMESPACE, TUNABLE_NAMESPACE, __id), (__val), \
73 NULL); \
76 /* Same as TUNABLE_SET_VAL, but also call the callback function __CB. */
77 # define TUNABLE_SET_VAL_WITH_CALLBACK(__id,__val,__cb) \
78 ({ \
79 __tunable_set_val \
80 (TUNABLE_ENUM_NAME (TOP_NAMESPACE, TUNABLE_NAMESPACE, __id), (__val), \
81 DL_TUNABLE_CALLBACK (__cb)); \
84 /* Namespace sanity for callback functions. Use this macro to keep the
85 namespace of the modules clean. */
86 # define DL_TUNABLE_CALLBACK(__name) _dl_tunable_ ## __name
88 # define TUNABLES_FRONTEND_valstring 1
89 /* The default value for TUNABLES_FRONTEND. */
90 # define TUNABLES_FRONTEND_yes TUNABLES_FRONTEND_valstring
91 #endif
92 #endif