[Date Prev][Date Next] [Chronological] [Thread] [Top]

fork/exec issues (Was: VM/ESA patches)

There are a number of places in the code in which we use
fork() and exec() calls.  The uses can be categorized as

1) fork() to "detach" daemon

2) fork() to handle a task concurrently
	primarily client daemons (in.fingerd, etc)

3) fork()/exec() to call external programs.
	a) EDITOR (ud, ldbmtest)
	b) general child processes (ldif2ldbm, etc)
	c) slapd/back-shell

Case 1:
Detaching is done within lutil_detach().  If fork()
is unavailable (or unusable), we can just skip the call.
If the platform requires specific calls to detach, they
should be placed in lutil_detach().

Case 2:
This can be handled by using threads to replace the
fork.  This could done optionally (such as in Neale's
patches) or always.  I prefer the later.

Case 3a:
This could be handled by system() as the command to
execute is user specified (via $EDITOR).

Case 3b:
I believe we should implement a lutil_spawn() to handle
this case in ldif2ldbm and elsewehre.   lutil_spawn()
would use fork/exec or spawn or whatever.

Case 3c:
This is a very special as the application is threaded.
We actually should spin off a surrogate parent before
creating any threads to handle the spawning.