函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\cgroup\cgroup.c Create Date:2022-07-27 12:13:18
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:proc_cgroup_show()* - Print task's cgroup paths into seq_file, one line for each hierarchy* - Used for /proc/<pid>/cgroup.

函数原型:int proc_cgroup_show(struct seq_file *m, struct pid_namespace *ns, struct pid *pid, struct task_struct *tsk)

返回类型:int

参数:

类型参数名称
struct seq_file *m
struct pid_namespace *ns
struct pid *pid
struct task_struct *tsk
5788  retval等于负ENOMEM
5789  buf等于开辟内存
5790  如果非buf则转到:out
5793  mutex_lock( & cgroup_mutex is the master lock)
5794  spin_lock_irq( & css_set_lock)
5796  rate across the hierarchies (root)
5799  count等于0
5801  如果root恒等于The default hierarchy, reserved for the subsystems that are otherwise* unattached - it never has more than a single cgroup, and all tasks are* part of that cgroup.且非The default hierarchy always exists but is hidden until mounted for the* first time. This is for backward compatibility.则继续下一循环
5804  seq_printf(m, "%d:", Unique id for this hierarchy. )
5805  如果root不等于The default hierarchy, reserved for the subsystems that are otherwise* unattached - it never has more than a single cgroup, and all tasks are* part of that cgroup.r_each_subsys - iterate all enabled cgroup subsystems*@ss: the iteration cursor*@ssid: the index of @ss, CGROUP_SUBSYS_COUNT after reaching the end(ss, ssid)
5807  如果 The bitmask of subsystems attached to this hierarchy 按位与1左移ssid位则seq_printf(m, "%s%s", count++ ? "," : "", optional, initialized automatically during boot if not set )
5810  如果strlen - Find the length of a string*@s: The string to be sizedseq_printf(m, "%sname=%s", count ? "," : "", The name for this hierarchy - may be empty )
5813  seq_putc(m, ':')
5815  cgrp等于Return the cgroup for "task" from the given hierarchy. Must be* called with cgroup_mutex and css_set_lock held.
5831  如果retval小于0则转到:out_unlock
5834  seq_puts(m, buf)
5835  否则
5836  seq_puts(m, "/")
5839  如果group_on_dfl - test whether a cgroup is on the default hierarchy*@cgrp: the cgroup of interest* The default hierarchy is the v2 interface of cgroup and this function* can be used to test whether a cgroup is on the default hierarchy for* cases where a cgroup_is_dead(cgrp)则seq_puts(m, " (deleted)\n")
5841  否则seq_putc(m, '\n')
5845  retval等于0
5846  out_unlock :
5847  spin_unlock_irq( & css_set_lock)
5848  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
5849  kfree(buf)
5850  out :
5851  返回:retval