From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19943 invoked by alias); 30 Dec 2016 09:50:27 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 19923 invoked by uid 89); 30 Dec 2016 09:50:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.1 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Bare, sk:INTERNA, *out, map_private X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Subject: Re: [PATCH 2/4] Initialize tunable list with the GLIBC_TUNABLES environment variable To: Siddhesh Poyarekar , libc-alpha@sourceware.org References: <1483070938-2308-1-git-send-email-siddhesh@sourceware.org> <1483070938-2308-3-git-send-email-siddhesh@sourceware.org> Cc: carlos@redhat.com From: Florian Weimer Message-ID: <3abae843-c36e-171a-b412-2fe1b76685e9@redhat.com> Date: Fri, 30 Dec 2016 09:50:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <1483070938-2308-3-git-send-email-siddhesh@sourceware.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2016-12/txt/msg01056.txt.bz2 On 12/30/2016 05:08 AM, Siddhesh Poyarekar wrote: > + /* Bare mmap system call to avoid setting errno which may not be available > + yet. */ > + INTERNAL_SYSCALL_DECL (err); > + char *out = (char *) INTERNAL_SYSCALL_CALL (mmap, err, NULL, i, PROT_READ | PROT_WRITE, > + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); > + if (INTERNAL_SYSCALL_ERROR_P (out, err)) > + return NULL; INTERNAL_SYSCALL is not available in generic code. You should use sbrk (like the TCB allocation in the startup code; it would also reduce wasted memory), or mmap with a comment indicating that this will crash if mmap updates errno. (I believe the comment in the startup code about mmap is wrong.) Thanks, Florian