1. Enablement: The configure-time choice triggers the useful detection of the appropriate system header file, but otherwise it is harmful since it requires that all apps which use the hook macros and build against this copy of apr have the build infrastructure to handle the generated DTrace probes.
As there is limited benefit to a configure-time option and a big drawback and it affects only the code generated within applications at compile-time, those applications which want DTrace probes inside their hooks should have to define something at compile time to generate the probes. Call it APR_HOOK_PROBE_DTRACE for the moment. 2. Implementation: The OLD_DTRACE_PROBE, OLD_DTRACE_PROBE1, and OLD_DTRACE_PROBE2 macros in apr_hooks.h map indirectly to the system-provided DTRACE_PROBE() (and so on) hooks, though they are missing the generation of an appropriate function prototype; thus, we get compile warnings for the generated probe function names, since they have no prototype. I don't see any discussion to why the OLD_DTRACE... macros were created to mimic the DTRACE_PROBE... macros instead of doing something like this: #if enable-DTrace #define foo_DTRACE_PROBE(x,y) DTRACE_PROBE(x,y) ... #else #define foo_DTRACE_PROBE(x,y) ... #endif But I see that FreeBSD 7.1 has no DTRACE_PROBE... macros; perhaps that is why. (Leopard, Solaris 10, and OpenSolaris do.) 3. Applicability to other trace mechanisms: There isn't any unless you get APR_DTRACE_PROVIDER turned on but provide alternate implementations of OLD_DTRACE_PROBE... Even then, the invocation of OLD_DTRACE_PROBE... is specific to the particular generation of DTrace probe names; see the token pasting in the following: OLD_DTRACE_PROBE2(name##__dispatch__complete, (char *)pHook[n].szName, rv); --/-- I think we should push the DTrace detail out of APR and force the application to define APR_HOOK_PROBES_ENABLED as well as implementations of the APR_HOOK_PROBE-APR_HOOK_PROBE2 macros before including apr_hooks.h. Imagine ap_hooks.h with DTrace enabled in httpd: #if AP_ DTrace hook probes #include <sys/sdt.h> #define APR_HOOK_PROBES_ENABLED #define APR_HOOK_PROBE(namespace, name, mode) \ DTRACE_PROBE(namespace, name##mode) /* or something like that */ ... #endif #include "apr_hooks.h" I'll change the hook [D]trace support Real Soon now along these lines, before the apr-util 1.4.x API is frozen.
