apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject svn commit: r891848 - in /apr/apr-util/branches/1.4.x: CHANGES STATUS configure.in include/apr_hooks.h
Date Thu, 17 Dec 2009 19:15:20 GMT
Author: trawick
Date: Thu Dec 17 19:15:19 2009
New Revision: 891848

URL: http://svn.apache.org/viewvc?rev=891848&view=rev
Log:
merge r891269 from apr trunk
(other than changes to the hook test program, which doesn't exist
in the apr-util branches)

replace --enable-dtrace and corresponding DTrace-specific hook
probes with a general purpose facility that can be used with DTrace
or most anything else

no probe implementation, DTrace or otherwise, is provided with APR[-Util]

Modified:
    apr/apr-util/branches/1.4.x/CHANGES
    apr/apr-util/branches/1.4.x/STATUS
    apr/apr-util/branches/1.4.x/configure.in
    apr/apr-util/branches/1.4.x/include/apr_hooks.h

Modified: apr/apr-util/branches/1.4.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.4.x/CHANGES?rev=891848&r1=891847&r2=891848&view=diff
==============================================================================
--- apr/apr-util/branches/1.4.x/CHANGES [utf-8] (original)
+++ apr/apr-util/branches/1.4.x/CHANGES [utf-8] Thu Dec 17 19:15:19 2009
@@ -22,8 +22,9 @@
      access to basic crypto using the native crypto libraries present on
      each platform.  [Graham Leggett]
 
-  *) Add DTrace Probes to Hooks, making it easier to inspect APR Hook based
-     applications with DTrace. [Theo Schlossnagle <jesus omniti.com>]
+  *) Add trace probes to hooks, making it easier to inspect APR Hook based
+     applications with DTrace or other such mechanisms.
+     [Theo Schlossnagle <jesus omniti.com>, generalized by Jeff Trawick]
 
   *) Implement resource list when threads are unavailable. PR 24325
      [Bojan Smojver]

Modified: apr/apr-util/branches/1.4.x/STATUS
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.4.x/STATUS?rev=891848&r1=891847&r2=891848&view=diff
==============================================================================
--- apr/apr-util/branches/1.4.x/STATUS [utf-8] (original)
+++ apr/apr-util/branches/1.4.x/STATUS [utf-8] Thu Dec 17 19:15:19 2009
@@ -57,11 +57,6 @@
 
 RELEASE SHOWSTOPPERS:
 
-    * Resolve hook probe support; current APR-Util 1.4.0-dev has only the
-      --enable-dtrace configure option which can't be used in a general
-     purpose build of APR-Util.  See this thread:
-       http://www.mail-archive.com/dev@apr.apache.org/msg22534.html
-
 RELEASE NON-SHOWSTOPPERS BUT WOULD BE REAL NICE TO WRAP THESE UP:
 
     * Solaris's Sun Freeware (sfw) package has a busted gcc/ld setup.

Modified: apr/apr-util/branches/1.4.x/configure.in
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.4.x/configure.in?rev=891848&r1=891847&r2=891848&view=diff
==============================================================================
--- apr/apr-util/branches/1.4.x/configure.in (original)
+++ apr/apr-util/branches/1.4.x/configure.in Thu Dec 17 19:15:19 2009
@@ -165,22 +165,6 @@
 APU_FIND_EXPAT
 APU_FIND_ICONV
 
-AC_CHECK_HEADERS( \
-sys/sdt.h
-)
-
-AC_ARG_ENABLE(dtrace,APR_HELP_STRING(--enable-dtrace, Enable DTrace probes),
-[
-  enable_dtrace=$enableval
-],
-[
-  enable_dtrace=no
-])
-
-if test $enable_dtrace = "yes" -a "$ac_cv_header_sys_sdt_h" = "yes"; then
-    APR_ADDTO(CPPFLAGS, -DAPR_DTRACE_PROVIDER)
-fi
-
 dnl Enable DSO build; must be last:
 APU_CHECK_UTIL_DSO
 

