bug: struct cmsghdr does not match system on cygwin64

Marco Atzeri marco.atzeri@gmail.com
Mon Dec 29 21:34:00 GMT 2014


On 12/29/2014 9:48 PM, Kenton Varda wrote:
> Marco Atzeri wrote:
>> If I am not wrong, for 64bit,
>> on windows sizeof (SIZE_T) =4
>> while on cygwin sizeof(size_t)=8
>
> sizeof(SIZE_T) == 8 on Win64. The purpose of SIZE_T is to be the same
> size as a pointer:
>    http://msdn.microsoft.com/en-us/library/cc441980.aspx
>
> To be clear, I am actually observing everything after cmsg_len being
> shifted 4 bytes in real code that works on other platforms.
> Specifically, the Cap'n Proto unit tests fail on Cygwin but pass on
> Linux and OSX after this commit:
>    https://github.com/kentonv/capnproto/commit/68ad32202ed43e42a15de3da90a86b7efdcf8f12

the 4 byte shift is likely due to

SIZE_T -> ULONG_PTR -> unsigned __int3264

http://msdn.microsoft.com/en-us/library/cc441980.aspx
http://msdn.microsoft.com/en-us/library/cc230394.aspx
http://msdn.microsoft.com/en-us/library/gg241169.aspx

2.2.1 __int3264

An alias that is resolved to either:

     An __int32 in a 32-bit translation and execution environment, or

     An __int64 in a 64-bit translation and execution environment. For 
backward compatibility, it is 32-bit on the wire. The higher 4 bytes 
MUST be truncated on the sender side during marshaling and MUST be 
extended appropriately (signed or unsigned), as specified in [C706] 
section 14.2.5, on the receiving side during unmarshaling.


> -Kenton
Marco


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list