函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:trace_uprobe_create

函数原型:static int trace_uprobe_create(int argc, const char **argv)

返回类型:int

参数:

类型参数名称
intargc
const char **argv
536  event等于NULL, group等于UPROBE_EVENT_SYSTEM
541  bool is_return = false
544  ret等于0
545  ref_ctr_offset等于0
548  :argv[0][0]恒等于'r'
549  is_return = true
550  退出
551  :argv[0][0]恒等于'p'
552  退出
553  默认
554  返回:负ECANCELED
557  如果argc小于2则返回:负ECANCELED
560  如果argv[0][1]恒等于':'则event等于argv[0][2]
563  如果非strchr - Find the first occurrence of the character c in the string s.*@s: the string to be searched*@c: the character to search for则返回:负ECANCELED
566  filename等于kstrdup(argv[1], GFP_KERNEL)
567  如果非filename则返回:负ENOMEM
571  arg等于strrchr - Find the last occurrence of a character in a string*@s: The string to be searched*@c: The character to search for
572  如果非arg或非是数字
573  kfree(filename)
574  返回:负ECANCELED
577  trace_probe_log_init("trace_uprobe", argc, argv)
578  trace_probe_log_set_index(1)
580  arg自加等于'\0'
581  ret等于kern_path(filename, llow links at the end , & path)
582  如果ret
583  trace_probe_log_err(0, FILE_NOT_FOUND)
584  kfree(filename)
585  trace_probe_log_clear()
586  返回:ret
588  如果非d_is_reg(dentry)则
589  trace_probe_log_err(0, NO_REGULAR_FILE)
590  ret等于负EINVAL
591  转到:fail_address_parse
595  rctr等于strchr - Find the first occurrence of the character c in the string s.*@s: the string to be searched*@c: the character to search for
596  如果rctr
597  rctr_end等于strchr - Find the first occurrence of the character c in the string s.*@s: the string to be searched*@c: the character to search for
598  如果非rctr_end
599  ret等于负EINVAL
603  转到:fail_address_parse
604  否则如果rctr_end[1]不等于'\0'则
605  ret等于负EINVAL
608  转到:fail_address_parse
611  rctr自加等于'\0'
612  rctr_end等于'\0'
613  ret等于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.
614  如果ret
616  转到:fail_address_parse
621  ret等于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.
622  如果ret
623  trace_probe_log_err(arg - filename, BAD_UPROBE_OFFS)
624  转到:fail_address_parse
628  trace_probe_log_set_index(0)
629  如果event
630  ret等于@buf must has MAX_EVENT_NAME_LEN size
632  如果ret则转到:fail_address_parse
634  否则
638  tail等于kstrdup(返回路径的最后一部分, GFP_KERNEL)
639  如果非tail
640  ret等于负ENOMEM
641  转到:fail_address_parse
644  ptr等于strpbrk - Find the first occurrence of a set of characters*@cs: The string to be searched*@ct: The characters to search for
645  如果ptrptr等于'\0'
648  snprintf - Format a string and place it in a buffer*@buf: The buffer to place the result into*@size: The size of the buffer, including the trailing null space*@fmt: The format string to use*@
649  event等于buf
650  kfree(tail)
653  argc减等于2
654  argv加等于2
656  tu等于Allocate new trace_uprobe and initialize it (including uprobes).
657  如果是错误
658  ret等于错误
660  WARN_ON_ONCE(ret != - ENOMEM)
661  转到:fail_address_parse
663  offset等于offset
664  ref_ctr_offset等于ref_ctr_offset
665  path等于path
666  filename等于filename
669 i小于argci小于MAX_TRACE_ARGS循环
670  tmp等于kstrdup(argv[i], GFP_KERNEL)
671  如果非tmp
672  ret等于负ENOMEM
673  转到:error
676  trace_probe_log_set_index(i + 2)
677  ret等于traceprobe_parse_probe_arg( & tp, i, tmp, is_return ? TPARG_FL_RETURN : 0)
679  kfree(tmp)
680  如果ret则转到:error
684  ret等于traceprobe_set_print_fmt( & tp, is_ret_probe(tu))
685  如果ret小于0则转到:error
688  ret等于Register a trace_uprobe and probe_event
689  如果非ret则转到:out
692  error :
693  free_trace_uprobe(tu)
694  out :
695  trace_probe_log_clear()
696  返回:ret
698  fail_address_parse :
699  trace_probe_log_clear()
700  path_put( & path)
701  kfree(filename)
703  返回:ret
调用者
名称描述
create_or_delete_trace_uprobe