Re: Supporting huge pages on Windows

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Supporting huge pages on Windows
Date: 2017-04-03 04:49:06
Message-ID: CAB7nPqSO95nhu4rS=+oe4B51YAPSA4H7juB8=z1omuU6gx6UPQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Apr 3, 2017 at 1:12 PM, Tsunakawa, Takayuki
<tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com> wrote:
> From: pgsql-hackers-owner(at)postgresql(dot)org
>> [mailto:pgsql-hackers-owner(at)postgresql(dot)org] On Behalf Of Amit Kapila
>> You should use %zu instead of %llu to print Size type of variable.
>
> I did so at first, but it didn't work with Visual Studio 2010 at hand. It doesn't support %z which is added in C99.
>
> But "I" (capital i) instead of "ll" seems appropriate as the following page says. I chose this.
>
> https://en.wikipedia.org/wiki/Printf_format_string
>
> I For signed integer types, causes printf to expect ptrdiff_t-sized integer argument; for unsigned integer types, causes printf to expect size_t-sized integer argument. Commonly found in Win32/Win64 platforms.

+ elog(DEBUG1, "CreateFileMapping(%Iu) with
SEC_LARGE_PAGES failed "
+ "due to insufficient large pages, huge pages disabled",
+ size);
Amit is right, you had better use %zu as we do in all the other places
of the code dealing with Size variables that are printed. When
compiling with Visual Studio, Postgres falls back to the
implementation of sprintf in src/port/snprintf.c so that's not
something to worry about.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2017-04-03 04:52:11 Re: Documentation improvements for partitioning
Previous Message Tsunakawa, Takayuki 2017-04-03 04:23:32 Re: [bug fix] Savepoint-related statements terminates connection