This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
resolv: How to use rhook
- From: Gary Johnson <garyjohn at spocom dot com>
- To: libc-help at sourceware dot org
- Date: Mon, 15 Apr 2013 10:51:38 -0700
- Subject: resolv: How to use rhook
I would like to use the _rev.rhook to instrument the resolver for
the purpose of determining the status of individual name servers.
I defined USE_HOOKS when glibc was built and set _rev.rhook in my
code to the address of a function with the appropriate signature.
However, when I call getaddrinfo(), my rhook function is not called
and upon return from getaddrinfo(), _rev.hook has been set to 0.
This seems to be because getaddrinfo() always indirectly executes
__res_vinit() which sets rhook to 0.
I'm using GNU C Library version 2.14.1. I didn't notice any
significant difference in the hook code in the source for version
2.17.
How is this hook intended to be used?
Regards,
Gary