This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libresolv with getaddrinfo

On 14/03/15 05:43, Carlos O'Donell wrote:
>> > Would that be what res_init() is for?
> That function is intended to initialize the internals of the resolver.
> That isn't what you're interested in doing though. You want to alter
> the internals, and those internals might change. You have no option
> but to keep modifying your code and recompiling if the internals of _res
> change.
I meant, run res_init() before we alter the internals.
Based on what you've said later on in this email, should I be doing
res_init(), then running  __res_vinit() manually?

> How are you overwriting _res? Are you following the same rules glibc
> follows internally to avoid reinitializing?

I'm simply doing this:

|inet_pton(AF_INET, ||""||, &server); |
|serverSock.sin_family = AF_INET;|
|s||erverSock.sin_port = htons(53);|
|serverSock.sin_addr = server;|
|_res.nscount = 1;|
|_res.nsaddr_list[0] = serverSock;


> Every call to every function may reinitialize _res if certain rules
> are not followed. Those rules are documented in __res_maybe_init() function.
Do you mean actually documented? Or just you can work it out by reading
the code. If the former, could you link me to the documentation?

-- Joshua Rogers <>

Attachment: signature.asc
Description: OpenPGP digital signature

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]