mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: James Marshall <jcmarsh@gwmail.gwu.edu>
Cc: musl@lists.openwall.com
Subject: Re: sched_* implemented?
Date: Mon, 29 Feb 2016 23:59:20 -0500	[thread overview]
Message-ID: <20160301045920.GJ9349@brightrain.aerifal.cx> (raw)
In-Reply-To: <CACSoc7h2hCbqnBU0JfEO4WPGyQ87UZCPeRSU_qeJnwYGkHm=Og@mail.gmail.com>

On Mon, Feb 29, 2016 at 11:32:34PM -0500, James Marshall wrote:
> Hi,
> 
> I'm working on a realtime application and am trying to use musl. I would
> like to call sched_setscheduler, but it looks like this is just a stub in
> musl.
> 
> However,
> http://nsz.repo.hu/git/?p=musl-tables;a=blob_plain;f=tab_posix.html;hb=HEAD
> has it marked as implemented. Am I missing something? Is there a patch
> available?
> 
> If there is not, any idea of how difficult it would be for me to add it in?
> Or would I be better off using syscall directly instead?
> 
> Your help and time is appreciated.

The reason it doesn't do anything is that Linux does not provide a way
to set scheduling parameters for a _process_, only for threads. The
sched_setscheduler syscall is documented as taking a pid but actually
takes a thread id and only operates on that thread. glibc just ignores
this and provides sched_* functions that do the wrong thing.

Fortunately there's an easy fix: use pthread_setschedparam, and
pthread_self to get the pthread_t value you need to pass to it.

Rich


  reply	other threads:[~2016-03-01  4:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-01  4:32 James Marshall
2016-03-01  4:59 ` Rich Felker [this message]
2016-03-01  5:50   ` James Marshall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160301045920.GJ9349@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=jcmarsh@gwmail.gwu.edu \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).