fork extension adds three functions, as follows.
This is how you load the extension.
pid = fork()
This function creates a new process. The return value is zero in the
child and the process-ID number of the child in the parent, or -1
upon error. In the latter case,
ERRNO indicates the problem.
In the child,
updated to reflect the correct values.
ret = waitpid(pid)
This function takes a numeric argument, which is the process-ID to
wait for. The return value is that of the
waitpid() system call.
ret = wait()
This function waits for the first child to die.
The return value is that of the
wait() system call.
There is no corresponding
Here is an example:
@load "fork" … if ((pid = fork()) == 0) print "hello from the child" else print "hello from the parent"