Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kzmjL-0005Oz-D4 for pgsql-hackers@arkaria.postgresql.org; Wed, 13 Jan 2021 20:26:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kzmjI-0003xI-Dj for pgsql-hackers@arkaria.postgresql.org; Wed, 13 Jan 2021 20:26:56 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kzmjI-0003xA-7C for pgsql-hackers@lists.postgresql.org; Wed, 13 Jan 2021 20:26:56 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kzmjB-0005rZ-Or for pgsql-hackers@postgresql.org; Wed, 13 Jan 2021 20:26:55 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 10DKQjaG1305814; Wed, 13 Jan 2021 15:26:45 -0500 From: Tom Lane To: Thomas Munro cc: Sergey Shinderuk , pgsql-hackers Subject: Re: pg_preadv() and pg_pwritev() In-reply-to: References: <341497.1608420857@sss.pgh.pa.us> <20201220224040.evr5pduibvm6dze5@alap3.anarazel.de> <448b3cb5-0ba0-6dc5-63c7-789e4eebc40b@postgrespro.ru> <1283127.1610554395@sss.pgh.pa.us> Comments: In-reply-to Thomas Munro message dated "Thu, 14 Jan 2021 08:52:04 +1300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1305812.1610569605.1@sss.pgh.pa.us> Date: Wed, 13 Jan 2021 15:26:45 -0500 Message-ID: <1305813.1610569605@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Thomas Munro writes: > On Thu, Jan 14, 2021 at 5:13 AM Tom Lane 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 +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 + +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