Re: Isn't HANDLE 64 bits on Win64?

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org, Dave Page <dpage(at)pgadmin(dot)org>
Subject: Re: Isn't HANDLE 64 bits on Win64?
Date: 2010-11-16 15:15:56
Message-ID: AANLkTi=NPR60N3X8XNZ-fTd79pn0PHRJXi3YZpnjRnV0@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Nov 16, 2010 at 15:42, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Magnus Hagander <magnus(at)hagander(dot)net> writes:
>> On Tue, Nov 16, 2010 at 11:01, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
>>> So yes, it looks completely broken. I guess Windows doesn't actually
>>> *assign* you a handle larger than 2^32 until you actually ahve that
>>> many open handles. Typical values on my test system (win64) comes out
>>> at around 4000 in all tests.
>
>> Patch applied for this and backpatched to 9.0.
>
> I did a bit of googling and found some references claiming that Win64
> will never assign system handles that are outside the range
> representable as a signed long; and further stating there are standard
> macros HandleToLong and LongToHandle to perform those conversions.
> So I'd be comfortable with the original coding as long as we used those
> macros instead of random casting.  Dunno if you think that'd be cleaner
> than what you did.  (It's also a fair question whether those macros
> are available on Win32.)

The one I found was:
http://msdn.microsoft.com/en-us/library/aa384242(VS.85).aspx

Which only talks about pointers, though - but handles are pointers, in theory.

Do you still have a reference to the page that said they will never be
assigned that high? I can't even find the proper documentation for
those macros. I in the headers it looks like they'll be on Win32 -
whether they're in *mingw* is a different issue altogether of course.

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-11-16 15:16:49 Re: GCC vs clang
Previous Message Tom Lane 2010-11-16 15:09:18 Re: track_functions default