comp.lang.ada
 help / color / mirror / Atom feed
From: Fernando Oleo Blanco <irvise_ml@irvise.xyz>
Subject: Re: Help: Ada in NetBSD
Date: Thu, 23 Sep 2021 21:53:47 +0200	[thread overview]
Message-ID: <siim0b$q2e$1@gioia.aioe.org> (raw)
In-Reply-To: sig2b7$i95$1@gioia.aioe.org

Okay, so another short blog post. This is going to be a bit of a fucking 
rant.

So... remember when I said that NetBSD expected a priority value of -1 
when using SCHED_ODER? And that that was not POSIX compilant? Well, 
after a nice conversation in #netbsd, it has been decided to escalate 
this matter into a PR/ML discussion. All that good :)

But the question on how does Linux work then? Remained... So I ran the 
ACATS suite with debugging symbols, recompilation and assertions to 
check. And guess what?

Let the code speak:


    else 

      Param.sched_priority := 0; 

      Result := 

      pthread_setschedparam 

      (T.Common.LL.Thread, 

       SCHED_OTHER, Param'Access); 

    end if; 


    pragma Assert (Result in 0 | EPERM | EINVAL); 

end Set_Priority;

So the Set_Priority function receives the Default_Priority value, which 
I think was 48. But when it goes into the actual branch, it knows that 
that default value is stupid and discards it (sets it to 0). That would 
be all nice and dandy, but here is the problem, 0 is a valid value 
because most OS/arches use it, there is no reason 0 is valid (as per POSIX).

And what really gets me is that Pragma... Whomever wrote it probably was 
getting errors and decided that that was fine. EPERM? EINVAL? Not my 
problem! No wonder there is a specific s-taprop__linux.adb...


So here we are. NetBSD is not POSIX compliant (min and max SCHED_OTHER 
priority is -1, which is an error code for the function that should 
return it), and Linux hardcodes it. Amazing, just amazing...


My solution? Email the NetBSD people. But that won't be enough. So I am 
thinking in patching the s-taprop__posix.adb file to try it with the 
default priority, if it fails, with 0, if it fails, with -1 for NetBSD...


Oh well... I thought that the state of GNAT was better... Anyhow, regards,
-- 
Fernando Oleo Blanco
https://irvise.xyz

  parent reply	other threads:[~2021-09-23 19:53 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-29 11:06 Help: Ada in NetBSD Fernando Oleo Blanco
2021-08-29 13:19 ` Stephane Carrez
2021-08-29 18:08   ` Fernando Oleo Blanco
2021-08-29 18:25     ` Simon Wright
2021-08-29 20:36       ` Fernando Oleo Blanco
2021-08-29 22:08         ` Stephane Carrez
2021-08-30  7:37           ` Simon Wright
2021-08-30  8:14           ` Fernando Oleo Blanco
2021-08-30 10:24             ` Fernando Oleo Blanco
2021-08-30 12:15               ` Fernando Oleo Blanco
2021-08-30 18:49                 ` Fernando Oleo Blanco
2021-08-30 19:23                   ` Simon Wright
2021-09-01  9:44                     ` Fernando Oleo Blanco
2021-09-01 21:41                       ` Simon Wright
2021-09-02 22:16                       ` Randy Brukardt
2021-09-03 20:18                         ` Simon Wright
2021-08-29 17:34 ` Simon Wright
2021-08-29 17:45   ` Fernando Oleo Blanco
2021-09-01 13:28 ` John R. Marino
2021-09-01 14:58   ` Fernando Oleo Blanco
2021-09-17 17:36     ` Fernando Oleo Blanco
2021-09-18 16:39       ` Fernando Oleo Blanco
2021-09-22 20:05         ` Fernando Oleo Blanco
2021-09-22 20:57           ` Simon Wright
2021-09-23  8:04           ` Luke A. Guest
2021-09-23 10:48             ` Kevin Chadwick
2021-09-23 17:01               ` Fernando Oleo Blanco
2021-09-23 17:04             ` Fernando Oleo Blanco
2021-09-23 19:53           ` Fernando Oleo Blanco [this message]
2021-09-24  7:48             ` Simon Wright
2021-09-24  9:44               ` Fernando Oleo Blanco
2021-09-13 18:49   ` Fernando Oleo Blanco
2021-09-13 22:24     ` Dennis Lee Bieber
2021-09-17 17:19       ` Fernando Oleo Blanco
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox