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: 89251 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp5884462qgi; Thu, 29 Dec 2016 00:30:58 -0800 (PST) X-Received: by 10.99.43.8 with SMTP id r8mr74884487pgr.83.1483000257322; Thu, 29 Dec 2016 00:30:57 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id n19si39443169pgk.278.2016.12.29.00.30.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Dec 2016 00:30:57 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-76407-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of libc-alpha-return-76407-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-76407-patch=linaro.org@sourceware.org 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=vpxc +NKhqLScsqe10QULQXikSA4n2jOMkQ2Zjj+8sOR6MijHT9R091etBNK+oD/VTukm td9KWUG4bk+o7ucR4S694yt098pqH2EiBAHdtmIOm8PvXHFrUJlu3GFKX4F8NqDB /k5l4tvpvNaR/UACNOevK6fY7v3JxskvvMyrg/E= 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=sVNQov1KrmVxk4AMd58oNYesl/UIuzF0yKEHZlRkIm q1jEDga1ErWGytlmdn6Ko9nslmXsz0/KEiuG+LU6N5Msck0AnLD+htlZqhELJyRW 7GuGD2Fe2ImvjOXly+l/ov4RiSvVa7OB9kKuOv9rhTHuipXxQOdfywViQSm0kjp5 M= 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;