Re: pread() and pwrite() - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: pread() and pwrite()
Date
Msg-id 6cc7c8dd-29f9-7d75-d18a-99f19c076d10@iki.fi
Whole thread Raw
In response to Re: pread() and pwrite()  (Thomas Munro <thomas.munro@enterprisedb.com>)
Responses Re: pread() and pwrite()  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 20/07/18 01:50, Thomas Munro wrote:
> An idea for how to handle Windows, in a follow-up patch: add a file
> src/backend/port/win32/file.c that defines pgwin32_pread() and
> pgwin32_pwrite(), wrapping WriteFile()/ReadFile() and passing in an
> "OVERLAPPED" struct with the offset and sets errno on error, then set
> up the macros so that Windows can use them as pread(), pwrite().  It
> might also be necessary to open all files with FILE_FLAG_OVERLAPPED.
> Does any Windows hacker have a bettter idea, and/or want to try to
> write that patch?  Otherwise I'll eventually try to do some long
> distance hacking on AppVeyor.

No objections, if you want to make the effort. But IMHO the lseek+read 
fallback is good enough on Windows. Unless you were thinking that we 
could then remove the !HAVE_PREAD fallback altogether. Are there any 
other platforms out there that don't have pread/pwrite that we care about?

- Heikki


pgsql-hackers by date:

Previous
From: Nikhil Sontakke
Date:
Subject: Re: [HACKERS] logical decoding of two-phase transactions
Next
From: Oskari Saarenmaa
Date:
Subject: Re: pread() and pwrite()