Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20160628174700.GB19691@port70.net>
Date: Tue, 28 Jun 2016 19:47:00 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: RUSAGE_THREAD

* Raphael Cohn <raphael.cohn@...rmmq.com> [2016-06-28 17:58:22 +0100]:
> On 28 June 2016 at 17:52, Rich Felker <dalias@...c.org> wrote:
> > On Tue, Jun 28, 2016 at 04:00:45PM +0100, Raphael Cohn wrote:
> > > Hi,
> > >
> > > I'm in the process of compiling ZFS on Linux against musl. ZFS seems to
> > > make a few slightly glibc-like assumptions, one of which is the use of
> > > RUSAGE_THREAD. Musl seems to lack a definition of this in sys/resource.h.
> > > Is this deliberate?
> > >
> > > Glibc defines RUSAGE_THREAD as 1, but musl already uses this value for
> > > RUSAGE_CHILDREN (glibc sets this as -1). What would be the correct value
> > > for RUSAGE_THREAD with musl?
> >
> > Maybe this is incorrect in musl then. Can anyone confirm? The values
> > are determined by (i.e. have to match) the kernel.
> >
> > Rich
> >
> 
> I've grabbed the 4.6 linux kernel sources. A quick grep suggests
> include/uapi/linux/resource.h  defines it as 1. Additionally, in this file:-
> 
> RUSAGE_SELF is 0 (I believe this is also the value musl uses).
> RUSAGE_CHILDREN is -1
> RUSAGE_BOTH is -2 (not in glibc; not mentioned in the getrusage man pages I
> have).
> 
> What does anyone else think?

yes it seems the kernel definitions are

#define	RUSAGE_SELF	0
#define	RUSAGE_CHILDREN	(-1)
#define RUSAGE_BOTH	(-2)		/* sys_wait4() uses this */
#define	RUSAGE_THREAD	1		/* only the calling thread */

on all targets

_BOTH means _SELF+_CHILDREN and is used in the implementation of wait
in the kernel.

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.