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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: stat() on Windows might cause error if target file is larger than 4GB
Дата
Msg-id 11523.1536848984@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: stat() on Windows might cause error if target file is largerthan 4GB  (Michael Paquier <michael@paquier.xyz>)
Ответы Re: stat() on Windows might cause error if target file is larger than 4GB  (Robert Haas <robertmhaas@gmail.com>)
Re: stat() on Windows might cause error if target file is largerthan 4GB  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Список pgsql-hackers
Michael Paquier <michael@paquier.xyz> writes:
> On Wed, Sep 12, 2018 at 08:17:05PM -0400, Tom Lane wrote:
>> And we can't just "#define stat __stat64" because
>> that would break the calls to stat().  Or wait, maybe we could do that
>> and also have a one-liner function named __stat64 that would catch the
>> calls and redirect to _stat64?

> I don't think I grab your point here.  "#define stat __stat64" cannot
> exist from the start so how would you do that?

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.

            regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Avoid extra Sort nodes between WindowAggs when sorting can be reused
Следующее
От: Dilip Kumar
Дата:
Сообщение: Re: speeding up planning with partitions