Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:bpf_map_get_fd_by_id

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

Type:int

Parameter:

TypeParameterName
const union bpf_attr *attr
2343  id = map_id
2347  If helper macro to check that unused fields 'union bpf_attr' are zero (BPF_MAP_GET_FD_BY_ID) || open_flags & ~BPF_OBJ_FLAG_MASK Then Return -EINVAL
2351  If Not Check operation authority Then Return -EPERM
2354  f_flags = bpf_get_file_flag(open_flags)
2355  If f_flags < 0 Then Return f_flags
2358  spin_lock_bh( & map_idr_lock)
2359  map = dr_find() - Return pointer for given ID
2360  If map Then map = map_idr_lock should have been held
2362  Else map = ERR_PTR( - ENOENT)
2364  spin_unlock_bh( & map_idr_lock)
2366  If IS_ERR(map) Then Return PTR_ERR(map)
2369  fd = bpf_map_new_fd(map, f_flags)
2370  If fd < 0 Then bpf_map_put_with_uref(map)
2373  Return fd