You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2009/09/30 22:00:37 UTC

svn commit: r820427 - in /httpd/httpd/trunk/modules: cluster/mod_heartmonitor.c core/mod_watchdog.c core/mod_watchdog.h

Author: trawick
Date: Wed Sep 30 20:00:37 2009
New Revision: 820427

URL: http://svn.apache.org/viewvc?rev=820427&view=rev
Log:
change the callable functions in the mod_watchdog API
to optional hooks to avoid module ordering or other symbol
resolution issues; affected:

  ap_watchdog_get_instance
  ap_watchdog_register_callback
  ap_watchdog_set_callback_interval

Modified:
    httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c
    httpd/httpd/trunk/modules/core/mod_watchdog.c
    httpd/httpd/trunk/modules/core/mod_watchdog.h

Modified: httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c?rev=820427&r1=820426&r2=820427&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c (original)
+++ httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c Wed Sep 30 20:00:37 2009
@@ -669,7 +669,16 @@
     void *data;
     hm_ctx_t *ctx = ap_get_module_config(s->module_config,
                                          &heartmonitor_module);
+    APR_OPTIONAL_FN_TYPE(ap_watchdog_get_instance) *hm_watchdog_get_instance;
+    APR_OPTIONAL_FN_TYPE(ap_watchdog_register_callback) *hm_watchdog_register_callback;
 
+    hm_watchdog_get_instance = APR_RETRIEVE_OPTIONAL_FN(ap_watchdog_get_instance);
+    hm_watchdog_register_callback = APR_RETRIEVE_OPTIONAL_FN(ap_watchdog_register_callback);
+    if (!hm_watchdog_get_instance || !hm_watchdog_register_callback) {
+        ap_log_error(APLOG_MARK, APLOG_CRIT, 0, s,
+                     "Heartmonitor: mod_watchdog is required");
+        return !OK;
+    }
 
     /* Create the slotmem */
     apr_pool_userdata_get(&data, userdata_key, s->process->pool);
@@ -694,7 +703,7 @@
     if (!ctx->active) {
         return OK;
     }
-    rv = ap_watchdog_get_instance(&ctx->watchdog,
+    rv = hm_watchdog_get_instance(&ctx->watchdog,
                                   HM_WATHCHDOG_NAME,
                                   0, 1, p);
     if (rv) {
@@ -704,7 +713,7 @@
         return !OK;
     }
     /* Register a callback with zero interval. */
-    rv = ap_watchdog_register_callback(ctx->watchdog,
+    rv = hm_watchdog_register_callback(ctx->watchdog,
                                        0,
                                        ctx,
                                        hm_watchdog_callback);

Modified: httpd/httpd/trunk/modules/core/mod_watchdog.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/core/mod_watchdog.c?rev=820427&r1=820426&r2=820427&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/core/mod_watchdog.c (original)
+++ httpd/httpd/trunk/modules/core/mod_watchdog.c Wed Sep 30 20:00:37 2009
@@ -300,11 +300,11 @@
     return rc;
 }
 
-AP_WD_DECLARE(apr_status_t) ap_watchdog_get_instance(ap_watchdog_t **watchdog,
-                                                     const char *name,
-                                                     int parent,
-                                                     int singleton,
-                                                     apr_pool_t *p)
+static apr_status_t ap_watchdog_get_instance(ap_watchdog_t **watchdog,
+                                             const char *name,
+                                             int parent,
+                                             int singleton,
+                                             apr_pool_t *p)
 {
     ap_watchdog_t *w;
     const char *pver = parent ? AP_WATCHODG_PVERSION : AP_WATCHODG_CVERSION;
@@ -330,10 +330,10 @@
                                 pver, *watchdog);
 }
 
-AP_WD_DECLARE(apr_status_t) ap_watchdog_set_callback_interval(ap_watchdog_t *w,
-                                apr_interval_time_t interval,
-                                const void *data,
-                                ap_watchdog_callback_fn_t *callback)
+static apr_status_t ap_watchdog_set_callback_interval(ap_watchdog_t *w,
+                                                      apr_interval_time_t interval,
+                                                      const void *data,
+                                                      ap_watchdog_callback_fn_t *callback)
 {
     watchdog_list_t *c = w->callbacks;
     apr_status_t rv = APR_EOF;
@@ -355,10 +355,10 @@
     return rv;
 }
 
