Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mod_watchdog.h
Go to the documentation of this file.
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements. See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef MOD_WATCHDOG_H
18 #define MOD_WATCHDOG_H
19 
29 #include "httpd.h"
30 #include "http_config.h"
31 #include "http_log.h"
32 #include "ap_provider.h"
33 
34 #include "apr.h"
35 #include "apr_strings.h"
36 #include "apr_pools.h"
37 #include "apr_shm.h"
38 #include "apr_hash.h"
39 #include "apr_hooks.h"
40 #include "apr_optional.h"
41 #include "apr_file_io.h"
42 #include "apr_time.h"
43 #include "apr_thread_proc.h"
44 #include "apr_global_mutex.h"
45 #include "apr_thread_mutex.h"
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
57 #define AP_WATCHDOG_SINGLETON "_singleton_"
58 
62 #define AP_WATCHDOG_DEFAULT "_default_"
63 
67 #define AP_WD_TM_INTERVAL APR_TIME_C(1000000) /* 1 second */
68 
72 #define AP_WD_TM_SLICE APR_TIME_C(100000) /* 100 ms */
73 
74 /* State values for callback */
75 #define AP_WATCHDOG_STATE_STARTING 1
76 #define AP_WATCHDOG_STATE_RUNNING 2
77 #define AP_WATCHDOG_STATE_STOPPING 3
78 
80 
81 /* Create a set of AP_WD_DECLARE(type), AP_WD_DECLARE_NONSTD(type) and
82  * AP_WD_DECLARE_DATA with appropriate export and import tags for the platform
83  */
84 #if !defined(AP_WD_DECLARE)
85 #if !defined(WIN32)
86 #define AP_WD_DECLARE(type) type
87 #define AP_WD_DECLARE_NONSTD(type) type
88 #define AP_WD_DECLARE_DATA
89 #elif defined(AP_WD_DECLARE_STATIC)
90 #define AP_WD_DECLARE(type) type __stdcall
91 #define AP_WD_DECLARE_NONSTD(type) type
92 #define AP_WD_DECLARE_DATA
93 #elif defined(AP_WD_DECLARE_EXPORT)
94 #define AP_WD_DECLARE(type) __declspec(dllexport) type __stdcall
95 #define AP_WD_DECLARE_NONSTD(type) __declspec(dllexport) type
96 #define AP_WD_DECLARE_DATA __declspec(dllexport)
97 #else
98 #define AP_WD_DECLARE(type) __declspec(dllimport) type __stdcall
99 #define AP_WD_DECLARE_NONSTD(type) __declspec(dllimport) type
100 #define AP_WD_DECLARE_DATA __declspec(dllimport)
101 #endif
102 #endif
103 
111 typedef apr_status_t ap_watchdog_callback_fn_t(int state, void *data,
112  apr_pool_t *pool);
113 
128  (ap_watchdog_t **watchdog, const char *name, int parent,
129  int singleton, apr_pool_t *p));
130 
140  (ap_watchdog_t *watchdog, apr_interval_time_t interval,
141  const void *data, ap_watchdog_callback_fn_t *callback));
142 
152  (ap_watchdog_t *w, apr_interval_time_t interval,
153  const void *data, ap_watchdog_callback_fn_t *callback));
154 
167 APR_DECLARE_EXTERNAL_HOOK(ap, AP_WD, int, watchdog_need, (server_rec *s,
168  const char *name,
169  int parent, int singleton))
170 
171 
172 
179 APR_DECLARE_EXTERNAL_HOOK(ap, AP_WD, int, watchdog_init, (
180  server_rec *s,
181  const char *name,
182  apr_pool_t *pool))
183 
184 
191 APR_DECLARE_EXTERNAL_HOOK(ap, AP_WD, int, watchdog_exit, (
192  server_rec *s,
193  const char *name,
194  apr_pool_t *pool))
195 
196 
203 APR_DECLARE_EXTERNAL_HOOK(ap, AP_WD, int, watchdog_step, (
204  server_rec *s,
205  const char *name,
206  apr_pool_t *pool))
207 
208 #ifdef __cplusplus
209 }
210 #endif
211 
212 #endif /* MOD_WATCHDOG_H */
213 
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)
Apache Configuration.
struct ap_watchdog_t ap_watchdog_t
Definition: mod_watchdog.h:79
apr_bucket_brigade request_rec apr_pool_t * pool
Definition: mod_dav.h:552
Apache Provider API.
APR Hash Tables.
APR File I/O Handling.
APR Thread Mutex Routines.
apr_int64_t apr_interval_time_t
Definition: apr_time.h:55
APR-UTIL registration of functions exported by modules.
Apache Logging library.
APR memory allocation.
APR Global Locking Routines.
HTTP Daemon routines.
Apache hook functions.
A structure to store information for each virtual server.
Definition: httpd.h:1310
#define APR_DECLARE_EXTERNAL_HOOK(ns, link, ret, name, args)
Definition: apr_hooks.h:118
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 Shared Memory Routines.
APR Platform Definitions.
apr_pool_t * p
apr_status_t ap_watchdog_get_instance(ap_watchdog_t **watchdog, const char *name, int parent, int singleton, apr_pool_t *p)
APR Thread and Process Library.
APR Strings library.
const char * name
Definition: mod_dav.h:726
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
int apr_status_t
Definition: apr_errno.h:44
#define APR_DECLARE_OPTIONAL_FN(ret, name, args)
Definition: apr_optional.h:50
apr_status_t ap_watchdog_callback_fn_t(int state, void *data, apr_pool_t *pool)
Definition: mod_watchdog.h:111
APR Time Library.