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) would be an implementation of a first consistency test. But wait my man page of syscall(2) already has an example of a 0 argument one. Other consistency checks would probably a bit more difficult to 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. Jens -- :: INRIA Nancy Grand Est :: http://www.loria.fr/~gustedt/ :: :: AlGorille ::::::::::::::: office Nancy : +33 383593090 :: :: ICube :::::::::::::: office Strasbourg : +33 368854536 :: :: ::::::::::::::::::::::::::: gsm France : +33 651400183 :: :: :::::::::::::::::::: gsm international : +49 15737185122 ::