This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Principles for syscall wrappers, again
- From: Rich Felker <dalias at libc dot org>
- To: Andreas Schwab <schwab at linux-m68k dot org>
- Cc: Szabolcs Nagy <szabolcs dot nagy at arm dot com>, Torvald Riegel <triegel at redhat dot com>, Joseph Myers <joseph at codesourcery dot com>, "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>
- Date: Mon, 1 Jun 2015 18:54:39 -0400
- Subject: Re: Principles for syscall wrappers, again
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot DEB dot 2 dot 10 dot 1505281648440 dot 16930 at digraph dot polyomino dot org dot uk> <1432888653 dot 30849 dot 146 dot camel at triegel dot csb> <alpine dot DEB dot 2 dot 10 dot 1505291103540 dot 2439 at digraph dot polyomino dot org dot uk> <1432900697 dot 30849 dot 178 dot camel at triegel dot csb> <alpine dot DEB dot 2 dot 10 dot 1505291301400 dot 18021 at digraph dot polyomino dot org dot uk> <1432908585 dot 30849 dot 213 dot camel at triegel dot csb> <alpine dot DEB dot 2 dot 10 dot 1505291524290 dot 27491 at digraph dot polyomino dot org dot uk> <1432923248 dot 4832 dot 40 dot camel at triegel dot csb> <556C6160 dot 201 at arm dot com> <m2oakz9i17 dot fsf at linux-m68k dot org>
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