simple_run.c revision 5bfaaf573bacb45c1cf290ce85ecc676587e8a64
/* 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.
*/
/* #define APR_RING_DEBUG 1 */
#include "httpd.h"
#include "http_log.h"
#include "http_main.h"
#include "simple_types.h"
#include "simple_event.h"
#include "simple_children.h"
#include "simple_run.h"
#include "simple_io.h"
#include "ap_mpm.h"
#include "scoreboard.h"
#include "ap_listen.h"
#include "mpm_common.h"
#include "apr_version.h"
#endif
/**
* Create Timers.
*/
{
return APR_SUCCESS;
}
/**
* Create worker thread pool.
*/
{
if (rv) {
"simple_setup_workers: apr_thread_pool_create with %d threads failed",
return rv;
}
return APR_SUCCESS;
}
{
if (rv) {
"simple_setup_workers: apr_socket_opt_set(APR_SO_NONBLOCK = 1) failed on %pI",
return rv;
}
if (rv) {
"simple_setup_workers: apr_pollcb_add failed on %pI",
return rv;
}
}
return APR_SUCCESS;
}
{
}
}
/* TODO: */
abort();
}
else {
abort();
}
return rv;
}
{
return NULL;
}
{
/* pqXXXXX: I'm 95% sure that the Linux Powertop guys will slap me for this. */
}
}
else {
/* We have already expired timers in the queue. */
timeout = 0;
}
}
tnow = apr_time_now();
if (rv) {
"simple_main_loop: apr_pollcb_poll failed");
return DONE;
}
}
/* now iterate any timers */
/* push this task */
}
else {
break;
}
}
}
ep,
}
}
}
return OK;
}
{
/* Normally this is only ran in the child processes, but we want to do it here too... */
if (rv) {
"simple_single_child_hack: simple_setup_listeners failed");
}
}
{
if (rv) {
"simple_setup_privs: ap_run_drop_privileges failed");
return rv;
}
return 0;
}
{
int i;
for (i = 0; i < sizeof(good_methods) / sizeof(void*); i++) {
/* pqXXXXX: make size of pollcb configrable or dynamic */
if (!rv) {
break;
}
}
if (rv) {
"simple_setup_pollcb: apr_pollcb_create failed for all possible backends!");
return rv;
}
return rv;
}
{
if (rv) {
return rv;
}
/* XXXXX: Hack. Reseting parts of the simple core needs to be more
* thought out than this.
*/
if (rv) {
"simple_child_loop: simple_setup_workers failed");
return !OK;
}
if (rv) {
"simple_child_loop: simple_setup_sockets failed");
return !OK;
}
if (rv) {
/* simple_setup_privs already logged error */
return !OK;
}
return simple_run_loop(sc);
}
{
if (rv) {
return rv;
}
if (rv) {
"simple_main_loop: simple_setup_workers failed");
return !OK;
}
if (rv) {
"simple_main_loop: simple_setup_timers failed");
return !OK;
}
return simple_run_loop(sc);
}