-AP_WD_DECLARE(apr_status_t) ap_watchdog_register_callback(ap_watchdog_t *w,
-                                apr_interval_time_t interval,
-                                const void *data,
-                                ap_watchdog_callback_fn_t *callback)
+static apr_status_t ap_watchdog_register_callback(ap_watchdog_t *w,
+                                                  apr_interval_time_t interval,
+                                                  const void *data,
+                                                  ap_watchdog_callback_fn_t *callback)
 {
     watchdog_list_t *c = w->callbacks;
 
@@ -718,6 +718,9 @@
                        NULL,
                        APR_HOOK_MIDDLE);
 
+    APR_REGISTER_OPTIONAL_FN(ap_watchdog_get_instance);
+    APR_REGISTER_OPTIONAL_FN(ap_watchdog_register_callback);
+    APR_REGISTER_OPTIONAL_FN(ap_watchdog_set_callback_interval);
 }
 
 /*--------------------------------------------------------------------------*/

Modified: httpd/httpd/trunk/modules/core/mod_watchdog.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/core/mod_watchdog.h?rev=820427&r1=820426&r2=820427&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/core/mod_watchdog.h (original)
+++ httpd/httpd/trunk/modules/core/mod_watchdog.h Wed Sep 30 20:00:37 2009
@@ -37,6 +37,7 @@
 #include "apr_shm.h"
 #include "apr_hash.h"
 #include "apr_hooks.h"
+#include "apr_optional.h"
 #include "apr_file_io.h"
 #include "apr_time.h"
 #include "apr_thread_proc.h"
@@ -131,11 +132,9 @@
  *         and function will create a new watchdog instance.
  *         Note that default client process watchdog works in singleton mode.
  */
-AP_WD_DECLARE(apr_status_t) ap_watchdog_get_instance(ap_watchdog_t **watchdog,
-                                                  const char *name,
-                                                  int parent,
-                                                  int singleton,
-                                                  apr_pool_t *p);
+APR_DECLARE_OPTIONAL_FN(apr_status_t, ap_watchdog_get_instance,
+                        (ap_watchdog_t **watchdog, const char *name, int parent,
+                         int singleton, apr_pool_t *p));
 
 /**
  * Register watchdog callback.
@@ -145,10 +144,9 @@
  * @param data The data to pass to the callback function.
  * @return APR_SUCCESS if all went well. APR_EEXIST if already registered.
  */
-AP_WD_DECLARE(apr_status_t) ap_watchdog_register_callback(ap_watchdog_t *watchdog,
-                            apr_interval_time_t interval,
-                            const void *data,
-                            ap_watchdog_callback_fn_t *callback);
+APR_DECLARE_OPTIONAL_FN(apr_status_t, ap_watchdog_register_callback,
+                        (ap_watchdog_t *watchdog, apr_interval_time_t interval,
+                         const void *data, ap_watchdog_callback_fn_t *callback));
 
 /**
  * Update registered watchdog callback interval.
@@ -158,10 +156,9 @@
  * @param data The data to pass to the callback function.
  * @return APR_SUCCESS if all went well. APR_EOF if callback was not found.
  */
