simple_children.c revision 36ef8f77bffe75d1aa327882be1b5bdbe2ff567a
/* 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 "httpd.h"
#include "http_config.h"
#include "simple_types.h"
#include "simple_event.h"
#include "simple_run.h"
#include "http_log.h"
#include "simple_children.h"
#include "apr_hash.h"
#include <unistd.h> /* For fork() */
{
/* See comment in simple_spawn_child for why we check here. */
if (!sc->run_single_process) {
}
/* TODO: recycle child object */
}
}
}
static void clean_child_exit(int code)
{
/* TODO: Pool cleanups.... sigh. */
}
{
int rv = 0;
/* Although we could cut this off 'earlier', and not even invoke this
* function, I would like to keep the functions invoked when in debug mode
* to be as close as possible to those when not in debug... So, we just skip
* the actual spawn itself, but go through all of the motions...
*/
if (!sc->run_single_process) {
if (pid == -1) {
"simple_spawn_child: Unable to fork new process");
return rv;
}
if (pid == 0) {
/* this is the child process */
if (rv) {
}
else {
clean_child_exit(0);
}
}
}
else {
/* TODO: SIMPLE_SPAWN_EXEC */
abort();
}
}
if (pid != 0) {
}
return 0;
}
{
unsigned int count;
int wanted;
int i;
static int run = 0;
/* This is kinda of hack, but rather than spawning a child process,
* we register the normal IO handlers in the main event loop....
*/
if (run == 0) {
run++;
}
}
{
}
/* kill some kids */
for (i = 0; i < to_kill; i++) {
}
}
int rv = 0;
/* spawn some kids */
}
}
else {
/* juuuuust right. */
}
}