函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\fork.c Create Date:2022-07-27 09:58:13
Last Modify:2020-03-17 11:04:53 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:分裂进程

函数原型:long _do_fork(struct kernel_clone_args *args)

返回类型:long

参数:

类型参数名称
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  如果非clone_flags按位与set if the tracing process can't force CLONE_PTRACE on this clone 的值则
2410  如果clone_flags按位与父进程被挂起,直至子进程释放虚拟内存资源trace等于PTRACE_EVENT_VFORK
2412  否则如果exit_signal不等于SIGCHLDtrace等于PTRACE_EVENT_CLONE
2414  否则trace等于Wait extended result codes for the above trace options.
2417  如果此条件成立可能性大(为编译器优化)(!判断启用了跟踪)则trace等于0
2421  p等于创建进程
2422  add_latent_entropy()
2424  如果是错误则返回:错误
2431  Tracepoint for do_fork:
2433  pid等于get_task_pid(p, 单一进程)
2434  nr等于pid_vnr(pid)
2436  如果clone_flags按位与与父共享tidput_user - Write a simple value into user space(nr, parent_tid)
2439  如果clone_flags按位与父进程被挂起,直至子进程释放虚拟内存资源
2440  完成量等于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  如果此条件成立可能性小(为编译器优化)(trace)则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  如果clone_flags按位与父进程被挂起,直至子进程释放虚拟内存资源
2452  如果非wait_for_vfork_done(p, & vfork)则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  返回:nr
调用者
名称描述
do_fork分裂出子进程
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.