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
00156 #ifdef AP_MPM_WANT_RECLAIM_CHILD_PROCESSES
00157 apr_status_t ap_mpm_safe_kill(pid_t pid, int sig);
00158 #endif
00159
00168 #ifdef AP_MPM_WANT_WAIT_OR_TIMEOUT
00169 void ap_wait_or_timeout(apr_exit_why_e *status, int *exitcode, apr_proc_t *ret,
00170 apr_pool_t *p);
00171 #endif
00172
00180 #ifdef AP_MPM_WANT_PROCESS_CHILD_STATUS
00181 int ap_process_child_status(apr_proc_t *pid, apr_exit_why_e why, int status);
00182 #endif
00183
00184 #if defined(TCP_NODELAY) && !defined(MPE) && !defined(TPF)
00185
00192 void ap_sock_disable_nagle(apr_socket_t *s);
00193 #else
00194 #define ap_sock_disable_nagle(s)
00195 #endif
00196
00197 #ifdef HAVE_GETPWNAM
00198
00204 AP_DECLARE(uid_t) ap_uname2id(const char *name);
00205 #endif
00206
00207 #ifdef HAVE_GETGRNAM
00214 AP_DECLARE(gid_t) ap_gname2id(const char *name);
00215 #endif
00216
00217 #define AP_MPM_HARD_LIMITS_FILE APACHE_MPM_DIR "/mpm_default.h"
00218
00219 #ifdef AP_MPM_USES_POD
00220
00221 typedef struct ap_pod_t ap_pod_t;
00222
00223 struct ap_pod_t {
00224 apr_file_t *pod_in;
00225 apr_file_t *pod_out;
00226 apr_pool_t *p;
00227 };
00228
00234 AP_DECLARE(apr_status_t) ap_mpm_pod_open(apr_pool_t *p, ap_pod_t **pod);
00235
00239 AP_DECLARE(apr_status_t) ap_mpm_pod_check(ap_pod_t *pod);
00240
00244 AP_DECLARE(apr_status_t) ap_mpm_pod_close(ap_pod_t *pod);
00245
00251 AP_DECLARE(apr_status_t) ap_mpm_pod_signal(ap_pod_t *pod);
00252
00259 AP_DECLARE(void) ap_mpm_pod_killpg(ap_pod_t *pod, int num);
00260 #endif
00261
00262
00263
00264
00265
00266
00267
00268
00273 #ifdef AP_MPM_WANT_SET_MAX_REQUESTS
00274 extern int ap_max_requests_per_child;
00275 const char *ap_mpm_set_max_requests(cmd_parms *cmd, void *dummy,
00276 const char *arg);
00277 #endif
00278
00282 #ifdef AP_MPM_WANT_SET_PIDFILE
00283 extern const char *ap_pid_fname;
00284 const char *ap_mpm_set_pidfile(cmd_parms *cmd, void *dummy,
00285 const char *arg);
00286 #endif
00287
00291 #ifdef AP_MPM_WANT_SET_LOCKFILE
00292 extern const char *ap_lock_fname;
00293 const char *ap_mpm_set_lockfile(cmd_parms *cmd, void *dummy,
00294 const char *arg);
00295 #endif
00296
00300 #ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
00301 extern apr_lockmech_e ap_accept_lock_mech;
00302 extern const char ap_valid_accept_mutex_string[];
00303 const char *ap_mpm_set_accept_lock_mech(cmd_parms *cmd, void *dummy,
00304 const char *arg);
00305 #endif
00306
00307
00308
00309
00310 #ifdef AP_MPM_WANT_SET_SCOREBOARD
00311 const char *ap_mpm_set_scoreboard(cmd_parms *cmd, void *dummy,
00312 const char *arg);
00313 #endif
00314
00315
00316
00317
00318 #ifdef AP_MPM_WANT_SET_COREDUMPDIR
00319 extern char ap_coredump_dir[MAX_STRING_LEN];
00320 extern int ap_coredumpdir_configured;
00321 const char *ap_mpm_set_coredumpdir(cmd_parms *cmd, void *dummy,
00322 const char *arg);
00323 #endif
00324
00328 #ifdef AP_MPM_WANT_SET_GRACEFUL_SHUTDOWN
00329 extern int ap_graceful_shutdown_timeout;
00330 const char *ap_mpm_set_graceful_shutdown(cmd_parms *cmd, void *dummy,
00331 const char *arg);
00332 #define AP_GRACEFUL_SHUTDOWN_TIMEOUT_COMMAND \
00333 AP_INIT_TAKE1("GracefulShutdownTimeout", ap_mpm_set_graceful_shutdown, NULL, \
00334 RSRC_CONF, "Maximum time in seconds to wait for child " \
00335 "processes to complete transactions during shutdown")
00336 #endif
00337
00338
00339 #ifdef AP_MPM_WANT_SIGNAL_SERVER
00340 int ap_signal_server(int *, apr_pool_t *);
00341 void ap_mpm_rewrite_args(process_rec *);
00342 #endif
00343
00344 #ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
00345 extern apr_uint32_t ap_max_mem_free;
00346 extern const char *ap_mpm_set_max_mem_free(cmd_parms *cmd, void *dummy,
00347 const char *arg);
00348 #endif
00349
00350 #ifdef AP_MPM_WANT_SET_STACKSIZE
00351 extern apr_size_t ap_thread_stacksize;
00352 extern const char *ap_mpm_set_thread_stacksize(cmd_parms *cmd, void *dummy,
00353 const char *arg);
00354 #endif
00355
00356 #ifdef AP_MPM_WANT_FATAL_SIGNAL_HANDLER
00357 extern apr_status_t ap_fatal_signal_setup(server_rec *s, apr_pool_t *pconf);
00358 extern apr_status_t ap_fatal_signal_child_setup(server_rec *s);
00359 #endif
00360
00361 #if AP_ENABLE_EXCEPTION_HOOK
00362 extern const char *ap_mpm_set_exception_hook(cmd_parms *cmd, void *dummy,
00363 const char *arg);
00364 #endif
00365
00366 AP_DECLARE_HOOK(int,monitor,(apr_pool_t *p))
00367
00368 #ifdef __cplusplus
00369 }
00370 #endif
00371
00372 #endif