X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:message-id:date:from:mime-version:to:subject
	:references:in-reply-to:content-type:content-transfer-encoding;
	 q=dns; s=default; b=HiCaLfIOdZz1qSu0mjvxM+XN2ZdXEoxR9ndDHI5B7hD
	AIkg/hHI0N6eE/7b5tY5H2FWnXr2nkiKiGNQ00j3Pq+OZ/FIrNozSN4PMMScm+gE
	eVNNrcEc+HilNBaRP7C9tIAdsKnl1jL9Thmbya2O4D8HQcoqCS2n16VyVoeYvBKU
	=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:message-id:date:from:mime-version:to:subject
	:references:in-reply-to:content-type:content-transfer-encoding;
	 s=default; bh=qVIxh7f7GiIzkf/f+QYF1V4jzV0=; b=GQ54DUYrFlhpz3ecm
	MspkXx7SWLhgjtbvowjEZk4YlAWRHxPFUVBm/p9dH6uc08evyIWNSJXXUiD6kowB
	lTRxvjQrftIRt9N4DXo/8lxOvGvp8t0x+rKQ95j3z4FBa7OUv5vvGeIVUXbeQW6G
	+KClr7p+2SOwFHGUK7/ZiwB9Xs=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2
X-HELO: mail-wi0-f171.google.com
X-Received: by 10.180.210.195 with SMTP id mw3mr97458530wic.79.1419888880960;        Mon, 29 Dec 2014 13:34:40 -0800 (PST)
Message-ID: <54A1C8E0.40509@gmail.com>
Date: Mon, 29 Dec 2014 22:34:24 +0100
From: Marco Atzeri <marco.atzeri@gmail.com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0
MIME-Version: 1.0
To: Kenton Varda <kenton@sandstorm.io>, cygwin <cygwin@cygwin.com>
Subject: Re: bug: struct cmsghdr does not match system on cygwin64
References: <CAOP=4wh3i=gHtCTPwksmrP=3_aQTMiFw8_0Vg08hrCPg53m8fg@mail.gmail.com> <CAOP=4whbdcjsaSVzEbvvLhFhE5v210Y8CoXV+JGboank=mKsOw@mail.gmail.com>
In-Reply-To: <CAOP=4whbdcjsaSVzEbvvLhFhE5v210Y8CoXV+JGboank=mKsOw@mail.gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes

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

