Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\fork.c Create Date:2022-07-28 08:58:43
Last Modify:2020-03-17 11:04:53 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:fork routine

Proto:long _do_fork(struct kernel_clone_args *args)

Type:long

Parameter:

TypeParameterName
struct kernel_clone_args *args>exit_signal is expected to be checked for sanity by the caller.
2396  clone_flags = flags
2400  trace = 0
2409  If Not (clone_flags & set if the tracing process can't force CLONE_PTRACE on this clone ) Then
2410  If clone_flags & set if the parent wants the child to wake it up on mm_release Then trace = PTRACE_EVENT_VFORK
2412  Else if exit_signal != SIGCHLD Then trace = PTRACE_EVENT_CLONE
2414  Else trace = Wait extended result codes for the above trace options.
2417  If Value is more likely to compile time(!ptrace_event_enabled - test whether a ptrace event is enabled*@task: ptracee of interest*@event: %PTRACE_EVENT_* to test* Test whether @event is enabled for ptracee @task.* Returns %true if @event is enabled, %false otherwise.) Then trace = 0
2421  p = Create a new process
2422  add_latent_entropy()
2424  If IS_ERR(p) Then Return PTR_ERR(p)
2431  Tracepoint for do_fork:
2433  pid = get_task_pid(p, PIDTYPE_PID)
2434  nr = pid_vnr(pid)
2436  If clone_flags & set the TID in the parent Then Write a simple value into user space(nr, parent_tid)
2439  If clone_flags & set if the parent wants the child to wake it up on mm_release Then
2440  vfork_done = vfork
2441  init_completion( & vfork)
2442  get_task_struct(p)
2445  wake_up_new_task - wake up a newly created task for the first time.* This function will do some initial scheduler statistics housekeeping* that must be done for every newly created context, then puts the task* on the runqueue and wakes it.
2448  If Value for the false possibility is greater at compile time(trace) Then ptrace_event_pid - possibly stop for a ptrace event notification*@event: %PTRACE_EVENT_* value to report*@pid: process identifier for %PTRACE_GETEVENTMSG to return* Check whether @event is enabled and, if so, report @event and @pid* to the ptrace parent
2451  If clone_flags & set if the parent wants the child to wake it up on mm_release Then
2452  If Not wait_for_vfork_done(p, & vfork) Then ptrace_event_pid - possibly stop for a ptrace event notification*@event: %PTRACE_EVENT_* value to report*@pid: process identifier for %PTRACE_GETEVENTMSG to return* Check whether @event is enabled and, if so, report @event and @pid* to the ptrace parent
2456  put_pid(pid)
2457  Return nr
Caller
NameDescribe
do_forkFor compatibility with architectures that call do_fork directly rather than* using the syscall entry points below.
kernel_threadCreate a kernel thread.
sys_fork
sys_vfork
SYSCALL_DEFINE5
SYSCALL_DEFINE2lone3 - create a new process with specific properties*@uargs: argument structure*@size: size of @uargs* clone3() is the extensible successor to clone()/clone2().* It takes a struct as argument that is versioned by its size.