From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: * X-Spam-Status: No, score=1.1 required=3.0 tests=BAYES_00,FROM_SUSPICIOUS_NTLD, FROM_SUSPICIOUS_NTLD_FP,PDS_OTHER_BAD_TLD autolearn=no autolearn_force=no version=3.4.6 Path: eternal-september.org!reader02.eternal-september.org!aioe.org!1h/B/1ghrB+3MK0iWL8Wpg.user.46.165.242.75.POSTED!not-for-mail From: Fernando Oleo Blanco Newsgroups: comp.lang.ada Subject: Re: Help: Ada in NetBSD Date: Wed, 22 Sep 2021 22:05:59 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <646f270d-0e65-46a5-b40a-02afab608f1en@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: gioia.aioe.org; logging-data="18725"; posting-host="1h/B/1ghrB+3MK0iWL8Wpg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org"; User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.1 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.9.2 Xref: reader02.eternal-september.org comp.lang.ada:62817 List-Id: 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