Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Notify userspace when a cgroup is released, by running the* configured release agent with the name of the cgroup (path* relative to the root of cgroup file system) as the argument

Proto:void cgroup1_release_agent(struct work_struct *work)

Type:void

Parameter:

TypeParameterName
struct work_struct *work
777  cgrp = container_of - cast a member of a structure out to the containing structure*@ptr: the pointer to the member.*@type: the type of the container struct this is embedded in.*@member: the name of the member within the struct.(work, structcgroup, release_agent_work)
779  char * pathbuf = NULL, * agentbuf = NULL
780  char * argv[3], * envp[3]
783  mutex_lock( & cgroup_mutex is the master lock)
785  pathbuf = Allocation memory
786  agentbuf = kstrdup( The path to use for release notifications. , GFP_KERNEL)
787  If Not pathbuf || Not agentbuf Then Go to out
790  spin_lock_irq( & css_set_lock)
791  ret = cgroup_path_ns_locked(cgrp, pathbuf, # chars in a path name including nul , & cgroup namespace for init task )
792  spin_unlock_irq( & css_set_lock)
793  If ret < 0 || ret >= # chars in a path name including nul Then Go to out
796  argv[0] = agentbuf
797  argv[1] = pathbuf
798  argv[2] = NULL
801  envp[0] = "HOME=/"
802  envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin"
803  envp[2] = NULL
805  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.
806  all_usermodehelper() - prepare and start a usermode application*@path: path to usermode executable*@argv: arg vector for process*@envp: environment for process*@wait: wait for the application to finish and return status
807  Go to out_free
808  out :
809  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.
810  out_free :
811  kfree(agentbuf)
812  kfree(pathbuf)