Re: Loaded footgun open_datasync on Windows
Laurenz Albe <laurenz.albe@cybertec.at>
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Kuntal Ghosh <kuntalghosh.2007@gmail.com>, Amit Kapila <amit.kapila16@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2018-06-20T14:06:57Z
Lists: pgsql-hackers
Attachments
- 0001-Use-pgwin32_open-in-frontend-code-on-Windows.patch (text/x-patch) patch 0001
Kuntal Ghosh wrote: [pg_test_fsync doesn't use pgwin32_open and hence doesn't respect O_DSYNC] > On Wed, Jun 6, 2018 at 2:39 PM, Amit Kapila <amit.kapila16@gmail.com> wrote: > > On Wed, Jun 6, 2018 at 10:18 AM, Michael Paquier <michael@paquier.xyz> wrote: > > > On Wed, Jun 06, 2018 at 09:58:34AM +0530, Amit Kapila wrote: > > > > One another alternative could be that we > > > > define open as pgwin32_open (for WIN32) wherever we need it. > > > > > > Which is what basically happens on any *nix platform, are you foreseeing > > > anything bad here? > > > > Nothing apparent, but I think we should try to find out why at the first > > place this has been made backend specific. > > It seems the "#ifndef FRONTEND" restriction was added around > pgwin32_open() for building libpq with Visual C++ or Borland C++. The > restriction was added in commit 422d4819 to build libpq with VC++[1]. > Later, in commit fd7c3f67e0bc4, the support for Borland C++ was also > added. > > So, I'm not sure whether removing that restriction will work for all > front-end modules. Thanks for the research, and sorry for my long silence. If I remove the "#ifndef FRONTEND", building with MSVC fails for all call sites that use the two-argument version of open(2). If I use the three-argument version throughout, which should be no problem, PostgreSQL builds just fine with MSVC. How about checking what the buildfarm thinks about the attached? Yours, Laurenz Albe
Commits
-
Allow concurrent-safe open() and fopen() in frontend code for Windows
- f02259fe93e7 11.0 landed
- 0ba06e0bfb8c 12.0 landed
-
Fix inclusions of c.h from .h files.
- a72f0365db41 10.0 cited
-
Allow borland compiles.
- fd7c3f67e0bc 8.0.0 cited
-
Corrects issues recently posted by Dann Corbit, allowing libpq/psql to
- 422d4819ee7c 8.0.0 cited