Function Report

Linux Kernel (v4.4)

Source File:kernel\fork.c Create Date:2016-01-14 10:16:58
Last Modify:2016-01-11 07:01:32 Copyright©Brick
home page Tree
Annotate the kernelChinese

Function Name:_do_fork

Function:long _do_fork(unsigned long clone_flags, unsigned long stack_start, unsigned long stack_size, int *parent_tidptr, int *child_tidptr, unsigned long tls)

Return Type:long


Type Parameter NameRemarks
unsigned long clone_flags
unsigned long stack_start
unsigned long stack_size
int * parent_tidptr
int * child_tidptr
unsigned long tls

Function description:fork routine

1701  trace = 0
1710  If !(clone_flags & set if the tracing process can't force CLONE_PTRACE on this clone) then
1711  If clone_flags & set if the parent wants the child to wake it up on mm_release then trace = PTRACE_EVENT_VFORK
1713  Else if (clone_flags & signal mask to be sent at exit) != SIGCHLD then trace = PTRACE_EVENT_CLONE
1715  Else trace = Wait extended result codes for the above trace options.
1718  If Value is more likely to compile time then trace = 0
1723  p = Create a new process
1728  If !IS_ERR(p) then
1732  trace_sched_process_fork(current process, p)
1734  pid = get_task_pid(p, PIDTYPE_PID)
1735  pid_vnr(pid)
1737  If clone_flags & set the TID in the parent then Write a simple value into user space
1741  for vfork() = &vfork
1746  wake up a newly created task for the first time.
1749  If Value for the false possibility is greater at compile time then possibly stop for a ptrace event notification
1757  put_pid(pid)
1758  Else
1759  PTR_ERR(p)
1761  Returning result of PTR_ERR(p)
Function NameFunction description
do_forkFor compatibility with architectures that call do_fork directly rather than using the syscall entry points below.
kernel_threadCreate a kernel thread.