Archx86kernelprocess32c

asmlinkage int sys_fork(struct pt_regs regs) {

return do_fork(SIGCHLD, regs.esp, &regs, 0, NULL, NULL);

The only flag used is sigchld. This means that the sigchld signal informs the parent process once the child process has terminated. Initially, the same stack (whose start address is held in the esp register on IA-32 systems) is used for the parent and child processes. However, the COW mechanism creates a copy of the stack for each process if it is manipulated and therefore written to.

If do_fork was successful, the PID of the newly created task is returned as the result of the system call. Otherwise the (negative) error code is returned.

The implementation of sys_vfork differs only slightly from that of sys_fork in that additional flags are used (clone_vfork and clone_vm whose meaning is discussed below).

sys_clone is also implemented in a similar way to the above calls with the difference that do_fork is invoked as follows:

Continue reading here: Archx86kernelprocess32c

Was this article helpful?

0 0