Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZyJf-0007Bd-Mi for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 10:43:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZyJe-0005DN-OX for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 10:43:22 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZyIH-0003iH-NC for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 10:41:57 +0000 Received: from ping.uio.no ([2001:700:100:570::196]) by makus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZyI9-0000tt-Ot for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 10:41:56 +0000 Received: from [2001:700:100:570::211] (helo=dalvik.ping.uio.no ident=Debian-exim) by ping.uio.no with esmtp (Exim 4.72 #1 (Debian)) id 1bZyI0-0006ol-V2; Wed, 17 Aug 2016 12:41:43 +0200 Received: from ilmari by dalvik.ping.uio.no with local (Exim 4.72) (envelope-from ) id 1bZyI0-00013A-DD; Wed, 17 Aug 2016 12:41:40 +0200 From: ilmari@ilmari.org (Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?=) To: Magnus Hagander Cc: Victor Wagner , PostgreSQL-development Subject: Re: Use pread and pwrite instead of lseek + write and read References: <20160817123437.44f3f60a@fafnir.local.vm> Mail-Copies-To: nobody Date: Wed, 17 Aug 2016 11:41:40 +0100 In-Reply-To: (Magnus Hagander's message of "Wed, 17 Aug 2016 12:17:35 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Exiscan-Spam-Score: -3.7 (---) X-Exiscan-Spam-Report: SpamAssassin 3.3.1 (2010-03-16) on pike.ping.uio.no Score Rule * -5.0 PING_UIO_MAIL_IS_INTERNAL Message has never been outside * 129.240.0.0/16 or 193.157.115.0/24 * 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Pg-Spam-Score: -4.2 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Magnus Hagander writes: [pread/pwrite] > Yeah, Windows does not have those API calls, but it shouldn't be rocket > science to write a wrapper for it. The standard windows APIs can do the > same thing -- but they'll need access to the HANDLE for the file and not > the posix file descriptor. > > It also has things like ReadFileScatter() ( > https://msdn.microsoft.com/en-us/library/windows/desktop/aa365469(v=vs.85).aspx) > which is not the same, but might also be interesting as a future > improvement. That looks a lot like POSIX readv() (http://pubs.opengroup.org/onlinepubs/9699919799/functions/readv.html), and as far as I can tell it has the same issue as it in that it doesn't take an offset argument, but requires you to seek first. Linux and modern BSDs however have preadv() (http://manpages.ubuntu.com/manpages/xenial/en/man2/preadv.2.html), which takes an offset and an iovec array. I don't know if Windows and other platforms have anything similar. -- - Twitter seems more influential [than blogs] in the 'gets reported in the mainstream press' sense at least. - Matt McLeod - That'd be because the content of a tweet is easier to condense down to a mainstream media article. - Calle Dybedahl -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers