UTIL: Add socketpair() function to util.[ch]

Like pipe(2), socketpair(2) allows you to get to FDs which are joined together.
Socketpairs are, however, bidirectional which means a pair of FDs can be used
to communicate back and forth between processes.

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
SERVICES: Add a services API for spawning processes

This new services API will be used to spawn processes such as FastCGI or CGI
processes.   It allows for FDs to be passed through to be bound to the child
process and operates over a socketpair(2) for that very reason.

The spawn marshalling code comes from spawner.[ch] and from main.c.

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
SERVICES: Replace spawner with calls to services.

The old spawner API has been replaced with the new services API.  This new API
supports passing FDs across to the spawned process which could be used by the
FCGI spawner to pass sockets across in future.

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
CGI: Use new services API to spawn CGIs

The use of the new services API to spawn CGI processes means that we can
support running CGIs as their owners even when the web server process has been
de-privileged.

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
SERVICES: Restart interrupted services syscalls

Under some platforms (e.g. Linux ARMv4 LE SFP) the thread which
handles signals is not as useful as others.  If the services
thread ended up handling a SIGCHLD which didn't happen all the
time but could happen sometimes, then it would cease processing
service requests.

This fixes this problem.

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
MAIN: Do not start services when starting valgrind

Services should not be started if the main process is to be re-run under
valgrind.

This prevents extra FD leakage.

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
A test for issue #1140
Maintain keep-alive for replies without body. Fix #1140

Cherokee closed the keep-alive connection for 204 No Content and
304 Not Modified replies. As you may understand especially the latter
has a serious performance implication in real life situation. This patch
addresses that.
Merge branch 'kinnison/child-helper' of github.com:kinnison/webserver into kinnison-kinnison/child-helper
Cosmetic changes in for loops
Initialise child pid with -1
Tabs to spaces
Remove duplicate return ret_error;
Cosmetic change
Signals start at 1.
Remove the duplicate cherokee_reset_signals() code.
Tabs to spaces, printf to PRINT_MSG / PRINT_MSG_S
Merge pull request #1142 from cherokee/kinnison-kinnison/child-helper

First of all I want to thank @kinnison a billion for working on this code. It is a piece of art and moves cherokee back on track. Our users will be sincerely pleased with the robustness of this code. Processes are being able to run as their file owner (old school CGI style), or a pre-configured source with changed ownership.
Merge pull request #1143 from cherokee/1140_maintain_keepalive

Maintain keep-alive with 204 and 304 replies
fix-1093