From patchwork Tue Jan 19 13:50:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 569991 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id DC0EB140C38 for ; Wed, 20 Jan 2016 00:50:24 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=bTG+AIdN; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:references :content-type:in-reply-to; q=dns; s=default; b=V88UoaxxWy1a82ThC hlMLsufLKnHmI+K/fbYx93RPOA7jsc4npM3xcSOjV+FPi71RRG58tA4jCnT+rLJh HVe3LdBaSMp0boAkbT1BRenHwFCPbO8Yablzi1ID4BMQUzAtFRUkiv62ks4D/cZM +c1LEjmS06UR1jZOtoQxLGNNFs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:references :content-type:in-reply-to; s=default; bh=ScJ+1ImjTi/ZdULP8J8RjpR pm9o=; b=bTG+AIdNDRLVSBYhOv8+RznY1zJSWZeyjRMdW74hTt1gVi1LVzIChtU uI0RfkY4uVOxNB+SpIxqiLuUM1owYbrqzhusZzxhmALXtzKLR9wcKFzmMVLEmaut nUcAUJnkFQgUELEDgH6z+T594pU6eSbknyvq+rSelAaVfGKWdtTY= Received: (qmail 68621 invoked by alias); 19 Jan 2016 13:50:18 -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 67920 invoked by uid 89); 19 Jan 2016 13:50:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL, BAYES_50, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1383, sk:glibcp, glibc_tunables, quirks X-HELO: mx-out03.mykolab.com X-Spam-Score: -2.9 Date: Tue, 19 Jan 2016 19:20:06 +0530 From: Siddhesh Poyarekar To: "Paul E. Murphy" Cc: libc-alpha@sourceware.org, roland@hack.frob.com, carlos@redhat.com, Andi Kleen , tuliom@linux.vnet.ibm.com, munroesj@linux.vnet.ibm.com Subject: Re: [PATCHv2 2/2] Initialize tunable list with the GLIBC_TUNABLES environment variable Message-ID: <20160119135006.GN3334@devel.intra.reserved-bit.com> References: <20160116185617.GA17783@devel.intra.reserved-bit.com> <569D646A.4000100@linux.vnet.ibm.com> Content-Disposition: inline In-Reply-To: <569D646A.4000100@linux.vnet.ibm.com> On Mon, Jan 18, 2016 at 04:17:14PM -0600, Paul E. Murphy wrote: > While this does work as expected with trivial inputs, it does > have some quirks: > > I.e this will set the desired tunable: > GLIBC_TUNABLES="glibc.pthread.elision_enable=1" > GLIBC_TUNABLES="glibc.pthread.elision_enable=1:" > GLIBC_TUNABLES="foo=:glibc.pthread.elision_enable=1" > > But the following does not: > GLIBC_TUNABLES=":glibc.pthread.elision_enable=1" > GLIBC_TUNABLES="foo:glibc.pthread.elision_enable=1" > GLIBC_TUNABLES="val=foo:bar:glibc.pthread.elision_enable=1" Thanks for testing, this patch on top of 2/2 should fix this. Siddhesh diff --git a/tunables/tunables.c b/tunables/tunables.c index d5090fd..b942c10 100644 --- a/tunables/tunables.c +++ b/tunables/tunables.c @@ -157,7 +157,7 @@ __tunables_init (char **envp) size_t len = 0; /* First, find where the name ends. */ - while (p[len] != '=' && p[len] != '\0') + while (p[len] != '=' && p[len] != ':' && p[len] != '\0') len++; /* If we reach the end of the string before getting a valid name-value @@ -165,6 +165,14 @@ __tunables_init (char **envp) if (p[len] == '\0') goto out; + /* We did not find a valid name-value pair before encountering the + colon. */ + if (p[len]== ':') + { + p += len + 1; + continue; + } + p[len] = '\0'; p += len + 1;