Function Report

Linux Kernel (v4.4)

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

Function Name:dup_task_struct

Function:static struct task_struct * dup_task_struct(struct task_struct *orig)

Return Type:static struct task_struct *

Parameter:

Type Parameter NameRemarks
struct task_struct * orig

Function description:Replication process and set stack

338  called from do_fork() to get node information for about to be created task
341  tsk = Allocation memory for process
342  If !tsk then Returning NULL
345  ti = Allocation memory for thread
346  If !ti then Go to free_tsk
349  Copy the parent process information
350  If result of Copy the parent process information then Go to free_ti
353  pointer of stack = ti
361  must only be accessed from the context of current as there is no read locking. = NULL
364  Set thread stack
365  clear_user_return_notifier(tsk)
366  clear_tsk_need_resched(tsk)
367  set_task_stack_end_magic(tsk)
377  set atomic variable
379  btrace_seq = 0
381  cache last used pipe for splice = NULL
382  page = NULL
383  Wake-queues are lists of tasks with a pending wakeup, whose callers have already marked the task as woken internally, and can thus carry on. A common use case is being able to do the wakeups once the corresponding user lock as been released. = NULL
385  account_kernel_stack(ti, 1)
387  Returning tsk
389  free_ti
390  free_thread_info(ti)
391  free_tsk
392  free_task_struct(tsk)
393  Returning NULL
Caller
Function NameFunction description
copy_processCreate a new process