fork function


fork spawns a copy of the running process. The copy (or child) has a copy of the parent process stack, data area and heap and starts execution after the fork statement. fork is of use when you wish to write daemon processes.


	Library: unistd.h
	Prototype: pid_t fork(void);
	Syntax: pid_t PID
 PID = fork();

On completion, PID will have one of the following values:

> 0 == the childs process ID.
 0 == is returned to the child process.
 < 0 == an error occoured. No child created, errno is set to indicate the problem 

Examples:

example program.

See Also:

pipe function.

execl function.

threads



Martin Leslie

AltStyle によって変換されたページ (->オリジナル) /