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

Another followup. This may require a new thread, but we will see.

So, very long story short. The assertion failure that I was getting, 
s-taprop.adb:659 was because "pthread_setschedparam" was returning a 
failure.

After digging up a bit, I noticed that the SCHED_{OTHER,RR,FIFO} 
constants in s-osint__netbsd (taken from J. Marino) were wrong.

I corrected the values and expected GNAT to finally work. It did not.

The error being returned now by "pthread_setschedparam" was, however, 
different. The error was that the input values were invalid. I checked 
the input values, all seemed correct. I decided to take a look at the 
validity of the "Priority" variable, as I did not know anything about 
it. Which values could it take?

Unsurprisingly, the priority for the task may take different values 
depending on the scheduler (SCHED_{OTHER,RR,FIFO}) and the OS. The link 
I found that showed/explained this is 
https://stackoverflow.com/questions/10657970/pthread-sched-get-priority-min-max-implementation-for-sched-other-sched-fifo

So I ran the code in the link to see if the Priority value was valid in 
NetBSD and... Oh... Min: -1 and Max: -1... Reading the POSIX manual it 
says that -1 is an error... Was I getting an error code?

I went into #netbsd, asked aaaaandd... No, it is no error, those are the 
actual values that NetBSD uses as valid ones... So NetBSD is _not_ POSIX 
compilant in this case... More quirks to take into account... However, 
this thing is going to get discussed with NetBSD people.

But this is not where it ends...

The priority number I was getting is the default in libgnat/system.ads:
gcc/ada/libgnat/system.ads:   Default_Priority : constant Priority := 15;

Some OSs/architectures have different defaults, but 15 seems to be the 
most common one. However, this causes another question. If the valid 
range is 0..0 (as in Ubuntu), how does GNAT know which priority value to 
use? I have more or less followed the flow from where the value of 
Priority gets set and I have not found anything that caught my eye. So I 
would expect that in Ubuntu (for example) a Priority of 15 would create 
an error... But it does not (GNAT works fine there). Strange... This 
will require further research...

BUT that is not all. In GDB I manually changed the value of Priority to 
-1 to see if it would work... And it did! But then when I told it to 
continue, it error out in another place, s-tpopmo.adb:213. That is no 
new error, in previous ACATS runs I was getting it in some places. And 
it seems related to the "adafinal" procedure, which is run when a 
program is done. Some tests were failing in adafinal while being 
debugged in gdb, and if I remember correctly, they were also failing in 
s-tpopmo.adb...

This little project of mine is going deeper and deeper each week... Arg...

Cheers,
-- 
Fernando Oleo Blanco
https://irvise.xyz

  reply	other threads:[~2021-09-22 20:05 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 [this message]
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
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