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