Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: mDNSResponder build failure on 64-bit platform (amd64)

On Oct 2,  3:59pm, (Martin Husemann) wrote:
-- Subject: Re: mDNSResponder build failure on 64-bit platform (amd64)

| On Fri, Oct 02, 2009 at 09:55:50AM -0400, Christos Zoulas wrote:
| > The code is written so that if the structure is not the right size,
| > the array size ends negative.
| Yes, but why would the size of the structure differ if unpacked?
| typedef packedstruct
|     {
|     uint32_t version;
|     uint32_t datalen;
|     uint32_t ipc_flags;
|     uint32_t op;                // request_op_t or reply_op_t
|     client_context_t client_context; // context passed from client, returned 
|     uint32_t reg_index;            // identifier for a record registered via 
|     // socket connected by DNSServiceConnect().  Must be unique in the scope 
|     // index/socket pair uniquely identifies a record.  (Used to select 
|     } ipc_msg_hdr;
| where 
| typedef packedunion
|     {
|     void *context;
|     uint32_t u32[2];
|     } client_context_t;
| I.e. the structure should be naturally aligned. What am I missing?

uint32_t reg_index; Since the struct needs to be 64 bit aligned it is expanded
by another uint32_t so that arrays of the struct work. Anyway, I taught lint
about __packed... So if you change the code to use __packed, and don't define
that away in the lint case in cdefs, it should just work.


Home | Main Index | Thread Index | Old Index