FORK

Section: MINTLIB LIBRARY FUNCTIONS (3)
Updated: 3 March 1993
Index Return to Main Contents
 

NAME

fork - create a new process  

SYNOPSIS

#include <unistd.h>

int fork(void);
 

DESCRIPTION

fork creates a copy of the current process using Pfork. This call splits the program into two copies, both of which continue to run. The only difference between the two is the returned value. In one of these processes, the child, this is zero. In the other, the parent, it is non-zero; it is the process ID of the child (a positive number), or a negative error code if the call failed.  

SEE ALSO

exec..(3), tfork(3), vfork(3), wait(3)  

NOTES

At the moment (MiNT 0.99 and earlier), Pfork, and consequently also fork, suspends the parent until the child has terminated or overlays itself. This has yet to be fixed, and may cause problems when porting UN*X programs. There are various intricate differences between the parent and the child process, like the effects of closing a file on which a lock has been obtained (the parent owns the locks). You are advised to check the man pages for Pfork and Pvfork, in addition to the kernel sources, if you really want to know.
 

Index

NAME
SYNOPSIS
DESCRIPTION
SEE ALSO
NOTES

This document was created by man2html, using the manual pages.
Time: 08:59:05 GMT, February 14, 2025