Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\exit.c Create Date:2022-07-28 09:03:26
Last Modify:2020-03-17 11:17:32 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Handle sys_wait4 work for one task in state EXIT_ZOMBIE. We hold* read_lock(&tasklist_lock) on entry. If we return zero, we still hold* the lock and this task is uninteresting. If we return nonzero, we have

Proto:static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p)

Type:int

Parameter:

TypeParameterName
struct wait_opts *wo
struct task_struct *p
977  pid = task_pid_vnr(p)
978  uid = from_kuid_munged(current_user_ns(), task_uid(p))
981  If Not Value is more likely to compile time(wo_flags & WEXITED) Then Return 0
984  If Value for the false possibility is greater at compile time(wo_flags & Don't reap, just poll status. ) Then
985  status = exit code
986  get_task_struct(p)
987  read_unlock( & tasklist_lock)
988  sched_annotate_sleep()
989  If wo_rusage Then getrusage(p, sys_wait4() uses this , wo_rusage)
991  put_task_struct(p)
992  Go to out_info
997  state = If ptrace_reparented(p) && thread_group_leader(p) Then EXIT_TRACE Else Used in tsk->exit_state:
999  If cmpxchg( & exit state, EXIT_ZOMBIE, state) != EXIT_ZOMBIE Then Return 0
1004  read_unlock( & tasklist_lock)
1005  sched_annotate_sleep()
1010  If state == Used in tsk->exit_state: && thread_group_leader(p) Then
1011  sig = Signal handlers:
1012  psig = signal
1036  thread_group_cputime_adjusted(p, & tgutime, & tgstime)
1037  spin_lock_irq( & siglock)
1038  Lock out other writers and update the count.* Acts like a normal spin_lock/unlock.* Don't need preempt_disable() because that is in the spin_lock already.
1039  cutime += tgutime + cutime
1040  cstime += tgstime + cstime
1041  cgtime += task_gtime(p) + gtime + cgtime
1042  cmin_flt += MM fault and swap info: this can arguably be seen as either mm-specific or thread-specific: + min_flt + cmin_flt
1044  cmaj_flt += maj_flt + maj_flt + cmaj_flt
1046  cnvcsw += Context switch counts: + nvcsw + cnvcsw
1048  cnivcsw += nivcsw + nivcsw + cnivcsw
1050  cinblock += task_io_get_inblock(p) + inblock + cinblock
1053  coublock += task_io_get_oublock(p) + oublock + coublock
1056  maxrss = max - return maximum of two values of the same or compatible types*@x: first value*@y: second value(maxrss, cmaxrss)
1057  If cmaxrss < maxrss Then cmaxrss = maxrss
1059  task_io_accounting_add( & ioac, & ioac)
1060  task_io_accounting_add( & ioac, & ioac)
1061  write_sequnlock( & Cumulative resource counters for dead threads in the group,* and for reaped dead child processes forked by this group.* Live threads maintain their own counters and add to these* in __exit_signal, except for the group leader.)
1062  spin_unlock_irq( & siglock)
1065  If wo_rusage Then getrusage(p, sys_wait4() uses this , wo_rusage)
1067  status = If Per task flags (PF_*), defined further below: & group exit in progress Then group_exit_code Else exit code
1069  wo_stat = status
1071  If state == EXIT_TRACE Then
1072  write_lock_irq( & tasklist_lock)
1074  ptrace_unlink(p)
1077  state = EXIT_ZOMBIE
1078  If do_notify_parent(p, exit signal) Then state = Used in tsk->exit_state:
1080  exit state = state
1081  write_unlock_irq( & tasklist_lock)
1083  If state == Used in tsk->exit_state: Then release_task(p)
1086  out_info :
1087  infop = wo_info
1088  If infop Then
1089  If (status & 0x7f) == 0 Then
1091  status = status >> 8
1092  Else
1094  status = status & 0x7f
1096  pid = pid
1097  uid = uid
1100  Return pid
Caller
NameDescribe
wait_consider_taskConsider @p for a wait by @parent