about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--README.tunables2
-rw-r--r--scripts/gen-tunables.awk12
3 files changed, 18 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 7a0a45a845..a4a88e530c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-05-17  Siddhesh Poyarekar  <siddhesh@sourceware.org>
+
+	* scripts/gen-tunables.awk: Recognize 'default' keyword in
+	dl-tunables.list.
+	* README.tunables: Document it.
+
 2017-05-15  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
 	* sysdeps/posix/preadv.c: Use sysdeps/posix/preadv_common.c.
diff --git a/README.tunables b/README.tunables
index aace2fca8f..3f16b5d827 100644
--- a/README.tunables
+++ b/README.tunables
@@ -56,6 +56,8 @@ The list of allowed attributes are:
 - maxval:		Optional maximum acceptable value.  For a string type
 			this is the maximum length of the value.
 
+- default:		Specify an optional default value for the tunable.
+
 - env_alias:		An alias environment variable
 
 - security_level:	Specify security level of the tunable.  Valid values:
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]);
       }
     }
   }