simple_api.c revision f020d1f91625f6de963b8c1ac44d8f31bb74b784
/* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "mpm.h"
#include "ap_mpm.h"
#include "httpd.h"
#include "http_config.h"
#include "mpm_common.h"
#include "http_log.h"
#include "scoreboard.h"
#include "ap_listen.h"
#include "simple_types.h"
#include "simple_run.h"
#include "http_core.h"
/* Thie file contains the absolute minimal MPM API, to interface with httpd. */
ap_generation_t volatile ap_my_generation = 0;
int
server_rec *s)
{
return 1;
}
return simple_main_loop(sc);
}
{
switch (query_code) {
case AP_MPMQ_IS_THREADED:
*result = AP_MPMQ_STATIC;
return APR_SUCCESS;
break;
case AP_MPMQ_IS_FORKED:
return APR_SUCCESS;
break;
case AP_MPMQ_IS_ASYNC:
*result = 1;
return APR_SUCCESS;
break;
case AP_MPMQ_MAX_DAEMON_USED:
return APR_SUCCESS;
break;
return APR_SUCCESS;
break;
return APR_SUCCESS;
break;
case AP_MPMQ_MAX_THREADS:
return APR_SUCCESS;
break;
return APR_SUCCESS;
break;
return APR_SUCCESS;
break;
return APR_SUCCESS;
break;
return APR_SUCCESS;
break;
case AP_MPMQ_MAX_DAEMONS:
return APR_SUCCESS;
break;
case AP_MPMQ_MPM_STATE:
return APR_SUCCESS;
default:
break;
}
return APR_ENOTIMPL;
}
static int
server_rec *s)
{
int nsock;
ap_server_conf = s;
nsock = ap_setup_listeners(s);
if (nsock < 1) {
s,
"simple_open_logs: no listening sockets available, shutting down");
return DONE;
}
return OK;
}
static int
{
int run_debug;
sc->restart_num++;
if (run_debug) {
}
else {
}
if (sc->run_foreground) {
}
else {
}
if (rv) {
"simple_pre_config: apr_proc_detach(%s) failed",
return HTTP_INTERNAL_SERVER_ERROR;
}
}
return OK;
}
static void
{
/* this is our first 'real' entry point, so setup everything here. */
if (rv) {
"simple_core_init: Fatal Error Encountered");
}
}
#define SIMPLE_MAX_PROC (500000)
#define SIMPLE_MIN_PROC (1)
#define SIMPLE_MAX_THREADS (500000)
#define SIMPLE_MIN_THREADS (1)
static int
{
"simple_check_config: SimpleProcCount must be less than %d", SIMPLE_MAX_PROC);
return !OK;
}
"simple_check_config: SimpleProcCount must be more than %d", SIMPLE_MIN_PROC);
return !OK;
}
"simple_check_config: SimpleThreadCount must be less than %d", SIMPLE_MAX_THREADS);
return !OK;
}
"simple_check_config: SimpleThreadCount must be more than %d", SIMPLE_MIN_THREADS);
return !OK;
}
return OK;
}
static void
{
}
static const char*
{
return err;
}
return NULL;
}
static const char*
{
return err;
}
return NULL;
}
static const char*
{
return err;
}
return NULL;
}
static const command_rec simple_cmds[] = {
"Number of child processes launched at server startup"),
"Set the number of Worker Threads Per-Process"),
"Sets the user to run child processes as"),
/* pqXXXXXXXXX: These do NOT belong in the MPM configuration commands. */
{ NULL }
};
simple_process_start, /* hook to run before apache parses args */
NULL, /* create per-directory config structure */
NULL, /* merge per-directory config structures */
NULL, /* create per-server config structure */
NULL, /* merge per-server config structures */
simple_cmds, /* command apr_table_t */
simple_hooks /* register_hooks */
};