Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:bpf_raw_tracepoint_open

Proto:static int bpf_raw_tracepoint_open(const union bpf_attr *attr)

Type:int

Parameter:

TypeParameterName
const union bpf_attr *attr
1953  If helper macro to check that unused fields 'union bpf_attr' are zero (BPF_RAW_TRACEPOINT_OPEN) Then Return -EINVAL
1956  prog = bpf_prog_get(prog_fd)
1957  If IS_ERR(prog) Then Return PTR_ERR(prog)
1960  If Type of BPF program != BPF_PROG_TYPE_RAW_TRACEPOINT && Type of BPF program != BPF_PROG_TYPE_TRACING && Type of BPF program != BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE Then
1963  err = -EINVAL
1964  Go to out_put_prog
1967  If Type of BPF program == BPF_PROG_TYPE_TRACING Then
1968  If name Then
1972  err = -EINVAL
1973  Go to out_put_prog
1975  If For some prog types == BPF_TRACE_RAW_TP Then tp_name = function name for valid attach_btf_id
1977  Else Return bpf_tracing_prog_attach(prog)
1979  Else
1983  err = -EFAULT
1984  Go to out_put_prog
1986  buf[ size of buf - 1] = 0
1987  tp_name = buf
1990  btp = bpf_get_raw_tracepoint(tp_name)
1991  If Not btp Then
1992  err = -ENOENT
1993  Go to out_put_prog
1996  raw_tp = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
1997  If Not raw_tp Then
1998  err = -ENOMEM
1999  Go to out_put_btp
2001  btp = btp
2002  prog = prog
2004  err = bpf_probe_register(btp, prog)
2005  If err Then Go to out_free_tp
2008  tp_fd = anon_inode_getfd("bpf-raw-tracepoint", & bpf_raw_tp_fops, raw_tp, O_CLOEXEC)
2010  If tp_fd < 0 Then
2011  bpf_probe_unregister(btp, prog)
2012  err = tp_fd
2013  Go to out_free_tp
2015  Return tp_fd
2017  out_free_tp :
2018  kfree(raw_tp)
2019  out_put_btp :
2020  bpf_put_raw_tracepoint(btp)
2021  out_put_prog :
2022  bpf_prog_put(prog)
2023  Return err