Date: Wed, 17 Jul 2013 10:36:33 -0400 From: Rich Felker <dalias@...ifal.cx> To: musl@...ts.openwall.com Subject: Re: time code progress 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
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.