Re: stat() on Windows might cause error if target file is larger than 4GB

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, "Higuchi, Daisuke" <higuchi(dot)daisuke(at)jp(dot)fujitsu(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: stat() on Windows might cause error if target file is larger than 4GB
Date: 2018-09-13 18:23:47
Message-ID: CA+TgmoY6BqkaLt5_P+FUOn=XDDBt94-VRuQ-XQ3WTaHYMovuag@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Sep 13, 2018 at 10:29 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> What I was vaguely imagining is that win32_port.h could #include
> whichever Windows header defines these functions and structs, and
> then do
>
> #define stat __stat64
>
> static inline ... __stat64(...) { return _stat64(...); }
>
> What would need testing is whether the #define has nasty side-effects
> even if we've already included the system header. I don't think it'd
> hurt, eg, local variables named "stat"; though people might be surprised
> when examining things in a debugger.

This, to me, seems way too clever. Replacing 'struct stat' with
something else everywhere in the code is more churn, but far less
likely to have surprising consequences down the road. Or so I would
think, anyway.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-09-13 18:34:07 Re: [HACKERS] Bug in to_timestamp().
Previous Message Alexander Korotkov 2018-09-13 18:19:47 Re: [HACKERS] Bug in to_timestamp().