The Server class performs the server startup functions that are common to most/all Archiveopteryx servers. The functions are performed in a fixed order - you call setup( x ) to continue up to stage x, then return.
Constructs a Server for name. name will be used for the pid file, etc. argc and argv are parsed to find command-line options.
Reads server configuration, either from the default config file or from the one supplied in argc.
Closes all files except stdout and stderr. Attaches stdin to /dev/null in case something uses it. stderr is kept open so that we can tell our daddy about any disasters.
Forks the server as required by -f and the configuration variable server-processes.
If -f is specified, the parent exits in this function and does not return from this function.
As many processes as specified by server-processes return.
Called by signal handling to kill any children started in fork().
Creates the global logging context, and sets up a LogClient if no Logger has been created already.
This also creates the Loop object, so that the LogClient doesn't feel alone in the world, abandoned by its parents, depressed and generally bad.
Logs the startup details. By this time, the logger must be in working order.
Initializes the global event loop.
Maintains the requisite number of children. Only child processes return from this function.
This static function returns the name of the application. Is server the right way to publicise this name?
Resolves any domain names used in the configuration file before we chroot.
Writes the server's pid to an almost hardcoded pidfile. We don't lock the file, since most of these servers don't have a problem with multiple instances of themselves. The pidfile is just a convenience for tools like start-stop-daemon.
Finishes setup and runs the main loop of the server.
Loses all rights. Dies with an error if that isn't possible, or if anything fails.
Notifies the Server that it is to chroot according to mode. If mode is JailDir, secure() will chroot into the jail directory and check that '/' is inaccesssible. If mode is LogDir, secure() will chroot into the logfile directory, where the server hopefully can access the logfile.
Performs server setup for each stage up to but NOT including s.
Returns true if this server is configured to cache this and that, and false if it shouldn't cache.
Running without cache is a debugging aid.
This web page based on source code belonging to The Archiveopteryx Developers. All rights reserved.