函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:____bpf_get_stack

函数原型:static inline __attribute__((__always_inline__)) u64 ____bpf_get_stack(struct pt_regs *regs, void *buf, u32 size, u64 flags)

返回类型:u64

参数:

类型参数名称
struct pt_regs *regs
void *buf
u32size
u64flags
450  user_build_id等于flags按位与lags used by BPF_FUNC_get_stack only.
451  skip等于flags按位与lags for both BPF_FUNC_get_stackid and BPF_FUNC_get_stack.
452  user等于flags按位与BPF_F_USER_STACK
454  kernel等于非user
455  err等于负EINVAL
458  如果此条件成立可能性小(为编译器优化)(flags & ~(lags for both BPF_FUNC_get_stackid and BPF_FUNC_get_stack. | BPF_F_USER_STACK | lags used by BPF_FUNC_get_stack only. ))则转到:clear
461  如果kerneluser_build_id则转到:clear
464  elem_size等于如果useruser_build_idsizeof(structbpf_stack_build_id)否则sizeof(u64)
466  如果此条件成立可能性小(为编译器优化)(size % elem_size)则转到:clear
469  num_elem等于sizeelem_size
470  如果sysctl_perf_event_max_stack小于num_eleminit_nr等于0
472  否则init_nr等于sysctl_perf_event_max_stacknum_elem
474  trace等于get_perf_callchain(regs, init_nr, kernel, user, sysctl_perf_event_max_stack, TSC's on different sockets may be reset asynchronously.* This may cause the TSC ADJUST value on socket 0 to be NOT 0., false)
476  如果此条件成立可能性小(为编译器优化)(!trace)则转到:err_fault
479  trace_nr等于nrinit_nr
480  如果trace_nr小于skip则转到:err_fault
483  trace_nr减等于skip
484  trace_nr等于如果trace_nr小于等于num_elemtrace_nr否则num_elem
485  copy_len等于trace_nrelem_size
486  ips等于 /proc/sys/kernel/perf_event_max_stack skipinit_nr
487  如果useruser_build_idstack_map_get_build_id_offset(buf, ips, trace_nr, user)
489  否则内存复制(buf, ips, copy_len)
492  如果size大于copy_lenmemset(buf + copy_len, 0, size - copy_len)
494  返回:copy_len
496  err_fault :
497  err等于负EFAULT
498  clear :
499  memset(buf, 0, size)
500  返回:err