Re: Oh dear. I regret to inform you that commit 0e65dfbaf3a0299e4837216a103c28625d4b4f1d might be unfortunate

Nick Alcock
2019-05-29T14:18:40Z

On 29 May 2019, Rainer Orth uttered the following:

> Nix <nix@esperi.org.uk> writes:
>> Does Solaris seriously not have this header? It's in Illumos, but I
>> guess it's a later addition...
>
> As even the Linux htole64(3) man page notes, this stuff is highly
> unportable:

I've implemented my own in terms of swap.h. It was only about five
lines. :)

>> OK, I'll have to reimplement it (using qsort() would massively uglify
>> the code).
>
> The gnulib docs for qsort_r gives

... and I've taken an implementation from gnulib. This seems to be an
acceptable source for this stuff. (I'd change it to use globals instead,
but it would be going in the opposite direction to the one I'd like to
go in, of increasing threadsafety, since the linker plugin might end up
multithreading if it turns out that parallelization helps.)

>>> /vol/src/gnu/gdb/hg/master/local/libctf/ctf-create.c:1352:24: warning:
>>> implicit declaration of function 'MAX' [-Wimplicit-function-declaration]
>>> 1352 | off = roundup (off, MAX (malign, 1));
>>> | ^~~
>>
>> Augh, roundup() is a glibc-specific extension? (But this is as old as
>> the import from Solaris, so it was clearly a Solaris extension once,
>> too.)
>
> On Solaris, it lives in <sys/sysmacros.h>, but even in /usr/include it's
> almost exclusively used in lowlevel system headers (<nfs/*.h>, <vm/*.h>,
> <sys/*.h>).

Honestly it's a one-liner. Easy enough to reimplement. :)

(And part of the portability push for this many years ago did indeed
strip out a reference to <sys/sysmacros.h>. All is explained.)

Testing a fix for all of these annoying problems now. Sorry to spoil your
day with broken builds :(