Main Page | Modules | Namespace List | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages | Examples

mpmt_os2.c File Reference

#include "ap_config.h"
#include "httpd.h"
#include "mpm_default.h"
#include "http_main.h"
#include "http_log.h"
#include "http_config.h"
#include "http_core.h"
#include "http_connection.h"
#include "mpm.h"
#include "ap_mpm.h"
#include "ap_listen.h"
#include "apr_portable.h"
#include "mpm_common.h"
#include "apr_strings.h"
#include <os2.h>
#include <process.h>

Include dependency graph for mpmt_os2.c:

Go to the source code of this file.

Defines

#define CORE_PRIVATE
#define INCL_NOPMAPI
#define INCL_DOS
#define INCL_DOSERRORS
#define HARD_SERVER_LIMIT   10
#define HARD_THREAD_LIMIT   256

Functions

static char master_main ()
static void spawn_child (int slot)
void ap_mpm_child_main (apr_pool_t *pconf)
static void set_signals ()
int ap_mpm_run (apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
static void sig_term (int sig)
static void sig_restart (int sig)
 AP_DECLARE (apr_status_t)
int ap_graceful_stop_signalled (void)
static int mpmt_os2_pre_config (apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp)
static void mpmt_os2_hooks (apr_pool_t *p)
static const char * set_daemons_to_start (cmd_parms *cmd, void *dummy, const char *arg)
static const char * set_min_spare_threads (cmd_parms *cmd, void *dummy, const char *arg)
static const char * set_max_spare_threads (cmd_parms *cmd, void *dummy, const char *arg)
static const char * ignore_cmd (cmd_parms *cmd, void *dummy, const char *arg)

Variables

server_recap_server_conf
static apr_pool_tpconf = NULL
static const char * ap_pid_fname = NULL
static int one_process = 0
static int ap_daemons_to_start = 0
static int ap_thread_limit = 0
static int ap_max_requests_per_child = 0
int ap_min_spare_threads = 0
int ap_max_spare_threads = 0
int ap_max_daemons_limit = -1
static int volatile shutdown_pending
static int volatile restart_pending
static int volatile is_graceful = 0
ap_generation_t volatile ap_my_generation = 0
static int is_parent_process = TRUE
HMTX ap_mpm_accept_mutex = 0
static const command_rec mpmt_os2_cmds []
module AP_MODULE_DECLARE_DATA mpm_mpmt_os2_module


Define Documentation

#define CORE_PRIVATE
 

Definition at line 39 of file mpmt_os2.c.

#define HARD_SERVER_LIMIT   10
 

Definition at line 64 of file mpmt_os2.c.

#define HARD_THREAD_LIMIT   256
 

Definition at line 69 of file mpmt_os2.c.

#define INCL_DOS
 

Definition at line 41 of file mpmt_os2.c.

#define INCL_DOSERRORS
 

Definition at line 42 of file mpmt_os2.c.

#define INCL_NOPMAPI
 

Definition at line 40 of file mpmt_os2.c.


Function Documentation

AP_DECLARE apr_status_t   ) 
 

convert a recent time to its human readable components in local timezone

Parameters:
tm the exploded time
t the time to explode: MUST be within the last AP_TIME_RECENT_THRESHOLD seconds
Note:
This is a faster alternative to apr_explode_localtime that uses a cache of pre-exploded time structures. It is useful for things that need to explode the current time multiple times per second, like loggers.
Returns:
APR_SUCCESS iff successful

Definition at line 418 of file mpmt_os2.c.

References AP_DECLARE, ap_max_daemons_limit, ap_max_requests_per_child, AP_MPMQ_DYNAMIC, AP_MPMQ_HARD_LIMIT_DAEMONS, AP_MPMQ_HARD_LIMIT_THREADS, AP_MPMQ_IS_FORKED, AP_MPMQ_IS_THREADED, AP_MPMQ_MAX_DAEMON_USED, AP_MPMQ_MAX_REQUESTS_DAEMON, AP_MPMQ_MAX_SPARE_DAEMONS, AP_MPMQ_MIN_SPARE_DAEMONS, AP_MPMQ_NOT_SUPPORTED, APR_ENOTIMPL, APR_SUCCESS, HARD_SERVER_LIMIT, and HARD_THREAD_LIMIT.

int ap_graceful_stop_signalled void   ) 
 

Definition at line 451 of file mpmt_os2.c.

References is_graceful.

void ap_mpm_child_main apr_pool_t pconf  ) 
 

Definition at line 92 of file mpmt_os2_child.c.

