On Jul 18, 2012, at 8:05 AM, Chris Cleeland <chris.cleel...@gmail.com> wrote:

> 
> 
> On Tue, Jul 17, 2012 at 6:59 PM, Glyph <gl...@twistedmatrix.com> wrote:
> 
> On Jul 17, 2012, at 1:04 AM, Fredrik Unger <f...@tree.se> wrote:
> 
>> One problem could be socklen_t. Linux uses size_t [1].
> 
> The compiler should know, at this point in the code, that msg_controllen is a 
> size_t, which is to say, uint64, and ((socklen_t) all_data_len) is a 
> socklen_t, which is to say, int32.  So the cast is valid.  (Doing funky stuff 
> with & might not be, depending on the type specifiers in question.)
> 
> Wasn't the code originally discussed written in python, though, and used 
> "pack" to synthesize a struct?  If that's the case, then the pack spec would 
> be assuming a specific layout and type size.  It probably is correct in the 
> 32 bit case, but not in the 64 bit case.

The 'pack' is being used to synthesize a single value - a file descriptor - not 
a struct.  It's using the 'i' format character, which should be native 
byte-order, native size, native alignment, so that should all be right.  I just 
spent a little while looking at the documentation here for *linux*'s CMSG_* 
macros though, and I see there is some non-standard extension, CMSG_ALIGN, 
which is not terribly well explained.  Maybe some 64-bit linuxes are sensitive 
to alignment and some aren't?  I'm frankly somewhat baffled.

-glyph
_______________________________________________
calendarserver-users mailing list
calendarserver-users@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo/calendarserver-users

Reply via email to