about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@sourceware.org>2017-05-17 13:11:00 +0530
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2017-05-17 13:11:00 +0530
commitd13103074ab5c7614eeb94f88a61803ed8f3e878 (patch)
tree20c7b4c429edc658f7095cee63e9e6e8c4e18e19 /scripts
parentc79a72aa5cb8357c216a71015c7448a9259c8531 (diff)
downloadglibc-d13103074ab5c7614eeb94f88a61803ed8f3e878.tar.gz
glibc-d13103074ab5c7614eeb94f88a61803ed8f3e878.tar.xz
glibc-d13103074ab5c7614eeb94f88a61803ed8f3e878.zip
tunables: Specify a default value for tunables
Enhance dl-tunables.list to allow specifying a default value for a
tunable that it would be initialized to.

	* scripts/gen-tunables.awk: Recognize 'default' keyword in
	dl-tunables.list.
	* README.tunables: Document it.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/gen-tunables.awk12
1 files changed, 10 insertions, 2 deletions
diff --git a/scripts/gen-tunables.awk b/scripts/gen-tunables.awk
index defb3e7354..b10b00ebd6 100644
--- a/scripts/gen-tunables.awk
+++ b/scripts/gen-tunables.awk
@@ -113,6 +113,14 @@ $1 == "}" {
       exit 1
     }
   }
+  else if (attr == "default") {
+    if (types[top_ns][ns][tunable] == "STRING") {
+      default_val[top_ns][ns][tunable] = sprintf(".strval = \"%s\"", val);
+    }
+    else {
+      default_val[top_ns][ns][tunable] = sprintf(".numval = %s", val)
+    }
+  }
 }
 
 END {
@@ -146,9 +154,9 @@ END {
     for (n in types[t]) {
       for (m in types[t][n]) {
         printf ("  {TUNABLE_NAME_S(%s, %s, %s)", t, n, m)
-        printf (", {TUNABLE_TYPE_%s, %s, %s}, {.numval = 0}, NULL, TUNABLE_SECLEVEL_%s, %s},\n",
+        printf (", {TUNABLE_TYPE_%s, %s, %s}, {%s}, NULL, TUNABLE_SECLEVEL_%s, %s},\n",
 		types[t][n][m], minvals[t][n][m], maxvals[t][n][m],
-		security_level[t][n][m], env_alias[t][n][m]);
+		default_val[t][n][m], security_level[t][n][m], env_alias[t][n][m]);
       }
     }
   }