References _beginthread, ap_init_scoreboard(), ap_listeners, ap_max_requests_per_child, ap_min_spare_threads, ap_mpm_accept_mutex, ap_my_generation, ap_scoreboard_fname, ap_scoreboard_image, ap_server_conf, APEXIT_CHILDFATAL, APLOG_ERR, APLOG_MARK, apr_accept(), APR_FROM_OS_ERROR, APR_LOCAL, APR_POLLIN, apr_pool_create, APR_STATUS_IS_EINTR, APR_SUCCESS, c, child_slot, clean_child_exit(), worker_args_t::conn_sd, event, FALSE, process_score::generation, getpid, scoreboard::global, HARD_SERVER_LIMIT, HARD_THREAD_LIMIT, is_graceful, lr, my_pid, ap_listen_rec::next, nsds, NULL, scoreboard::parent, worker_args_t::pconn, pollset, port, process_score::quiescing, requests_this_child, global_score::running_generation, sa, ap_listen_rec::sd, SERVER_DEAD, server_maintenance(), scoreboard::servers, set_signals(), shutdown_event, shutdown_pending, WORKTYPE_CONN, and WORKTYPE_EXIT.

Referenced by ap_mpm_run(), and master_main().

Here is the call graph for this function:

int ap_mpm_run apr_pool_t _pconf,
apr_pool_t plog,
server_rec s
 

Definition at line 114 of file mpmt_os2.c.

References ap_listeners, ap_mpm_accept_mutex, ap_mpm_child_main(), ap_my_generation, ap_pid_fname, ap_scoreboard_fname, ap_scoreboard_image, ap_setup_listeners(), ap_thread_limit, APLOG_ALERT, APLOG_INFO, APLOG_MARK, APLOG_NOTICE, APR_LOCAL, apr_os_sock_put(), apr_pcalloc, apr_socket_create(), APR_SUCCESS, APR_UNSPEC, ap_listen_rec::bind_addr, DEFAULT_HTTP_PORT, apr_sockaddr_t::family, getpid, scoreboard::global, is_parent_process, lr, master_main(), ap_listen_rec::next, NULL, process_rec::pool, server_rec::process, restart(), restart_pending, global_score::running_generation, sa, ap_listen_rec::sd, and TRUE.

Here is the call graph for this function:

static const char* ignore_cmd cmd_parms cmd,
void *  dummy,
const char *  arg
[static]
 

Definition at line 544 of file mpmt_os2.c.

References NULL.

static char master_main  )  [static]
 

Definition at line 201 of file mpmt_os2.c.

References accept_mutex, ap_daemons_to_start, ap_init_scoreboard(), ap_listeners, ap_mpm_accept_mutex, ap_mpm_child_main(), ap_scoreboard_fname, ap_scoreboard_image, ap_setup_listeners(), APEXIT_CHILDFATAL, APLOG_ALERT, APLOG_DEBUG, APLOG_ERR, APLOG_INFO, APLOG_MARK, APLOG_NOTICE, APR_FROM_OS_ERROR, apr_os_sock_get(), FALSE, getpid, scoreboard::global, HARD_SERVER_LIMIT, is_graceful, lr, ap_listen_rec::next, NULL, one_process, scoreboard::parent, process_score::pid, process_score::quiescing, restart_pending, global_score::restart_time, s, SCOREBOARD_MAINTENANCE_INTERVAL, ap_listen_rec::sd, set_signals(), shutdown_pending, and spawn_child().

Referenced by ap_mpm_run().

Here is the call graph for this function:

static void mpmt_os2_hooks apr_pool_t p  )  [static]
 

Definition at line 482 of file mpmt_os2.c.

References APR_HOOK_MIDDLE, mpmt_os2_pre_config(), and NULL.

Here is the call graph for this function:

static int mpmt_os2_pre_config apr_pool_t pconf,
apr_pool_t plog,
apr_pool_t ptemp
[static]
 

Definition at line 460 of file mpmt_os2.c.

References ap_daemons_to_start, ap_extended_status, ap_listen_pre_config(), ap_max_requests_per_child, ap_max_spare_threads, ap_min_spare_threads, ap_pid_fname, ap_thread_limit, APR_ALLOCATOR_MAX_FREE_UNLIMITED, DEFAULT_MAX_REQUESTS_PER_CHILD, DEFAULT_MAX_SPARE_THREAD, DEFAULT_MIN_SPARE_THREAD, DEFAULT_PIDLOG, DEFAULT_START_DAEMON, HARD_THREAD_LIMIT, is_graceful, OK, and one_process.

Referenced by mpmt_os2_hooks().

Here is the call graph for this function:

static const char* set_daemons_to_start cmd_parms cmd,
void *  dummy,
const char *  arg
[static]
 

Definition at line 489 of file mpmt_os2.c.

References ap_daemons_to_start, err, GLOBAL_ONLY, and NULL.

static const char* set_max_spare_threads cmd_parms cmd,
void *  dummy,
const char *  arg
[static]
 

Definition at line 529 of file mpmt_os2.c.

References ap_max_spare_threads, err, GLOBAL_ONLY, and NULL.

static const char* set_min_spare_threads cmd_parms cmd,
void *  dummy,
const char *  arg
[static]
 

Definition at line 503 of file mpmt_os2.c.

