00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00037 #ifndef APACHE_MPM_COMMON_H
00038 #define APACHE_MPM_COMMON_H
00039
00040 #include "ap_config.h"
00041
00042 #if APR_HAVE_NETINET_TCP_H
00043 #include <netinet/tcp.h>
00044 #endif
00045
00046 #include "mpm.h"
00047
00048 #ifdef __cplusplus
00049 extern "C" {
00050 #endif
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060 #ifndef DEFAULT_LISTENBACKLOG
00061 #define DEFAULT_LISTENBACKLOG 511
00062 #endif
00063
00064
00065 #define AP_SIG_GRACEFUL SIGUSR1
00066
00067
00068 #define AP_SIG_GRACEFUL_SHORT USR1
00069
00070
00071 #define AP_SIG_GRACEFUL_STRING "SIGUSR1"
00072
00073
00074 #define AP_SIG_GRACEFUL_STOP SIGWINCH
00075
00076
00077 #define AP_SIG_GRACEFUL_STOP_SHORT WINCH
00078
00079
00080 #define AP_SIG_GRACEFUL_STOP_STRING "SIGWINCH"
00081
00098 #ifdef AP_MPM_WANT_RECLAIM_CHILD_PROCESSES
00099 void ap_reclaim_child_processes(int terminate);
00100 #endif
00101
00115 #ifdef AP_MPM_WANT_RECLAIM_CHILD_PROCESSES
00116 void ap_relieve_child_processes(void);
00117 #endif
00118
00130 #ifdef AP_MPM_WANT_RECLAIM_CHILD_PROCESSES
00131 void ap_register_extra_mpm_process(pid_t pid);
00132 #endif
00133
00143 #ifdef AP_MPM_WANT_RECLAIM_CHILD_PROCESSES
00144 int ap_unregister_extra_mpm_process(pid_t pid);
00145 #endif
00146
00154 #ifdef AP_MPM_WANT_RECLAIM_CHILD_PROCESSES
00155 apr_status_t ap_mpm_safe_kill(pid_t pid, int sig);
00156 #endif
00157
00166 #ifdef AP_MPM_WANT_WAIT_OR_TIMEOUT
00167 void ap_wait_or_timeout(apr_exit_why_e *status, int *exitcode, apr_proc_t *ret,
00168 apr_pool_t *p);
00169 #endif
00170
00178 #ifdef AP_MPM_WANT_PROCESS_CHILD_STATUS
00179 int ap_process_child_status(apr_proc_t *pid, apr_exit_why_e why, int status);
00180 #endif
00181
00182 #if defined(TCP_NODELAY) && !defined(MPE) && !defined(TPF)
00183
00190 void ap_sock_disable_nagle(apr_socket_t *s);
00191 #else
00192 #define ap_sock_disable_nagle(s)
00193 #endif
00194
00195 #ifdef HAVE_GETPWNAM
00196
00202 AP_DECLARE(uid_t) ap_uname2id(const char *name);
00203 #endif
00204
00205 #ifdef HAVE_GETGRNAM
00206
00212 AP_DECLARE(gid_t) ap_gname2id(const char *name);
00213 #endif
00214
00215 #define AP_MPM_HARD_LIMITS_FILE APACHE_MPM_DIR "/mpm_default.h"
00216
00217 #ifdef AP_MPM_USES_POD
00218
00219 typedef struct ap_pod_t ap_pod_t;
00220
00221 struct ap_pod_t {
00222 apr_file_t *pod_in;
00223 apr_file_t *pod_out;
00224 apr_pool_t *p;
00225 };
00226
00232 AP_DECLARE(apr_status_t) ap_mpm_pod_open(apr_pool_t *p, ap_pod_t **pod);
00233
00237 AP_DECLARE(apr_status_t) ap_mpm_pod_check(ap_pod_t *pod);
00238
00242 AP_DECLARE(apr_status_t) ap_mpm_pod_close(ap_pod_t *pod);
00243
00249 AP_DECLARE(apr_status_t) ap_mpm_pod_signal(ap_pod_t *pod);
00250
00257 AP_DECLARE(void) ap_mpm_pod_killpg(ap_pod_t *pod, int num);
00258 #endif
00259
00260
00261
00262
00263
00264
00265
00266
00271 #ifdef AP_MPM_WANT_SET_MAX_REQUESTS
00272 extern int ap_max_requests_per_child;
00273 const char *ap_mpm_set_max_requests(cmd_parms *cmd, void *dummy,
00274 const char *arg);
00275 #endif
00276
00280 #ifdef AP_MPM_WANT_SET_PIDFILE
00281 extern const char *ap_pid_fname;
00282 const char *ap_mpm_set_pidfile(cmd_parms *cmd, void *dummy,
00283 const char *arg);
00284 #endif
00285
00289 #ifdef AP_MPM_WANT_SET_LOCKFILE
00290 extern const char *ap_lock_fname;
00291 const char *ap_mpm_set_lockfile(cmd_parms *cmd, void *dummy,
00292 const char *arg);
00293 #endif
00294
00298 #ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
00299 extern apr_lockmech_e ap_accept_lock_mech;
00300 extern const char ap_valid_accept_mutex_string[];
00301 const char *ap_mpm_set_accept_lock_mech(cmd_parms *cmd, void *dummy,
00302 const char *arg);
00303 #endif
00304
00305
00306
00307
00308 #ifdef AP_MPM_WANT_SET_SCOREBOARD
00309 const char *ap_mpm_set_scoreboard(cmd_parms *cmd, void *dummy,
00310 const char *arg);
00311 #endif
00312
00313
00314
00315
00316 #ifdef AP_MPM_WANT_SET_COREDUMPDIR
00317 extern char ap_coredump_dir[MAX_STRING_LEN];
00318 extern int ap_coredumpdir_configured;
00319 const char *ap_mpm_set_coredumpdir(cmd_parms *cmd, void *dummy,
00320 const char *arg);
00321 #endif
00322
00326 #ifdef AP_MPM_WANT_SET_GRACEFUL_SHUTDOWN
00327 extern int ap_graceful_shutdown_timeout;
00328 const char *ap_mpm_set_graceful_shutdown(cmd_parms *cmd, void *dummy,
00329 const char *arg);
00330 #define AP_GRACEFUL_SHUTDOWN_TIMEOUT_COMMAND \
00331 AP_INIT_TAKE1("GracefulShutdownTimeout", ap_mpm_set_graceful_shutdown, NULL, \
00332 RSRC_CONF, "Maximum time in seconds to wait for child " \
00333 "processes to complete transactions during shutdown")
00334 #endif
00335
00336
00337 #ifdef AP_MPM_WANT_SIGNAL_SERVER
00338 int ap_signal_server(int *, apr_pool_t *);
00339 void ap_mpm_rewrite_args(process_rec *);
00340 #endif
00341
00342 #ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
00343 extern apr_uint32_t ap_max_mem_free;
00344 extern const char *ap_mpm_set_max_mem_free(cmd_parms *cmd, void *dummy,
00345 const char *arg);
00346 #endif
00347
00348 #ifdef AP_MPM_WANT_SET_STACKSIZE
00349 extern apr_size_t ap_thread_stacksize;
00350 extern const char *ap_mpm_set_thread_stacksize(cmd_parms *cmd, void *dummy,
00351 const char *arg);
00352 #endif
00353
00354 #ifdef AP_MPM_WANT_FATAL_SIGNAL_HANDLER
00355 extern apr_status_t ap_fatal_signal_setup(server_rec *s, apr_pool_t *pconf);
00356 extern apr_status_t ap_fatal_signal_child_setup(server_rec *s);
00357 #endif
00358
00359 #if AP_ENABLE_EXCEPTION_HOOK
00360 extern const char *ap_mpm_set_exception_hook(cmd_parms *cmd, void *dummy,
00361 const char *arg);
00362 #endif
00363
00364 AP_DECLARE_HOOK(int,monitor,(apr_pool_t *p))
00365
00366 #ifdef __cplusplus
00367 }
00368 #endif
00369
00370 #endif
00371