Principles for syscall wrappers, again
Florian Weimer
fweimer@redhat.com
Fri Jun 5 09:23:00 GMT 2015
On 05/26/2015 10:55 AM, Torvald Riegel wrote:
> On Mon, 2015-05-18 at 20:09 -0400, Rich Felker wrote:
>> I would like to see futex in its own header, sys/futex.h, since it has
>> a number of macros. I also tend to think the function itself should be
>> variadic since a few of the argument slots have different types
>> depending on the command in use.
>
> Roland has argued that we should be adding GNU API extensions, not just
> Linuxisms. I think futex is a good example of that: I'd prefer us to
> expose functionality that is trimmed down to what's currently widely
> used (e.g., futex_wake(), futex_wait(), ... vs. a single variadic-arg
> futex()). That makes it easier for things like the Native Client to
> support it, and we can expose a refined interface to users (the futex
> syscalls has seen quite a few changes over time and not all of the
> initial functionality proved to be really useful).
These non-variadic interfaces can be implemented in C. A direct wrapper
for futex would have to be written in assembler and pass everything
directly to the kernel. But perhaps the system call wrapper generator
could take of it.
A C implementation which tries to reconstruct the argument list would
have to know all the operations/flags, similar separate to separate
functions for each operation. See bug 17523 for an example why this
could turn out to be relevant.
--
Florian Weimer / Red Hat Product Security
More information about the Libc-alpha
mailing list