Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:tracing_buffers_read

Proto:static ssize_t tracing_buffers_read(struct file *filp, char __user *ubuf, size_t count, loff_t *ppos)

Type:ssize_t

Parameter:

TypeParameterName
struct file *filp
char __user *ubuf
size_tcount
loff_t *ppos
7346  info = needed for tty driver, and maybe others
7347  iter = iter
7348  ret = 0
7351  If Not count Then Return 0
7359  If Not spare Then
7360  spare = g_buffer_alloc_read_page - allocate a page to read from buffer*@buffer: the buffer to allocate for
7362  If IS_ERR(spare) Then
7363  ret = PTR_ERR(spare)
7364  spare = NULL
7365  Else
7366  spare_cpu = cpu_file
7369  If Not spare Then Return ret
7373  If read < PAGE_SIZE Then Go to read
7376  again :
7377  trace_access_lock(cpu_file)
7378  ret = g_buffer_read_page - extract a page from the ring buffer*@buffer: buffer to extract from*@data_page: the page to use allocated from ring_buffer_alloc_read_page*@len: amount to extract*@cpu: the cpu of the buffer to extract
7382  trace_access_unlock(cpu_file)
7384  If ret < 0 Then
7385  If trace_empty(iter) Then
7386  If f_flags & O_NONBLOCK Then Return -EAGAIN
7389  ret = wait_on_pipe(iter, 0)
7390  If ret Then Return ret
7393  Go to again
7395  Return 0
7398  read = 0
7399  read :
7400  size = PAGE_SIZE - read
7401  If size > count Then size = count
7404  ret = copy_to_user(ubuf, spare + read, size)
7405  If ret == size Then Return -EFAULT
7408  size -= ret
7410  ppos += size
7411  read += size
7413  Return size