From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/9423 Path: news.gmane.org!not-for-mail From: James Marshall Newsgroups: gmane.linux.lib.musl.general Subject: Re: sched_* implemented? Date: Tue, 1 Mar 2016 00:50:59 -0500 Message-ID: References: <20160301045920.GJ9349@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b3a8224b250cb052cf65a64 X-Trace: ger.gmane.org 1456811497 27601 80.91.229.3 (1 Mar 2016 05:51:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 1 Mar 2016 05:51:37 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-9436-gllmg-musl=m.gmane.org@lists.openwall.com Tue Mar 01 06:51:33 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1aadDY-0005X6-5m for gllmg-musl@m.gmane.org; Tue, 01 Mar 2016 06:51:32 +0100 Original-Received: (qmail 7288 invoked by uid 550); 1 Mar 2016 05:51:30 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 7267 invoked from network); 1 Mar 2016 05:51:30 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gwmail-gwu-edu.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=OnjBsEizv6AGrJcsmet2jKbPxRBhZ8dOmij0LODopa4=; b=LNI+PkZIcISO3cSEM1QVX+ZuHbWGDlEIEISfmJXcENfTprxWHsF1x4YMASByYbtV7p T7KODwgDRaDKfekcEt+Hq9gaiura7phxIISwG4oQOqYMLwx0ZpPCDp1GURCTXq/4XKcK V459IPoU6jJGUVj9WF7IOuK44CWd8N6wVTnuaSaVmOx/HR+GYYlt9nB+WJ4dc5Ldk9xw kqnxNprLp+x2tuiBI9Ctq2EtEa1axjvbO53ep4w4eJjCIKDapRrnAnqgjEVeMM/kfw2O ZJmAMGfXCKHdSM1xojs0LYr7i36Ok/vITj2M3GQc1AQ1b8hZOTcKMMXmqRwdAOERP5Rm vSWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=OnjBsEizv6AGrJcsmet2jKbPxRBhZ8dOmij0LODopa4=; b=M+DQWT5ZIk/IjMgSFgfhAqB4cArQQzC9/K3M2wudVF/PjBlul1pK6kP4h4V3S+2PbS 1l0h6T7OREIb/tEKO3HL99NN3DZUuZrHH7wVfRnAVY4nBTOAGRh1cooMjqst2lDjISH4 5QJouGifRYfFLoL/OKF5HfseFiDPfMKDAElsxsKo6aKhl5LzC3nXkL6Z8/iBPEiAv/e3 BlOPVQtQHycxXMmzmIHB3LWGXMEkYM8nmGLNJISDvTkc1wPAvJAxbRhNNYk2mCaqvEVN 8rdOg2xQl58bBmIs3jpv2K9fmv8N6zS6Fw7MSV2ryNLK41L51ZST304sydBdDaNkbGVy thXg== X-Gm-Message-State: AD7BkJKsaOsFfJSmPbV6yo3D5FHviXMmA1TSB5bFo9NJUmuLY2ufDPRoFHzB0erxkOhnhjpeL8L1pPMNJz5etvtJ X-Received: by 10.112.150.133 with SMTP id ui5mr6937558lbb.12.1456811478760; Mon, 29 Feb 2016 21:51:18 -0800 (PST) In-Reply-To: <20160301045920.GJ9349@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:9423 Archived-At: --047d7b3a8224b250cb052cf65a64 Content-Type: text/plain; charset=UTF-8 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 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 > --047d7b3a8224b250cb052cf65a64 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
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.r= epo.hu/git/?p=3Dmusl-tables;a=3Dblob_plain;f=3Dtab_posix.html;hb=3DHEAD=
> 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 i= t 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

--047d7b3a8224b250cb052cf65a64--