apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@gmail.com>
Subject [PATCH] tweak to the tracing capability in apr hook macros -- apr 1.4.x API change
Date Thu, 10 Feb 2011 15:25:26 GMT
Currently the hook function arguments aren't available to the probe
macros.  This patch adds it.  The function args are available within
the hook macros only with surrounding parens, so that is how they must
be passed to the probe macros.

The args are usable by probe macros only with some restrictions.
Consider this example probe macro that tries to call a function with
the hook arguments:

#define APR_HOOK_PROBE_INVOKE(ud,ns,name,src,args) \
    ap_hook_probe_invoke(ud, #name, src, ap_hook_probe_arg1 args)

const void *ap_hook_probe_arg1(const void *arg1, ...);

This fails to even compile with hooks which have no arguments since
variable args only work with functions which have at least one
argument.  It won't compile cleanly with hooks that don't take a
pointer as the first argument.  Additional parameters (such as the
hook name) can't be passed earlier in the parameter list.  Thus, for
something like httpd with a variety of hook signatures and no common
theme, there are a couple of layers of unhappiness in trying to use
the args across the board (i.e., leaving the probe macros defined for
all hooks).  I blame the C preprocessor :)  (I never thought I'd miss
the PL/X macro language.)

Still, there's no need to prevent access since it can be used in some
limited circumstances.

I'll commit unless I hear objections soonish.  If someone is
interested in the issue and has time to try to attack the limitations
(which might mean a different apr_hooks patch), raise an objection ;)
I suspect that no one else cares.

Mime
View raw message