Function report |
Source Code:kernel\bpf\stackmap.c |
Create Date:2022-07-28 13:26:10 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:Called from syscall
Proto:static struct bpf_map *stack_map_alloc(union bpf_attr *attr)
Type:struct bpf_map
Parameter:
| Type | Parameter | Name |
|---|---|---|
| union bpf_attr * | attr |
| 93 | If Not Check operation authority Then Return ERR_PTR( - EPERM) |
| 96 | If BPF_MAP_CREATE related * flags defined above. & ~STACK_CREATE_FLAG_MASK Then Return ERR_PTR( - EINVAL) |
| 100 | If max number of entries in a map == 0 || size of key in bytes != 4 || value_size < 8 || value_size % 8 Then Return ERR_PTR( - EINVAL) |
| 104 | BUILD_BUG_ON - break compile if a condition is true(sizeof(structbpf_stack_build_id) % sizeof(u64)) |
| 106 | If value_size % sizeof(structbpf_stack_build_id) || value_size / sizeof(structbpf_stack_build_id) > sysctl_perf_event_max_stack Then Return ERR_PTR( - EINVAL) |
| 110 | Else if value_size / 8 > sysctl_perf_event_max_stack Then Return ERR_PTR( - EINVAL) |
| 117 | cost += n_buckets * (value_size + sizeof(structstack_map_bucket)) |
| 118 | err = bpf_map_charge_init( & mem, cost) |
| 122 | smap = bpf_map_area_alloc(cost, bpf_map_attr_numa_node(attr)) |
| 123 | If Not smap Then |
| 124 | bpf_map_charge_finish( & mem) |
| 128 | bpf_map_init_from_attr( & map, attr) |
| 129 | value_size = value_size |
| 133 | If err Then Go to free_charge |
| 136 | err = prealloc_elems_and_freelist(smap) |
| 137 | If err Then Go to put_buffers |
| 140 | bpf_map_charge_move( & memory, & mem) |
| 142 | Return map |
| 144 | put_buffers : |
| 145 | put_callchain_buffers() |
| 146 | free_charge : |
| 147 | bpf_map_charge_finish( & mem) |
| 148 | bpf_map_area_free(smap) |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |