fcgistarter.c revision 67cf7f7a435f519190eefac1b9b2662483cf6404
/* 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 <apr.h>
#include <apr_pools.h>
#include <apr_network_io.h>
#include <apr_thread_proc.h>
#include <apr_getopt.h>
#include <apr_portable.h>
#include <stdlib.h> /* For EXIT_SUCCESS, EXIT_FAILURE */
#endif
#include <unistd.h> /* For execl */
#endif
static const char *usage_message =
"usage: fcgistarter -c <command> -p <port> [-i <interface> -N <num>]\n"
"\n"
"If an interface is not specified, any available will be used.\n";
static void usage(void)
{
}
{
char buffer[1024];
"%s: %s\n",
func,
}
{
/* Command line arguments */
if (rv) {
return EXIT_FAILURE;
}
for (;;) {
const char *arg;
char opt;
if (APR_STATUS_IS_EOF(rv)) {
break;
} else if (rv) {
usage();
} else {
switch (opt) {
case 'c':
break;
case 'p':
if (! port) {
usage();
}
break;
case 'i':
break;
case 'N':
if (! num_to_start) {
usage();
}
break;
default:
break;
}
}
}
usage();
}
if (rv) {
}
if (rv) {
}
if (rv) {
}
if (rv) {
}
if (rv) {
}
if (rv) {
}
#error "Please implement me."
#else
while (--num_to_start >= 0) {
if (rv == APR_INCHILD) {
apr_os_file_t oft = 0;
/* Ok, so we need a file that has file descriptor 0 (which
* FastCGI wants), but points to our socket. This isn't really
* possible in APR, so we cheat a bit. I have no idea how to
* do this on a non-unix platform, so for now this is platform
* specific. Ick.
*
* Note that this has to happen post-detach, otherwise fd 0
* gets closed during apr_proc_detach and it's all for nothing.
*
* Unfortunately, doing this post detach means we have no way
* to let anyone know if there's a problem at this point :( */
if (rv) {
}
if (rv) {
}
pool);
if (rv) {
}
if (rv) {
}
/* XXX Can't use apr_proc_create because there's no way to get
* infd into the procattr without going through another dup2,
* which means by the time it gets to the fastcgi process it
* is no longer fd 0, so it doesn't work. Sigh. */
} else if (rv == APR_INPARENT) {
if (num_to_start == 0) {
}
} else {
}
}
#endif
return EXIT_SUCCESS;
}