From patchwork Thu May 11 14:51:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 20397 Received: (qmail 89699 invoked by alias); 11 May 2017 14:52:02 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 89624 invoked by uid 89); 11 May 2017 14:52:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_NEUTRAL autolearn=ham version=3.3.2 spammy= X-HELO: homiemail-a40.g.dreamhost.com From: Siddhesh Poyarekar To: libc-alpha@sourceware.org Subject: [PATCH 1/7] tunables: Specify a default value for tunables Date: Thu, 11 May 2017 20:21:40 +0530 Message-Id: <1494514306-4167-2-git-send-email-siddhesh@sourceware.org> In-Reply-To: <1494514306-4167-1-git-send-email-siddhesh@sourceware.org> References: <1494514306-4167-1-git-send-email-siddhesh@sourceware.org> 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. --- scripts/gen-tunables.awk | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/gen-tunables.awk b/scripts/gen-tunables.awk index defb3e7..b10b00e 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]); } } }