-AP_WD_DECLARE(apr_status_t) ap_watchdog_set_callback_interval(ap_watchdog_t *w,
-                            apr_interval_time_t interval,
-                            const void *data,
-                            ap_watchdog_callback_fn_t *callback);
+APR_DECLARE_OPTIONAL_FN(apr_status_t, ap_watchdog_set_callback_interval,
+                        (ap_watchdog_t *w, apr_interval_time_t interval,
+                         const void *data, ap_watchdog_callback_fn_t *callback));
 
 /**
  * Watchdog require hook.



Re: svn commit: r820427 - in /httpd/httpd/trunk/modules: cluster/mod_heartmonitor.c core/mod_watchdog.c core/mod_watchdog.h

Posted by Guenter Knauf <fu...@apache.org>.
Jeff,
Jeff Trawick schrieb:
> On Wed, Sep 30, 2009 at 9:56 PM, Guenter Knauf <fuankg@apache.org
> What is the symptom?
that I was too tired :)

> The AP_WD_DECLARE stuff is still needed for the external hooks
> implemented by mod_watchdog, such as
> 
> APR_DECLARE_EXTERNAL_HOOK(ap, AP_WD, int, watchdog_init, (
>                           server_rec *s,
>                           const char *name,
>                           apr_pool_t *pool))
> 
> NetWare must already support APR_DECLARE_OPTIONAL_FN one way or another,
> long before this change.  I'm unable to tell how mod_watchdog's use of
> that is different from existing modules, such as mod_ldap or mod_ssl or
> core.
yes, seems NW does - I did now build the test modules, and from the logs
it seems that optional functions / hooks work ...
[Sat Oct 03 11:45:46 2009] [error] Optional function test said: GET
/manual/images/feather.gif HTTP/1.1
[Sat Oct 03 11:45:46 2009] [error] Optional hook test said: GET
/manual/images/feather.gif HTTP/1.1
[Sat Oct 03 11:45:46 2009] [error] Optional function test said: GET
/manual/images/left.gif HTTP/1.1
[Sat Oct 03 11:45:46 2009] [error] Optional hook test said: GET
/manual/images/left.gif HTTP/1.1
[Sat Oct 03 11:45:46 2009] [error] Optional function test said: GET
/manual/images/up.gif HTTP/1.1
[Sat Oct 03 11:45:46 2009] [error] Optional hook test said: GET
/manual/images/up.gif HTTP/1.1

I had the impression that I need to bring them into the export list, but
seems not the case....
did spend some minutes with that, and although I got mod_watchdog now to
load it gives me an error in the log that it cant create the worker
process because 'not implemented for this platform', sniff ...
I think I have to look again deeper into the mpm stuff, and finish what
I have started there (I know there are still some outstanding
renamings), though its hard to catch up when you have not followed close
to all the changes for close to a year where I had really only
error(ENOTIME_PERMANENT) ... :(

thanks, Gün.




Re: svn commit: r820427 - in /httpd/httpd/trunk/modules: cluster/mod_heartmonitor.c core/mod_watchdog.c core/mod_watchdog.h

Posted by Jeff Trawick <tr...@gmail.com>.
On Wed, Sep 30, 2009 at 9:56 PM, Guenter Knauf <fu...@apache.org> wrote:

> Hi Jeff,
> trawick@apache.org schrieb:
> > Author: trawick
> > Date: Wed Sep 30 20:00:37 2009
> > New Revision: 820427
> >
> > URL: http://svn.apache.org/viewvc?rev=820427&view=rev
> > Log:
> > change the callable functions in the mod_watchdog API
> > to optional hooks to avoid module ordering or other symbol
> > resolution issues; affected:
> >
> >   ap_watchdog_get_instance
> >   ap_watchdog_register_callback
> >   ap_watchdog_set_callback_interval
> >
> > Modified:
> >     httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c
> >     httpd/httpd/trunk/modules/core/mod_watchdog.c
> >     httpd/httpd/trunk/modules/core/mod_watchdog.h
> this breaks NetWare export list; and I did spent hours with Rainer last
> time get the mod_watchdog exported symbols in; can you perhaps help a
> bit with the awk stuff - I'm no expert with this; see:
> http://svn.apache.org/viewvc?rev=820503&view=rev
> where I started with it, but too late to get it right ATM ...
>

What is the symptom?

The AP_WD_DECLARE stuff is still needed for the external hooks implemented
by mod_watchdog, such as

APR_DECLARE_EXTERNAL_HOOK(ap, AP_WD, int, watchdog_init, (
                          server_rec *s,
                          const char *name,
                          apr_pool_t *pool))

NetWare must already support APR_DECLARE_OPTIONAL_FN one way or another,
long before this change.  I'm unable to tell how mod_watchdog's use of that
is different from existing modules, such as mod_ldap or mod_ssl or core.

Re: svn commit: r820427 - in /httpd/httpd/trunk/modules: cluster/mod_heartmonitor.c core/mod_watchdog.c core/mod_watchdog.h

Posted by Guenter Knauf <fu...@apache.org>.
Hi Jeff,
trawick@apache.org schrieb:
> Author: trawick
> Date: Wed Sep 30 20:00:37 2009
> New Revision: 820427
> 
> URL: http://svn.apache.org/viewvc?rev=820427&view=rev
> Log:
> change the callable functions in the mod_watchdog API
> to optional hooks to avoid module ordering or other symbol
> resolution issues; affected:
> 
>   ap_watchdog_get_instance
>   ap_watchdog_register_callback
>   ap_watchdog_set_callback_interval
> 
> Modified:
>     httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c
>     httpd/httpd/trunk/modules/core/mod_watchdog.c
>     httpd/httpd/trunk/modules/core/mod_watchdog.h
this breaks NetWare export list; and I did spent hours with Rainer last
time get the mod_watchdog exported symbols in; can you perhaps help a
bit with the awk stuff - I'm no expert with this; see:
http://svn.apache.org/viewvc?rev=820503&view=rev
where I started with it, but too late to get it right ATM ...

thanks, Gün.