The
rfork_thread ();
function
is a helper function for
rfork(2).
It arranges for a new process to be created and the child process will
call the specified function with the specified argument, while running on
the supplied stack.
Using this function should avoid the need to implement complex stack
swap code.
RETURN VALUES
Upon successful completion,
rfork_thread ();
returns the process ID of the child process to the parent process.
Otherwise, a value of -1 is returned
to the parent process, no child process is created, and the global
variable
errno
is set to indicate the error.
The child process context is not aware of a return from the
rfork_thread ();
function as it begins executing directly with the supplied function.