simple_run.c revision f997d134bcee6bfa4cd87b69acee96e80c5a358b
/* 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 "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"
/**
* Create Timers.
*/
static apr_status_t
{
NULL,
0);
return APR_SUCCESS;
}
/**
* Create worker thread pool.
*/
static apr_status_t
{
if (rv) {
return rv;
}
return APR_SUCCESS;
}
static apr_status_t
{
if (rv) {
return rv;
}
if (rv) {
return rv;
}
}
return APR_SUCCESS;
}
static apr_status_t
{
}
}
/* TODO: */
abort();
}
else {
abort();
}
return rv;
}
static void *
{
return NULL;
}
#ifndef apr_time_from_msec
#endif
static int
{
/* pqXXXXX: I'm 95% sure that the Linux Powertop guys will slap me for this. */
}
}
}
sc);
now = apr_time_now();
if (rv) {
"simple_main_loop: apr_pollcb_poll failed");
return !OK;
}
}
/* now iterate any timers */
{
/* push this task */
}
else {
break;
}
}
}
{
ep,
NULL);
}
}
}
return 0;
}
void
{
/* 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");
}
}
static int
{
/* TODO: These should be a series of hooks, chroot, drop user, SELinux support, etc. */
/* TODO: chroot support */
/* TODO: drop to configured user */
return 0;
}
int
{
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_child_loop: simple_drop_privs failed");
return !OK;
}
return simple_run_loop(sc);
}
int
{
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);
}