This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: bug: struct cmsghdr does not match system on cygwin64
- From: Marco Atzeri <marco dot atzeri at gmail dot com>
- To: Kenton Varda <kenton at sandstorm dot io>, cygwin <cygwin at cygwin dot com>
- Date: Mon, 29 Dec 2014 22:34:24 +0100
- Subject: Re: bug: struct cmsghdr does not match system on cygwin64
- Authentication-results: sourceware.org; auth=none
- References: <CAOP=4wh3i=gHtCTPwksmrP=3_aQTMiFw8_0Vg08hrCPg53m8fg at mail dot gmail dot com> <CAOP=4whbdcjsaSVzEbvvLhFhE5v210Y8CoXV+JGboank=mKsOw at mail dot gmail dot com>
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