Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120909222917.GL27715@brightrain.aerifal.cx>
Date: Sun, 9 Sep 2012 18:29:17 -0400
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Subject: Re: capset() capget() syscalls

On Sun, Sep 09, 2012 at 11:12:01PM +0100, Justin Cormack wrote:
> On Sun, Sep 9, 2012 at 10:55 PM, Rich Felker <dalias@...ifal.cx> wrote:
> > With something like futex that's a trivial syscall, I'm not sure what
> > qualifies it for a separate lib rather than inclusion in libc. The
> > library would be <20 bytes of code on most archs... That's not to say
> > I think we have to expose it in musl, but I think using a separate
> > library (especially if there's any chance of it being built as a .so
> > rather than just .a) is a worse choice than just writing
> > syscall(SYS_futex, ...) in your source...
> 
> The manpage says
> 
>        To reiterate, bare futexes are not intended as an easy-to-use
> abstraction for end-users.  (There
>        is no wrapper function for this system call in glibc.)
> Implementors are expected to be assembly
>        literate and to have read the sources of the futex userspace
> library referenced below.
> 
> I thought (from memory) the non-contended case required architecture
> specific assembly, the syscall just dealt with contended case. So the
> library needs to provide the other stuff to make it usable. Its not a
> lot, and must be there to use these for threading I guess, but doesnt
> have standard names?

"GNU C" (GCC-specific) or C11 atomics will work perfectly well in
place of assembly; the whole point of exposing the futex syscall to
the application would be for it to do its own waiting in conjunction
with atomics (whether implemented with GNUC, C11, or asm). The futex
API is mainly for waiting on locks or waking waiters; for the most
part it does not even provide an API for obtaining locks, although the
prio-inheritance stuff can provide full locking in kernelspace, albeit
very inefficiently. We're talking 200x slower than calling
pthread_mutex_lock, so it would be utterly useless..

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.