mailing list of musl libc
 help / color / mirror / code / Atom feed
* RUSAGE_THREAD
@ 2016-06-28 15:00 Raphael Cohn
  2016-06-28 16:52 ` RUSAGE_THREAD Rich Felker
  0 siblings, 1 reply; 4+ messages in thread
From: Raphael Cohn @ 2016-06-28 15:00 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 422 bytes --]

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?

Raph

[-- Attachment #2: Type: text/html, Size: 507 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: RUSAGE_THREAD
  2016-06-28 15:00 RUSAGE_THREAD Raphael Cohn
@ 2016-06-28 16:52 ` Rich Felker
  2016-06-28 16:58   ` RUSAGE_THREAD Raphael Cohn
  0 siblings, 1 reply; 4+ messages in thread
From: Rich Felker @ 2016-06-28 16:52 UTC (permalink / raw)
  To: musl

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: RUSAGE_THREAD
  2016-06-28 16:52 ` RUSAGE_THREAD Rich Felker
@ 2016-06-28 16:58   ` Raphael Cohn
  2016-06-28 17:47     ` RUSAGE_THREAD Szabolcs Nagy
  0 siblings, 1 reply; 4+ messages in thread
From: Raphael Cohn @ 2016-06-28 16:58 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 1061 bytes --]

On 28 June 2016 at 17:52, Rich Felker <dalias@libc.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?

[-- Attachment #2: Type: text/html, Size: 1583 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: RUSAGE_THREAD
  2016-06-28 16:58   ` RUSAGE_THREAD Raphael Cohn
@ 2016-06-28 17:47     ` Szabolcs Nagy
  0 siblings, 0 replies; 4+ messages in thread
From: Szabolcs Nagy @ 2016-06-28 17:47 UTC (permalink / raw)
  To: musl

* Raphael Cohn <raphael.cohn@stormmq.com> [2016-06-28 17:58:22 +0100]:
> On 28 June 2016 at 17:52, Rich Felker <dalias@libc.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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-06-28 17:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-28 15:00 RUSAGE_THREAD Raphael Cohn
2016-06-28 16:52 ` RUSAGE_THREAD Rich Felker
2016-06-28 16:58   ` RUSAGE_THREAD Raphael Cohn
2016-06-28 17:47     ` RUSAGE_THREAD Szabolcs Nagy

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).