From patchwork Thu Dec 29 08:30:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 709485 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 3tq2qg6zFPz9sdn for ; Thu, 29 Dec 2016 19:30:55 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="FddmKjVx"; 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:subject:to:references:cc:from:message-id:date :mime-version:in-reply-to:content-type; q=dns; s=default; b=hnyQ F7dFOoiO4cgb+uCbd7IEii4Gsf9leyyvrpMAQqwF0+sBGm68g5vN96voO+koNxvn xQr4Eku152yq1PArGRFm5HlNDqy3GcPm52YfV2P8IbXkOSBsJABQvV/syGoc4cV0 Z3W6eZehXbgIgcfsSCmPxzQAyoPNX4fUi1K6Ag8= 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:subject:to:references:cc:from:message-id:date :mime-version:in-reply-to:content-type; s=default; bh=T6o4M344UD ZpYRXKyeb3NgeUP5c=; b=FddmKjVx+H6v9nquAJUUp4IJsYGn6sicpUiPaGrNjc FMZKfVFAyp1sub3iNCviX+an8bIdGxHOs+7DaLwh611F0ttl1YjDmR6wbsbUZ95c aXW/doVmk9R4iarYDHWh64BiAwx5J9frxqenM64fZubuKss95PmfXa4T0CWENWDX g= Received: (qmail 53647 invoked by alias); 29 Dec 2016 08:30:46 -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 53596 invoked by uid 89); 29 Dec 2016 08:30:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.1 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Subject: Re: getentropy for To: Zack Weinberg References: <3e61c6ab-ca86-bd2b-26b0-35854d5ce388@redhat.com> <87ful9i7t9.fsf@linux-m68k.org> <2a5da2d5-036d-1739-edfe-2337a9f94701@redhat.com> Cc: Andreas Schwab , GNU C Library From: Florian Weimer Message-ID: <1dcd01a6-0ad0-94b2-ef9e-28c4c854db44@redhat.com> Date: Thu, 29 Dec 2016 09:30:38 +0100 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: On 12/28/2016 06:02 PM, Zack Weinberg wrote: > On Wed, Dec 28, 2016 at 1:50 AM, Florian Weimer wrote: >> It's not in 4.3BSD either, and if __USE_MISC is intended to be restricted to >> those definitions (or those of similar vintage), then __USE_MISC would not >> be correct. >> >> If __USE_MISC is free to involve, pretty much like __USE_GNU, then this is >> not a problem. But it's not clear to me if this is the intent. > > It seems to me that the *useful* distinction between __USE_MISC and > __USE_GNU nowadays is: __USE_MISC is for non-standardized features > that are visible by default, __USE_GNU is for non-standardized > features that are only visible when requested with -D_GNU_SOURCE. > > So the decision to make when choosing between the two is "should this > be visible by default?" I would personally tend to err on the side of > "no" when adding new things to core headers like unistd.h. At least we should treat getentropy and explicit_bzero in an identical fashion. What about this patch? Florian getentropy: Declare it in for __USE_MISC 2016-12-29 Florian Weimer * posix/unistd.h (getentropy): Declare for __USE_MISC, not just __USE_GNU. diff --git a/posix/unistd.h b/posix/unistd.h index 70b10c6..a8c9aa9 100644 --- a/posix/unistd.h +++ b/posix/unistd.h @@ -1157,7 +1157,7 @@ extern int pthread_atfork (void (*__prepare) (void), void (*__child) (void)) __THROW; #endif -#ifdef __USE_GNU +#ifdef __USE_MISC /* Write LENGTH bytes of randomness starting at BUFFER. Return 0 on success or -1 on error. */ int getentropy (void *__buffer, size_t __length) __wur;