From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/3675 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: time code progress Date: Wed, 17 Jul 2013 10:36:33 -0400 Message-ID: <20130717143633.GD12469@brightrain.aerifal.cx> References: <20130716194553.GA9438@brightrain.aerifal.cx> <20130717093325.GA12469@brightrain.aerifal.cx> <20130717113906.GT15323@port70.net> <1374062978.20259.243.camel@eris.loria.fr> <20130717131948.GU15323@port70.net> <1374068375.20259.255.camel@eris.loria.fr> 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 1374071807 19351 80.91.229.3 (17 Jul 2013 14:36:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Jul 2013 14:36:47 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-3679-gllmg-musl=m.gmane.org@lists.openwall.com Wed Jul 17 16:36:49 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1UzSqW-0005dl-0u for gllmg-musl@plane.gmane.org; Wed, 17 Jul 2013 16:36:48 +0200 Original-Received: (qmail 20445 invoked by uid 550); 17 Jul 2013 14:36:47 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 20436 invoked from network); 17 Jul 2013 14:36:46 -0000 Content-Disposition: inline In-Reply-To: <1374068375.20259.255.camel@eris.loria.fr> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:3675 Archived-At: On Wed, Jul 17, 2013 at 03:39:35PM +0200, Jens Gustedt wrote: > Am Mittwoch, den 17.07.2013, 15:19 +0200 schrieb Szabolcs Nagy: > > note that the problem is not that __VA_ARGS__ is empty > > (it's not, contrary to what i might implied), but that > > if n becomes 0 (== __VA_ARGS__ expands to one argument), > > then there is no more arguments in the __SYSCALL_NARGS_X > > call to substitute for '...', so a simple fix would be > > > > #define __SYSCALL_NARGS(...) __SYSCALL_NARGS_X(__VA_ARGS__,7,6,5,4,3,2,1,0, tralala) > > right, you always have the name of the syscall as first argument > > > but i'm not sure if this should be fixed (this is internal > > code and i think there are no 0 argument syscalls) > > > > i just wanted to record how i found the close without fd issue > > (which shows that some kind of type checking for syscall > > arguments would help libc hacking.. but that's non-trivial > > to do) > > if there are really no 0 argument syscalls > > #define __SYSCALL_NARGS(...) __SYSCALL_NARGS_X(__VA_ARGS__,7,6,5,4,3,2,1, tralali, tralala) There are, e.g. getpid. So I'm not sure why this issue has never come up before. I'm guessing you have a newer gcc that added a new warning for it; my gcc does not seem to warn. Anyway, I thought of the 0-arg issue back when I came up with these macros, and it was resolved by always having the syscall number. But I failed to realize there would be no arguments for the ... slot of __SYSCALL_NARGS_X. > implement. I could imagine how to check for the number of arguments of > particular syscalls. Type checking would be more difficult, and would > probably need some maintenance. This might be more easily achieved with a grep recipe... Rich