netdev
[Top] [All Lists]

Re: socklen_t instead of size_t in struct cmsghdr

To: kuznet@xxxxxxxxxxxxx
Subject: Re: socklen_t instead of size_t in struct cmsghdr
From: Jakub Jelinek <jakub@xxxxxxxxxx>
Date: Mon, 2 Oct 2000 22:01:55 +0200
Cc: jakub@xxxxxxxxxx, davem@xxxxxxxxxx, ak@xxxxxx, netdev@xxxxxxxxxxx
In-reply-to: <200010021932.XAA25328@ms2.inr.ac.ru>; from kuznet@ms2.inr.ac.ru on Mon, Oct 02, 2000 at 11:32:42PM +0400
References: <20001002120349.L9588@sunsite.ms.mff.cuni.cz> <200010021932.XAA25328@ms2.inr.ac.ru>
Reply-to: Jakub Jelinek <jakub@xxxxxxxxxx>
Sender: owner-netdev@xxxxxxxxxxx
On Mon, Oct 02, 2000 at 11:32:42PM +0400, kuznet@xxxxxxxxxxxxx wrote:
> Hello!
> 
> > Would it be possible to change
> 
> I apologize, I have just remembered one thing.
> 
> __ ALIGNMENT! __
> 
> cmsghdr is aligned differently on 64bit and 32bit architectures,
> so that you have to do real convertor for ultra in any case. :-(

Yes, but the different alignment is because of the 64bit type in struct
cmsghdr.
If you have struct { int a; int b; int c; } then it has the same sizeof and
alignment on 32bit and 64bit, and AFAIK all cmsg payloads don't need
32<->64bit translation (at least from DaveM's comments in the cmsg32
translation code, only SCM_RIGHTS and SCM_CREDENTIALS are done specially
there and one of those is array of int, the other is struct with 3 u32),
which means they have the same alignment as well.

        Jakub

<Prev in Thread] Current Thread [Next in Thread>