|
Message-ID: <20160301045920.GJ9349@brightrain.aerifal.cx> Date: Mon, 29 Feb 2016 23:59:20 -0500 From: Rich Felker <dalias@...c.org> To: James Marshall <jcmarsh@...ail.gwu.edu> Cc: musl@...ts.openwall.com Subject: Re: sched_* implemented? 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
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.