Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:trace_pid_write

Proto:int trace_pid_write(struct trace_pid_list *filtered_pids, struct trace_pid_list **new_pid_list, const char __user *ubuf, size_t cnt)

Type:int

Parameter:

TypeParameterName
struct trace_pid_list *filtered_pids
struct trace_pid_list **new_pid_list
const char __user *ubuf
size_tcnt
518  nr_pids = 0
519  read = 0
520  ret = 0
524  If race_parser_get_init - gets the buffer for trace parser Then Return -ENOMEM
533  pid_list = Allocation memory
534  If Not pid_list Then
535  race_parser_put - frees the buffer for trace parser
536  Return -ENOMEM
539  pid_max = READ_ONCE(PID filtering )
542  If filtered_pids && pid_max > pid_max Then pid_max = pid_max
545  pids = vzalloc((pid_max + 7) >> 3)
546  If Not pids Then
547  race_parser_put - frees the buffer for trace parser
548  kfree(pid_list)
549  Return -ENOMEM
552  If filtered_pids Then
556  Atomically set a bit in memory
557  nr_pids++
561  When cnt > 0 cycle
563  pos = 0
565  ret = race_get_user - reads the user input string separated by space* (matched by isspace(ch))* For each string found the 'struct trace_parser' is updated,* and the function returns.* Returns number of bytes read.* See kernel/trace/trace
566  If ret < 0 || Not trace_parser_loaded( & parser) Then Break
569  read += ret
570  ubuf += ret
571  cnt -= ret
573  ret = -EINVAL
574  If kstrtoul - convert a string to an unsigned long*@s: The start of the string. The string must be null-terminated, and may also* include a single newline before its terminating null. The first character* may also be a plus sign, but not a minus sign. Then Break
576  If val >= pid_max Then Break
579  pid = val
581  Atomically set a bit in memory
582  nr_pids++
584  trace_parser_clear( & parser)
585  ret = 0
587  race_parser_put - frees the buffer for trace parser
589  If ret < 0 Then
590  trace_free_pid_list(pid_list)
591  Return ret
594  If Not nr_pids Then
596  trace_free_pid_list(pid_list)
597  read = ret
598  pid_list = NULL
601  new_pid_list = pid_list
603  Return read
Caller
NameDescribe
ftrace_event_pid_write
ftrace_pid_write