> Date: Thu, 26 Dec 2013 18:48:06 +0100 > From: Eric Faurot <e...@faurot.net> > > On Thu, Dec 26, 2013 at 06:28:33PM +0100, Mark Kettenis wrote: > > > Date: Thu, 26 Dec 2013 18:02:55 +0100 > > > From: Eric Faurot <e...@faurot.net> > > > > > > +/* > > > + * This is the structure through which async_run() returns async > > > + * results to the caller. > > > + */ > > > +struct async_res { > > > + int ar_cond; > > > + int ar_fd; > > > + int ar_timeout; > > > + > > > + int ar_errno; > > > + int ar_h_errno; > > > + int ar_gai_errno; > > > + int ar_rrset_errno; > > > + > > > + int ar_count; > > > + > > > + int ar_rcode; > > > + void *ar_data; > > > + int ar_datalen; > > > + union { > > > + struct sockaddr sa; > > > + struct sockaddr_in sain; > > > + struct sockaddr_in6 sain6; > > > + } ar_sa; > > > + > > > + struct addrinfo *ar_addrinfo; > > > + struct rrsetinfo *ar_rrsetinfo; > > > + struct hostent *ar_hostent; > > > + struct netent *ar_netent; > > > +}; > > > > Do you really want to make this structure part of the public API? > > Well, this is the structure through which the result is returned to > the caller. Different fields are used, depending on the actual query. > So if we don't want to have a big (ugly?) structure like this, we have > to introduce different flavors of asr_async_run_{gai,host}() for the > various cases, to make it "feel cleaner". Or maybe there is another > solution? use an union? I don't know.
Dunno. It just appeared to me as if this was more like an internal data structure. As long as you realize that this now becomes part of the API and ABI and that this severely restricts the changes you can make in the future, you should be fine.