From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/9410 Path: news.gmane.org!not-for-mail From: Alexander Monakov Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] add sched_getcpu Date: Mon, 29 Feb 2016 22:59:10 +0300 (MSK) Message-ID: References: <1456765028-23958-1-git-send-email-nathan@nathan7.eu> <1456765216-24883-1-git-send-email-nathan@nathan7.eu> <20160229183816.GB9349@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Trace: ger.gmane.org 1456775964 25418 80.91.229.3 (29 Feb 2016 19:59:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 29 Feb 2016 19:59:24 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-9423-gllmg-musl=m.gmane.org@lists.openwall.com Mon Feb 29 20:59:24 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1aaTyW-0005JD-1S for gllmg-musl@m.gmane.org; Mon, 29 Feb 2016 20:59:24 +0100 Original-Received: (qmail 19537 invoked by uid 550); 29 Feb 2016 19:59:22 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 19519 invoked from network); 29 Feb 2016 19:59:21 -0000 In-Reply-To: <20160229183816.GB9349@brightrain.aerifal.cx> User-Agent: Alpine 2.20 (LNX 67 2015-01-07) Xref: news.gmane.org gmane.linux.lib.musl.general:9410 Archived-At: On Mon, 29 Feb 2016, Rich Felker wrote: > > (this include could also be dropped; I think it's a matter of policy whether > > such includes are desirable or not, so please wait for comment from Rich) > > Policy is to always include the header with the public declaration > (and any feature test macros necessary to get it) so that the compiler > checks the implementation against the public declaration. This policy certain makes sense; I pointed that out because I've seen it violated; at least the following files violate it by defining something without including anything: arch/arm/src/__aeabi_atexit.c src/internal/procfdname.c src/misc/gethostid.c src/prng/__seed48.c src/signal/restore.c src/signal/sigrtmin.c src/stdlib/abs.c src/stdlib/labs.c src/stdlib/llabs.c src/time/__month_to_secs.c src/time/__year_to_secs.c (but e.g. in procfdname.c there's nothing to include because every caller declares the prototype, and also hardcodes the buffer size -- see my recent patch) > > This is wrong, as it doesn't set errno on error, and does not produce -1. This > > should be something like 'return s ? __syscall_ret(s) : c;' or maybe > > 'return __syscall_ret(s ? s : c);'. > > Why is an error even possible here? Is it just to account for ancient > kernels that lack the syscall? Apparently so -- afaics current kernels can only produce EFAULT, which cannot happen in this case. (I was wrong about the need to use __syscall_ret, but that's for another subthread) Alexander