References ap_min_spare_threads, APLOG_MARK, APLOG_STARTUP, err, GLOBAL_ONLY, and NULL.

static void set_signals  )  [static]
 

Definition at line 392 of file mpmt_os2.c.

References APLOG_MARK, APLOG_WARNING, NULL, sig_restart(), and sig_term().

Here is the call graph for this function:

static void sig_restart int  sig  )  [static]
 

Definition at line 381 of file mpmt_os2.c.

References is_graceful, and restart_pending.

Referenced by set_signals().

static void sig_term int  sig  )  [static]
 

Definition at line 373 of file mpmt_os2.c.

References shutdown_pending.

static void spawn_child int  slot  )  [static]
 

Definition at line 342 of file mpmt_os2.c.

References ap_max_daemons_limit, ap_my_generation, ap_scoreboard_image, APLOG_ERR, APLOG_MARK, APR_FROM_OS_ERROR, process_score::generation, NULL, scoreboard::parent, process_score::pid, and progname.

Referenced by master_main().


Variable Documentation

int ap_daemons_to_start = 0 [static]
 

Definition at line 78 of file mpmt_os2.c.

int ap_max_daemons_limit = -1
 

Definition at line 85 of file mpmt_os2.c.

int ap_max_requests_per_child = 0 [static]
 

Definition at line 80 of file mpmt_os2.c.

Referenced by AP_DECLARE(), ap_mpm_child_main(), check_infinite_requests(), child_main(), leader_pre_config(), mpmt_os2_pre_config(), netware_pre_config(), perchild_pre_config(), prefork_pre_config(), worker_main(), worker_pre_config(), and worker_thread().

int ap_max_spare_threads = 0
 

Definition at line 82 of file mpmt_os2.c.

Referenced by mpmt_os2_pre_config(), server_maintenance(), and set_max_spare_threads().

int ap_min_spare_threads = 0
 

Definition at line 81 of file mpmt_os2.c.

Referenced by ap_mpm_child_main(), mpmt_os2_pre_config(), server_maintenance(), and set_min_spare_threads().

HMTX ap_mpm_accept_mutex = 0
 

Definition at line 93 of file mpmt_os2.c.

Referenced by ap_mpm_child_main(), ap_mpm_run(), and master_main().

ap_generation_t volatile ap_my_generation = 0
 

Definition at line 91 of file mpmt_os2.c.

const char* ap_pid_fname = NULL [static]
 

Definition at line 74 of file mpmt_os2.c.

Referenced by ap_mpm_run(), beos_pre_config(), leader_pre_config(), mpmt_os2_pre_config(), perchild_open_logs(), perchild_pre_config(), prefork_pre_config(), and worker_pre_config().

server_rec* ap_server_conf
 

Definition at line 72 of file mpmt_os2.c.

int ap_thread_limit = 0 [static]
 

Definition at line 79 of file mpmt_os2.c.

int volatile is_graceful = 0 [static]
 

Definition at line 90 of file mpmt_os2.c.

int is_parent_process = TRUE [static]
 

Definition at line 92 of file mpmt_os2.c.

Referenced by ap_mpm_run().

module AP_MODULE_DECLARE_DATA mpm_mpmt_os2_module
 

Initial value:

 {
    MPM20_MODULE_STUFF,
    NULL,                       
    NULL,                       
    NULL,                       
    NULL,                       
    NULL,                       
    mpmt_os2_cmds,              
    mpmt_os2_hooks,             
}

Definition at line 568 of file mpmt_os2.c.

const command_rec mpmt_os2_cmds[] [static]
 

Initial value:

 {
LISTEN_COMMANDS,
AP_INIT_TAKE1( "StartServers", set_daemons_to_start, NULL, RSRC_CONF, 
  "Number of child processes launched at server startup" ),
AP_INIT_TAKE1("MinSpareThreads", set_min_spare_threads, NULL, RSRC_CONF,
  "Minimum number of idle children, to handle request spikes"),
AP_INIT_TAKE1("MaxSpareThreads", set_max_spare_threads, NULL, RSRC_CONF,
  "Maximum number of idle children"),
AP_INIT_TAKE1("User", ignore_cmd, NULL, RSRC_CONF,
  "Not applicable on this platform"),
AP_INIT_TAKE1("Group", ignore_cmd, NULL, RSRC_CONF,
  "Not applicable on this platform"),
AP_INIT_TAKE1("ScoreBoardFile", ignore_cmd, NULL, RSRC_CONF, \
  "Not applicable on this platform"),
{ NULL }
}

Definition at line 551 of file mpmt_os2.c.

int one_process = 0 [static]
 

Definition at line 77 of file mpmt_os2.c.

apr_pool_t* pconf = NULL [static]
 

Definition at line 73 of file mpmt_os2.c.

int volatile restart_pending [static]
 

Definition at line 89 of file mpmt_os2.c.

int volatile shutdown_pending [static]
 

Definition at line 88 of file mpmt_os2.c.