]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
tunables: Specify a default value for tunables
authorSiddhesh Poyarekar <siddhesh@sourceware.org>
Wed, 17 May 2017 07:41:00 +0000 (13:11 +0530)
committerSiddhesh Poyarekar <siddhesh@sourceware.org>
Wed, 17 May 2017 07:41:00 +0000 (13:11 +0530)
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.

ChangeLog
README.tunables
scripts/gen-tunables.awk

index 7a0a45a8454fdcc4eeccf0e39f8ebebb01450adf..a4a88e530cedfa392020407e2dc1df016caa2701 100644 (file)
--- 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.
index aace2fca8f69646545a9d09a60abe9e555d2863f..3f16b5d8275c5a9bf75908d5c568e44f898263e3 100644 (file)
@@ -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:
index defb3e7354857fae1d6e742fc923f76651365358..b10b00ebd6b7a9e702c12a5b2eca59996ab8200a 100644 (file)
@@ -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]);
       }
     }
   }