Principles for syscall wrappers, again

Rich Felker dalias@libc.org
Mon Jun 1 23:28:00 GMT 2015


On Tue, Jun 02, 2015 at 12:32:20AM +0200, Andreas Schwab wrote:
> Szabolcs Nagy <szabolcs.nagy@arm.com> writes:
> 
> > i assume providing the kernel futex api (as a variadic function)
> 
> Variadic functions are problematic.

I don't much like them either, but I also don't like casts to pass
val2 to FUTEX_*REQUEUE* and FUTEX_WAKE_OP. I also don't like that the
caller would have to unconditionally pass 6 arguments even for
commands (especially futex_wake) that only need 3 or 4. On lots of
targets 4 is the cutoff for arguments passed in registers, so always
passing 6 arguments will seriously pessimize code generation (stack
frame setup, register allocation, spillage, etc.) in the caller,
whereas futex is expected only to be called in an unlikely code path.

In any case this is a fairly minor issue and I don't want disagreement
over whether to make futex() variadic or not to derail it.

Rich



More information about the Libc-alpha mailing list