* sched_* implemented?
@ 2016-03-01 4:32 James Marshall
2016-03-01 4:59 ` Rich Felker
0 siblings, 1 reply; 3+ messages in thread
From: James Marshall @ 2016-03-01 4:32 UTC (permalink / raw)
To: musl
[-- Attachment #1: Type: text/plain, Size: 511 bytes --]
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.
Thanks,
James
[-- Attachment #2: Type: text/html, Size: 758 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: sched_* implemented?
2016-03-01 4:32 sched_* implemented? James Marshall
@ 2016-03-01 4:59 ` Rich Felker
2016-03-01 5:50 ` James Marshall
0 siblings, 1 reply; 3+ messages in thread
From: Rich Felker @ 2016-03-01 4:59 UTC (permalink / raw)
To: James Marshall; +Cc: musl
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: sched_* implemented?
2016-03-01 4:59 ` Rich Felker
@ 2016-03-01 5:50 ` James Marshall
0 siblings, 0 replies; 3+ messages in thread
From: James Marshall @ 2016-03-01 5:50 UTC (permalink / raw)
To: musl
[-- Attachment #1: Type: text/plain, Size: 1306 bytes --]
That works! Thank you for the help.
The way glibc / sched_setscheduler are setup is very... interesting.
James
On Mon, Feb 29, 2016 at 11:59 PM, Rich Felker <dalias@libc.org> wrote:
> 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
>
[-- Attachment #2: Type: text/html, Size: 1981 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-01 5:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-01 4:32 sched_* implemented? James Marshall
2016-03-01 4:59 ` Rich Felker
2016-03-01 5:50 ` James Marshall
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).