Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\sys.c Create Date:2022-07-28 09:20:56
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:getrusage

Proto:void getrusage(struct task_struct *p, int who, struct rusage *r)

Type:void

Parameter:

TypeParameterName
struct task_struct *p
intwho
struct rusage *r
1712  maxrss = 0
1714  memset((char * )r, 0, size of r )
1715  utime = stime = 0
1717  If who == ly the calling thread Then
1718  task_cputime_adjusted(current process, & utime, & stime)
1719  It would make sense to put struct rusage in the task_struct,* except that would make the task_struct be *really big*
1720  maxrss = maxrss
1721  Go to out
1724  If Not lock_task_sighand(p, & flags) Then Return
1728  Case who == sys_wait4() uses this
1729  Case who == RUSAGE_CHILDREN
1730  utime = cutime
1731  stime = cstime
1732  voluntary context switches = cnvcsw
1733  involuntary " = cnivcsw
1734  page reclaims = cmin_flt
1735  page faults = cmaj_flt
1736  block input operations = cinblock
1737  block output operations = coublock
1738  maxrss = cmaxrss
1740  If who == RUSAGE_CHILDREN Then Break
1744  Case who == Definition of struct rusage taken from BSD 4.3 Reno* We don't support all of these yet, but we might as well have them....* Otherwise, each time we add new items, programs which depend on this* structure will lose
1745  thread_group_cputime_adjusted(p, & tgutime, & tgstime)
1746  utime += tgutime
1747  stime += tgstime
1748  voluntary context switches += Context switch counts:
1749  involuntary " += nivcsw
1750  page reclaims += MM fault and swap info: this can arguably be seen as either mm-specific or thread-specific:
1751  page faults += maj_flt
1752  block input operations += inblock
1753  block output operations += oublock
1754  If maxrss < maxrss Then maxrss = maxrss
1756  t = p
1757  Do
1760  Break
1762  Default
1763  BUG()
1765  unlock_task_sighand(p, & flags)
1767  out :
1768  user time used = ns_to_kernel_old_timeval(utime)
1769  system time used = ns_to_kernel_old_timeval(stime)
1771  If who != RUSAGE_CHILDREN Then
1774  If mm Then
1779  maximum resident set size = maxrss * PAGE_SIZE / 1024
Caller
NameDescribe
wait_task_zombieHandle 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
wait_task_stoppedwait_task_stopped - Wait for %TASK_STOPPED or %TASK_TRACED*@wo: wait options*@ptrace: is the wait for ptrace*@p: task to wait for* Handle sys_wait4() work for %p in state %TASK_STOPPED or %TASK_TRACED
wait_task_continuedHandle do_wait work for one task in a live, non-stopped state.* 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
SYSCALL_DEFINE2
COMPAT_SYSCALL_DEFINE2