Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\syscall.c Create Date:2022-07-28 12:54:57
Last Modify:2022-05-19 18:06:12 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:bpf_task_fd_query

Proto:static int bpf_task_fd_query(const union bpf_attr *attr, union bpf_attr __user *uattr)

Type:int

Parameter:

TypeParameterName
const union bpf_attr *attr
union bpf_attr __user *uattr
2915  pid = input: pid
2916  fd = input: fd
2923  If helper macro to check that unused fields 'union bpf_attr' are zero (BPF_TASK_FD_QUERY) Then Return -EINVAL
2926  If Not Check operation authority Then Return -EPERM
2929  If input: flags != 0 Then Return -EINVAL
2932  task = get_pid_task(find_vpid(pid), PIDTYPE_PID)
2933  If Not task Then Return -ENOENT
2936  files = get_files_struct(task)
2937  put_task_struct(task)
2938  If Not files Then Return -ENOENT
2941  err = 0
2942  spin_lock( & written part on a separate cache line in SMP)
2943  file = fcheck_files(files, fd)
2944  If Not file Then err = -EBADF
2946  Else get_file(file)
2948  spin_unlock( & written part on a separate cache line in SMP)
2949  put_files_struct(files)
2951  If err Then Go to out
2954  If f_op == bpf_raw_tp_fops Then
2955  raw_tp = needed for tty driver, and maybe others
2956  btp = btp
2958  err = bpf_task_fd_query_copy(attr, uattr, id, BPF_FD_TYPE_RAW_TRACEPOINT, Tracepoint name , 0, 0)
2962  Go to put_file
2965  event = perf_get_event(file)
2966  If Not IS_ERR(event) Then
2971  err = bpf_get_perf_event_info(event, & prog_id, & fd_type, & buf, & probe_offset, & probe_addr)
2974  If Not err Then err = bpf_task_fd_query_copy(attr, uattr, prog_id, fd_type, buf, probe_offset, probe_addr)
2979  Go to put_file
2982  err = -Operation is not supported
2983  put_file :
2984  fput(file)
2985  out :
2986  Return err