Modified: apr/apr-util/branches/1.4.x/include/apr_hooks.h
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.4.x/include/apr_hooks.h?rev=891848&r1=891847&r2=891848&view=diff
==============================================================================
--- apr/apr-util/branches/1.4.x/include/apr_hooks.h (original)
+++ apr/apr-util/branches/1.4.x/include/apr_hooks.h Thu Dec 17 19:15:19 2009
@@ -21,23 +21,6 @@
 /* For apr_array_header_t */
 #include "apr_tables.h"
 
-#ifdef APR_DTRACE_PROVIDER
-#include <sys/sdt.h>
-#ifndef OLD_DTRACE_PROBE
-#define OLD_DTRACE_PROBE(name) __dtrace_ap___##name()
-#endif
-#ifndef OLD_DTRACE_PROBE1
-#define OLD_DTRACE_PROBE1(name,a) __dtrace_ap___##name(a)
-#endif
-#ifndef OLD_DTRACE_PROBE2
-#define OLD_DTRACE_PROBE2(name,a,b) __dtrace_ap___##name(a,b)
-#endif
-#else
-#define OLD_DTRACE_PROBE(a)
-#define OLD_DTRACE_PROBE1(a,b)
-#define OLD_DTRACE_PROBE2(a,b,c)
-#endif
-
 /**
  * @file apr_hooks.h
  * @brief Apache hook functions
@@ -51,6 +34,74 @@
  * @ingroup APR_Util
  * @{
  */
+
+/**
+ * @defgroup apr_hook_probes Hook probe capability
+ * APR hooks provide a trace probe capability for capturing
+ * the flow of control and return values with hooks.
+ *
+ * In order to use this facility, the application must define
+ * the symbol APR_HOOK_PROBES_ENABLED and the four APR_HOOK_PROBE_
+ * macros described below before including apr_hooks.h in files
+ * that use the APR_IMPLEMENT_EXTERNAL_HOOK_* macros.
+ *
+ * This probe facility is not provided for APR optional hooks.
+ * @{
+ */
+
+#ifdef APR_HOOK_PROBES_ENABLED
+#define APR_HOOK_INT_DCL_UD void *ud = NULL
+#else
+/** internal implementation detail to avoid the ud declaration when
+ * hook probes are not used
+ */
+#define APR_HOOK_INT_DCL_UD
+/**
+ * User-defined hook probe macro that is invoked when the hook
+ * is run, before calling any hook functions.
+ * @param ud A void * user data field that should be filled in by
+ * this macro, and will be provided to the other hook probe macros.
+ * @param ns The namespace prefix of the hook functions
+ * @param name The name of the hook
+ */
+#define APR_HOOK_PROBE_ENTRY(ud,ns,name)
+/**
+ * User-defined hook probe macro that is invoked after the hook
+ * has run.
+ * @param ud A void * user data field that was filled in by the user-
+ * provided APR_HOOK_PROBE_ENTRY().
+ * @param ns The namespace prefix of the hook functions
+ * @param name The name of the hook
+ * @param rv The return value of the hook, or 0 if the hook is void.
+ */
+#define APR_HOOK_PROBE_RETURN(ud,ns,name,rv)
+/**
+ * User-defined hook probe macro that is invoked before calling a
+ * hook function.
+ * @param ud A void * user data field that was filled in by the user-
+ * provided APR_HOOK_PROBE_ENTRY().
+ * @param ns The namespace prefix of the hook functions
+ * @param name The name of the hook
+ * @param src The value of apr_hook_debug_current at the time the function
+ * was hooked (usually the source file implementing the hook function).
+ */
+#define APR_HOOK_PROBE_INVOKE(ud,ns,name,src)
+/**
+ * User-defined hook probe macro that is invoked before calling a
+ * hook function.
+ * @param ud A void * user data field that was filled in by the user-
+ * provided APR_HOOK_PROBE_ENTRY().
+ * @param ns The namespace prefix of the hook functions
+ * @param name The name of the hook
+ * @param src The value of apr_hook_debug_current at the time the function
+ * was hooked (usually the source file implementing the hook function).
+ * @param rv The return value of the hook function, or 0 if the hook is void.
+ */
+#define APR_HOOK_PROBE_COMPLETE(ud,ns,name,src,rv)
+#endif
+
+/** @} */
+
 /** macro to return the prototype of the hook function */    
 #define APR_IMPLEMENT_HOOK_GET_PROTO(ns,link,name) \
 link##_DECLARE(apr_array_header_t *) ns##_hook_get_##name(void)
