pgsql: Fix our Windows stat() emulation to handle file sizes > 4GB.

2020-10-09 Thread Tom Lane
Fix our Windows stat() emulation to handle file sizes > 4GB.

Hack things so that our idea of "struct stat" is equivalent to Windows'
struct __stat64, allowing it to have a wide enough st_size field.

Instead of relying on native stat(), use GetFileInformationByHandle().
This avoids a number of issues with Microsoft's multiple and rather
slipshod emulations of stat().  We still need to jump through hoops
to deal with ERROR_DELETE_PENDING, though :-(

Pull the relevant support code out of dirmod.c and put it into
its own file, win32stat.c.

Still TODO: do we need to do something different with lstat(),
rather than treating it identically to stat()?

Juan José Santamaría Flecha, reviewed by Emil Iggland;
based on prior work by Michael Paquier, Sergey Zubkovsky, and others

Discussion: 
https://postgr.es/m/1803D792815FC24D871C00D17AE95905CF5099@g01jpexmbkw24
Discussion: https://postgr.es/m/[email protected]

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/bed90759fcbcd72d4d06969eebab81e47326f9a2

Modified Files
--
configure |   6 +
configure.ac  |   1 +
src/include/port/win32_port.h |  44 +--
src/port/dirmod.c |  52 
src/port/win32stat.c  | 299 ++
src/tools/msvc/Mkvcbuild.pm   |   2 +-
6 files changed, 339 insertions(+), 65 deletions(-)



pgsql: plperl.h should #undef fstat along with stat and lstat.

2020-10-09 Thread Tom Lane
plperl.h should #undef fstat along with stat and lstat.

Needed now that commit bed90759f caused win32_port.h to provide
a #define for that too.  Per buildfarm.

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/ed30b1a60dadf2b7cc58bce5009ad8676b8fe479

Modified Files
--
src/pl/plperl/plperl.h | 1 +
1 file changed, 1 insertion(+)