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 1m0rlt-0007XH-2d for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Jul 2021 20:34:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m0rlq-0000o4-2e for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Jul 2021 20:34:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m0rlp-0000nw-RM for pgsql-hackers@lists.postgresql.org; Tue, 06 Jul 2021 20:34:17 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m0rln-0002Iy-Mh for pgsql-hackers@lists.postgresql.org; Tue, 06 Jul 2021 20:34:17 +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 166KY9HE1749831; Tue, 6 Jul 2021 16:34:09 -0400 From: Tom Lane To: Peter Eisentraut cc: Thomas Munro , Sandeep Thakkar , Dave Page , James Hilliard , David Steele , PostgreSQL Hackers , Sergey Shinderuk Subject: Re: [PATCH v3 1/1] Fix detection of preadv/pwritev support for OSX. In-reply-to: <6ac601c7-9a72-d354-cfaa-03a66108c778@enterprisedb.com> References: <20210122193230.25295-1-james.hilliard1@gmail.com> <2781003.1617083917@sss.pgh.pa.us> <6ac601c7-9a72-d354-cfaa-03a66108c778@enterprisedb.com> Comments: In-reply-to Peter Eisentraut message dated "Sat, 03 Jul 2021 13:38:53 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1749829.1625603649.1@sss.pgh.pa.us> Date: Tue, 06 Jul 2021 16:34:09 -0400 Message-ID: <1749830.1625603649@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Peter Eisentraut writes: > I think this change is perfectly appropriate (modulo some small cleanups). I think there are a couple of issues here. 1. People who are already using MACOSX_DEPLOYMENT_TARGET to control their builds would like to keep on doing so, but the AC_CHECK_FUNCS probe doesn't work with that. James' latest patch seems like a reasonable fix for that (it's a lot less invasive than where we started from). There is a worry about side-effects on other platforms, but I don't see an answer to that that's better than "throw it on the buildfarm and see if anything breaks". However ... 2. We'd really like to use preadv/pwritev where available. I maintain that MACOSX_DEPLOYMENT_TARGET is not only not the right approach to that, but it's actually counterproductive. It forces you to build for the lowest common denominator, ie the oldest macOS release you want to support. Even when running on a release that has pwritev, your build will never use it. As far as I can tell, the only way to really deal with #2 is to perform a runtime dlsym() probe to see whether pwritev exists, and then fall back to our src/port/ implementation if not. This does not look particularly hard (especially since the lookup code only needs to work on macOS), though I admit I've not tried to code it. What's unclear to me at the moment is whether #1 and #2 interact, ie is there still any point in changing configure's probes if we put in a runtime check on Darwin? I think that we might want to pay no attention to what the available header files say about pwritev, as long as we can get the correct 'struct iovec' declaration from them. regards, tom lane