Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\acct.c Create Date:2022-07-28 11:01:03
Last Modify:2020-03-17 15:14:29 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:acct_on

Proto:static int acct_on(struct filename *pathname)

Type:int

Parameter:

TypeParameterName
struct filename *pathname
197  ns = task_active_pid_ns(current process)
202  acct = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
203  If Not acct Then Return -ENOMEM
207  file = file_open_name(pathname, O_WRONLY | O_APPEND | O_LARGEFILE, 0)
208  If IS_ERR(file) Then
209  kfree(acct)
210  Return PTR_ERR(file)
213  If Not S_ISREG(i_mode) Then
214  kfree(acct)
215  filp_close(file, NULL)
216  Return -EACCES
219  If Not (f_mode & Has write method(s) ) Then
220  kfree(acct)
221  filp_close(file, NULL)
222  Return -EIO
224  internal = mnt_clone_internal( & f_path)
225  If IS_ERR(internal) Then
226  kfree(acct)
227  filp_close(file, NULL)
228  Return PTR_ERR(internal)
230  err = __mnt_want_write(internal)
231  If err Then
232  mntput(internal)
233  kfree(acct)
234  filp_close(file, NULL)
235  Return err
237  mnt = mnt
238  mnt = internal
240  atomic_long_set( & count, 1)
241  init_fs_pin( & pin, acct_pin_kill)
242  file = file
243  needcheck = jiffies
244  ns = ns
245  mutex_init - initialize the mutex*@mutex: the mutex to be initialized* Initialize the mutex to unlocked state.* It is not allowed to initialize an already locked mutex.( & lock)
246  INIT_WORK( & work, close_work)
247  init_completion( & done)
248  mutex_lock_nested( & lock, 1)
249  pin_insert( & pin, mnt)
251  _read_lock() - mark the beginning of an RCU read-side critical section* When synchronize_rcu() is invoked on one CPU while other CPUs* are within RCU read-side critical sections, then the* synchronize_rcu() is guaranteed to block until after all the other
252  old = xchg( & bacct, & pin)
253  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.
254  pin_kill(old)
255  __mnt_drop_write(mnt)
256  mntput(mnt)
257  Return 0
Caller
NameDescribe
SYSCALL_DEFINE1sys_acct - enable/disable process accounting*@name: file name for accounting records or NULL to shutdown accounting* Returns 0 for success or negative errno values for failure.* sys_acct() is the only system call needed to implement process* accounting