Subject: Re: in-kernel workaround for PR 14746
To: None <email@example.com, firstname.lastname@example.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
Date: 12/03/2001 16:46:01
>> Is struct assignment even _supposed_ to work?
> AFAIK, it's part of C90, and perhaps earlier standards.
I guess I was a little too elliptical.
I meant not "is struct assignment supposed to work between two structs"
but rather "is the definition of SIOCGIFCONF and related things such
that struct assignment is supposed to work to copy the embedded
structs", which more or less amounts to, "is every embedded struct
guaranteed to be at a suitable alignment boundary relative to the
beginning of the memory block". However, even that only pushes the
problem off to userland, requiring userland to somehow divine what
alignment the memory block has to have. (With gcc and __aligned__ and
__alignof__, this is fairly easy; without gcc, I think the only way to
get a suitably aligned block is malloc().)
I note that the kernel uses the equivalent of bcopy to put stuff into
the memory area userland supplies. (Well, it uses copyout. There's no
copyout-alike for struct assignment, so this may mean nothing.)
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML email@example.com
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B