[Spice-devel] [PATCH spice-streaming-agent v5 2/2] Implement handling of error messages from the server
Christophe Fergeau
cfergeau at redhat.com
Tue Mar 6 08:37:04 UTC 2018
On Mon, Mar 05, 2018 at 05:58:15PM +0100, Christophe de Dinechin wrote:
> > Perhaps you lost the mails saying that the protocol structure don't and won't have internal padding.
>
> Only on x86. It has padding on any ABI with a natural 64-bit alignment.
>
> I don’t have an Itanium handy, but computing the offsetof(msg.msg) and
> offsetof(msg.StreamNotifyError::msg) on a Raspberry Pi using
> -mstructure-size-boundary=64 yields:
>
> offsetof msg.msg=8
> offsetof msg.StreamNotifyError::msg=4
For what it's worth, at the moment stream-device.h expects that its
struct members are going to be "naturally aligned", ie that struct
members are aligned to a multiple of their size in byte within the
struct. This seems to be the case with the ABIs/arch we are interested
in. If there is a real-world ABI which does not match this, then we'll
indeed need to adapt stream-device.h assumptions.
The rest of spice-protocol is using __attribute__("packed"). The
disadvantage with that is that you have to do some manual handling of
unaligned accesses on some arches (older 32 bits ARM come to mind).
Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20180306/d9403039/attachment.sig>
More information about the Spice-devel
mailing list