Thomas Munro <thomas.munro@gmail.com> writes:
> On Thu, Jan 14, 2021 at 5:13 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Looks like we need to be more careful about not including pread.c
>> in the build unless it actually has code to contribute.
> I did it that way because it made it easy to test different
> combinations of the replacements on computers that do actually have
> pwrite and pwritev, just by tweaking pg_config.h. Here's an attempt
> to do it with AC_REPLACE_FUNCS, which avoids creating empty .o files.
> It means that to test the replacements on modern systems you have to
> tweak pg_config.h and also add the relevant .o files to LIBOBJS in
> src/Makefile.global, but that seems OK.
Yeah, this looks better. Two gripes, one major and one minor:
* You need to remove pread.o and pwrite.o from the hard-wired
part of the list in src/port/Makefile, else they get built
whether needed or not.
* I don't much like this in fd.h:
@@ -46,6 +46,7 @@
#include <dirent.h>
+struct iovec;
typedef int File;
because it makes it look like iovec and File are of similar
status, which they hardly are. Perhaps more like
#include <dirent.h>
+
+struct iovec; /* avoid including sys/uio.h here */
typedef int File;
I confirm clean builds on Big Sur and Catalina with this.
regards, tom lane