@@ -123,21 +174,22 @@
     { \
     ns##_LINK_##name##_t *pHook; \
     int n; \
+    APR_HOOK_INT_DCL_UD; \
 \
-    OLD_DTRACE_PROBE(name##__entry); \
+    APR_HOOK_PROBE_ENTRY(ud, ns, name); \
 \
     if(_hooks.link_##name) \
         { \
         pHook=(ns##_LINK_##name##_t *)_hooks.link_##name->elts; \
         for(n=0 ; n < _hooks.link_##name->nelts ; ++n) \
             { \
-            OLD_DTRACE_PROBE1(name##__dispatch__invoke, (char *)pHook[n].szName); \
+            APR_HOOK_PROBE_INVOKE(ud, ns, name, (char *)pHook[n].szName); \
 	    pHook[n].pFunc args_use; \
-            OLD_DTRACE_PROBE2(name##__dispatch__complete, (char *)pHook[n].szName, 0); \
+            APR_HOOK_PROBE_COMPLETE(ud, ns, name, (char *)pHook[n].szName, 0); \
             } \
         } \
 \
-    OLD_DTRACE_PROBE1(name##__return, 0); \
+    APR_HOOK_PROBE_RETURN(ud, ns, name, 0); \
 \
     }
 
@@ -166,24 +218,25 @@
     ns##_LINK_##name##_t *pHook; \
     int n; \
     ret rv = ok; \
+    APR_HOOK_INT_DCL_UD; \
 \
-    OLD_DTRACE_PROBE(name##__entry); \
+    APR_HOOK_PROBE_ENTRY(ud, ns, name); \
 \
     if(_hooks.link_##name) \
         { \
         pHook=(ns##_LINK_##name##_t *)_hooks.link_##name->elts; \
         for(n=0 ; n < _hooks.link_##name->nelts ; ++n) \
             { \
-            OLD_DTRACE_PROBE1(name##__dispatch__invoke, (char *)pHook[n].szName); \
+            APR_HOOK_PROBE_INVOKE(ud, ns, name, (char *)pHook[n].szName); \
             rv=pHook[n].pFunc args_use; \
-            OLD_DTRACE_PROBE2(name##__dispatch__complete, (char *)pHook[n].szName, rv); \
+            APR_HOOK_PROBE_COMPLETE(ud, ns, name, (char *)pHook[n].szName, rv); \
             if(rv != ok && rv != decline) \
                 break; \
             rv = ok; \
             } \
         } \
 \
-    OLD_DTRACE_PROBE1(name##__return, rv); \
+    APR_HOOK_PROBE_RETURN(ud, ns, name, rv); \
 \
     return rv; \
     }
@@ -210,24 +263,25 @@
     ns##_LINK_##name##_t *pHook; \
     int n; \
     ret rv = decline; \
+    APR_HOOK_INT_DCL_UD; \
 \
-    OLD_DTRACE_PROBE(name##__entry); \
+    APR_HOOK_PROBE_ENTRY(ud, ns, name); \
 \
     if(_hooks.link_##name) \
         { \
         pHook=(ns##_LINK_##name##_t *)_hooks.link_##name->elts; \
         for(n=0 ; n < _hooks.link_##name->nelts ; ++n) \
             { \
-            OLD_DTRACE_PROBE1(name##__dispatch__invoke, (char *)pHook[n].szName); \
+            APR_HOOK_PROBE_INVOKE(ud, ns, name, (char *)pHook[n].szName); \
             rv=pHook[n].pFunc args_use; \
-            OLD_DTRACE_PROBE2(name##__dispatch__complete, (char *)pHook[n].szName, rv); \
+            APR_HOOK_PROBE_COMPLETE(ud, ns, name, (char *)pHook[n].szName, rv); \
 \
             if(rv != decline) \
                 break; \
             } \
         } \
 \
-    OLD_DTRACE_PROBE1(name##__return, rv); \
+    APR_HOOK_PROBE_RETURN(ud, ns, name, rv); \
 \
     return rv; \
     }



Mime
View raw message