Hello,
I wonder how much dead code for ancient operating systems we could now
drop. Here are some easier cases, I think, and one tricky one that
might take some debate. I think it makes a lot of sense to say that
we expect at least POSIX-1:2001, because that corresponds to C99, with
the thread option because every targeted system has that.
0001-Remove-dead-pg_pread-and-pg_pwrite-replacement-code.patch
0002-Remove-dead-getrusage-replacement-code.patch
0003-Remove-dead-setenv-unsetenv-replacement-code.patch
0004-Remove-dead-handling-for-pre-POSIX-sigwait.patch
0005-Remove-dead-getpwuid_r-replacement-code.patch
0006-Remove-disable-thread-safety.patch
Clearly there is more stuff like this (eg more _r functions, they're
just a touch more complicated), but this is a start. I mention these
now in case it's helpful for the Meson work, and just generally
because I wanted to clean up after the retirement of ancient HP-UX.
The threads patch probably needs more polish and is extracted from
another series I'll propose in a later CF to do some more constructive
work on threads where it'd be helpful not to have to deal with 'no
threads' builds, but I figured it could also pitch this part along
with the other basic POSIX modernisation stuff.
I pulled the configure output from the oldest releases of each
supported target OS, namely:
* hornet, AIX 7.1
* wrasse, Solaris 11.3
* pollock, illumos rolling
* loach, FreeBSD 12.2
* conchuela, DragonflyBSD 6.0
* morepork, OpenBSD 6.9
* sidewinder, NetBSD 9.2
* prairiedog, macOS 10.4 (vintage system most likely to cause problems)
* clam, Linux 3.10/RHEL 7
* fairiewren, Windows/Mingw with configure
I checked for HAVE_PREAD HAVE_PWRITE HAVE_GETRUSAGE HAVE_SETENV
HAVE_UNSETENV HAVE_GETPWUID_R, and the only missing ones were:
HAVE_PREAD is missing on windows
HAVE_PWRITE is missing on windows
HAVE_GETRUSAGE is missing on windows
HAVE_GETPWUID_R is missing on windows
We either have completely separate code paths or replacement functions
for these.
The pwritev/preadv functions are unfortunately not standardised by
POSIX (I dunno why, it's the obvious combination of the p* and *v
functions) despite every OS in the list having them except for Solaris
and old macOS. Oh well.