Lines Matching refs:attr
197 union bpf_attr attr; in bpf_create_map() local
198 memset(&attr, 0, sizeof(attr)); in bpf_create_map()
199 attr.map_type = map_type; in bpf_create_map()
200 attr.key_size = key_size; in bpf_create_map()
201 attr.value_size = value_size; in bpf_create_map()
202 attr.max_entries = max_entries; in bpf_create_map()
203 attr.map_flags = map_flags; in bpf_create_map()
204 memcpy(attr.map_name, name, min(name_len, BPF_OBJ_NAME_LEN - 1)); in bpf_create_map()
206 int ret = syscall(__NR_bpf, BPF_MAP_CREATE, &attr, sizeof(attr)); in bpf_create_map()
209 memset(attr.map_name, 0, BPF_OBJ_NAME_LEN); in bpf_create_map()
210 ret = syscall(__NR_bpf, BPF_MAP_CREATE, &attr, sizeof(attr)); in bpf_create_map()
221 ret = syscall(__NR_bpf, BPF_MAP_CREATE, &attr, sizeof(attr)); in bpf_create_map()
229 union bpf_attr attr; in bpf_update_elem() local
230 memset(&attr, 0, sizeof(attr)); in bpf_update_elem()
231 attr.map_fd = fd; in bpf_update_elem()
232 attr.key = ptr_to_u64(key); in bpf_update_elem()
233 attr.value = ptr_to_u64(value); in bpf_update_elem()
234 attr.flags = flags; in bpf_update_elem()
236 return syscall(__NR_bpf, BPF_MAP_UPDATE_ELEM, &attr, sizeof(attr)); in bpf_update_elem()
241 union bpf_attr attr; in bpf_lookup_elem() local
242 memset(&attr, 0, sizeof(attr)); in bpf_lookup_elem()
243 attr.map_fd = fd; in bpf_lookup_elem()
244 attr.key = ptr_to_u64(key); in bpf_lookup_elem()
245 attr.value = ptr_to_u64(value); in bpf_lookup_elem()
247 return syscall(__NR_bpf, BPF_MAP_LOOKUP_ELEM, &attr, sizeof(attr)); in bpf_lookup_elem()
252 union bpf_attr attr; in bpf_delete_elem() local
253 memset(&attr, 0, sizeof(attr)); in bpf_delete_elem()
254 attr.map_fd = fd; in bpf_delete_elem()
255 attr.key = ptr_to_u64(key); in bpf_delete_elem()
257 return syscall(__NR_bpf, BPF_MAP_DELETE_ELEM, &attr, sizeof(attr)); in bpf_delete_elem()
262 union bpf_attr attr; in bpf_get_first_key() local
265 memset(&attr, 0, sizeof(attr)); in bpf_get_first_key()
266 attr.map_fd = fd; in bpf_get_first_key()
267 attr.key = 0; in bpf_get_first_key()
268 attr.next_key = ptr_to_u64(key); in bpf_get_first_key()
272 res = syscall(__NR_bpf, BPF_MAP_GET_NEXT_KEY, &attr, sizeof(attr)); in bpf_get_first_key()
276 attr.key = ptr_to_u64(key); in bpf_get_first_key()
290 return syscall(__NR_bpf, BPF_MAP_GET_NEXT_KEY, &attr, sizeof(attr)); in bpf_get_first_key()
300 union bpf_attr attr; in bpf_get_next_key() local
301 memset(&attr, 0, sizeof(attr)); in bpf_get_next_key()
302 attr.map_fd = fd; in bpf_get_next_key()
303 attr.key = ptr_to_u64(key); in bpf_get_next_key()
304 attr.next_key = ptr_to_u64(next_key); in bpf_get_next_key()
306 return syscall(__NR_bpf, BPF_MAP_GET_NEXT_KEY, &attr, sizeof(attr)); in bpf_get_next_key()
375 union bpf_attr attr; in bpf_obj_get_info() local
378 memset(&attr, 0, sizeof(attr)); in bpf_obj_get_info()
379 attr.info.bpf_fd = prog_map_fd; in bpf_obj_get_info()
380 attr.info.info_len = *info_len; in bpf_obj_get_info()
381 attr.info.info = ptr_to_u64(info); in bpf_obj_get_info()
383 err = syscall(__NR_bpf, BPF_OBJ_GET_INFO_BY_FD, &attr, sizeof(attr)); in bpf_obj_get_info()
385 *info_len = attr.info.info_len; in bpf_obj_get_info()
490 union bpf_attr attr; in bpf_prog_load() local
495 memset(&attr, 0, sizeof(attr)); in bpf_prog_load()
497 attr.prog_type = prog_type; in bpf_prog_load()
498 attr.kern_version = kern_version; in bpf_prog_load()
499 attr.license = ptr_to_u64((void *)license); in bpf_prog_load()
501 attr.insns = ptr_to_u64((void *)insns); in bpf_prog_load()
502 attr.insn_cnt = prog_len / sizeof(struct bpf_insn); in bpf_prog_load()
503 if (attr.insn_cnt > BPF_MAXINSNS) { in bpf_prog_load()
507 strerror(errno), name, attr.insn_cnt, BPF_MAXINSNS); in bpf_prog_load()
511 attr.log_level = log_level; in bpf_prog_load()
512 if (attr.log_level > 0) { in bpf_prog_load()
516 attr.log_buf = ptr_to_u64(log_buf); in bpf_prog_load()
517 attr.log_size = log_buf_size; in bpf_prog_load()
525 attr.log_level = 0; in bpf_prog_load()
528 attr.log_buf = ptr_to_u64(tmp_log_buf); in bpf_prog_load()
529 attr.log_size = tmp_log_buf_size; in bpf_prog_load()
541 memcpy(attr.prog_name, name + name_offset, in bpf_prog_load()
545 ret = syscall(__NR_bpf, BPF_PROG_LOAD, &attr, sizeof(attr)); in bpf_prog_load()
549 memset(attr.prog_name, 0, BPF_OBJ_NAME_LEN); in bpf_prog_load()
550 ret = syscall(__NR_bpf, BPF_PROG_LOAD, &attr, sizeof(attr)); in bpf_prog_load()
566 ret = syscall(__NR_bpf, BPF_PROG_LOAD, &attr, sizeof(attr)); in bpf_prog_load()
575 if (attr.log_level == 0) { in bpf_prog_load()
576 attr.log_level = 1; in bpf_prog_load()
577 attr.log_buf = ptr_to_u64(log_buf); in bpf_prog_load()
578 attr.log_size = log_buf_size; in bpf_prog_load()
579 ret = syscall(__NR_bpf, BPF_PROG_LOAD, &attr, sizeof(attr)); in bpf_prog_load()
593 if (attr.log_level == 0) in bpf_prog_load()
594 attr.log_level = 1; in bpf_prog_load()
603 attr.log_buf = ptr_to_u64(tmp_log_buf); in bpf_prog_load()
604 attr.log_size = tmp_log_buf_size; in bpf_prog_load()
606 ret = syscall(__NR_bpf, BPF_PROG_LOAD, &attr, sizeof(attr)); in bpf_prog_load()
620 if (attr.log_level > 0) { in bpf_prog_load()
728 struct perf_event_attr attr = {}; in bpf_try_perf_event_open_with_probe() local
735 attr.sample_period = 1; in bpf_try_perf_event_open_with_probe()
736 attr.wakeup_events = 1; in bpf_try_perf_event_open_with_probe()
738 attr.config |= 1 << is_return_bit; in bpf_try_perf_event_open_with_probe()
759 attr.config2 = offs; /* config2 here is kprobe_addr or probe_offset */ in bpf_try_perf_event_open_with_probe()
760 attr.size = sizeof(attr); in bpf_try_perf_event_open_with_probe()
761 attr.type = type; in bpf_try_perf_event_open_with_probe()
763 attr.config1 = ptr_to_u64((void *)name); in bpf_try_perf_event_open_with_probe()
772 return syscall(__NR_perf_event_open, &attr, pid, cpu, -1 /* group_fd */, in bpf_try_perf_event_open_with_probe()
789 struct perf_event_attr attr = {}; in bpf_attach_tracing_event() local
808 attr.config = strtol(buf, NULL, 0); in bpf_attach_tracing_event()
809 attr.type = PERF_TYPE_TRACEPOINT; in bpf_attach_tracing_event()
810 attr.sample_period = 1; in bpf_attach_tracing_event()
811 attr.wakeup_events = 1; in bpf_attach_tracing_event()
820 *pfd = syscall(__NR_perf_event_open, &attr, pid, cpu, -1 /* group_fd */, PERF_FLAG_FD_CLOEXEC); in bpf_attach_tracing_event()
1158 union bpf_attr attr; in bpf_attach_raw_tracepoint() local
1161 bzero(&attr, sizeof(attr)); in bpf_attach_raw_tracepoint()
1162 attr.raw_tracepoint.name = ptr_to_u64(tp_name); in bpf_attach_raw_tracepoint()
1163 attr.raw_tracepoint.prog_fd = progfd; in bpf_attach_raw_tracepoint()
1165 ret = syscall(__NR_bpf, BPF_RAW_TRACEPOINT_OPEN, &attr, sizeof(attr)); in bpf_attach_raw_tracepoint()
1175 struct perf_event_attr attr = {}; in bpf_open_perf_buffer() local
1182 attr.config = 10;//PERF_COUNT_SW_BPF_OUTPUT; in bpf_open_perf_buffer()
1183 attr.type = PERF_TYPE_SOFTWARE; in bpf_open_perf_buffer()
1184 attr.sample_type = PERF_SAMPLE_RAW; in bpf_open_perf_buffer()
1185 attr.sample_period = 1; in bpf_open_perf_buffer()
1186 attr.wakeup_events = 1; in bpf_open_perf_buffer()
1187 pfd = syscall(__NR_perf_event_open, &attr, pid, cpu, -1, PERF_FLAG_FD_CLOEXEC); in bpf_open_perf_buffer()
1253 struct perf_event_attr attr = {}; in bpf_open_perf_event() local
1259 attr.sample_period = LONG_MAX; in bpf_open_perf_event()
1260 attr.type = type; in bpf_open_perf_event()
1261 attr.config = config; in bpf_open_perf_event()
1263 fd = syscall(__NR_perf_event_open, &attr, pid, cpu, -1, PERF_FLAG_FD_CLOEXEC); in bpf_open_perf_event()
1434 struct perf_event_attr attr = {}; in bpf_attach_perf_event() local
1435 attr.type = ev_type; in bpf_attach_perf_event()
1436 attr.config = ev_config; in bpf_attach_perf_event()
1438 attr.inherit = 1; in bpf_attach_perf_event()
1440 attr.freq = 1; in bpf_attach_perf_event()
1441 attr.sample_freq = sample_freq; in bpf_attach_perf_event()
1443 attr.sample_period = sample_period; in bpf_attach_perf_event()
1446 return bpf_attach_perf_event_raw(progfd, &attr, pid, cpu, group_fd, 0); in bpf_attach_perf_event()
1468 union bpf_attr attr; in bpf_obj_pin() local
1470 memset(&attr, 0, sizeof(attr)); in bpf_obj_pin()
1471 attr.pathname = ptr_to_u64((void *)pathname); in bpf_obj_pin()
1472 attr.bpf_fd = fd; in bpf_obj_pin()
1474 return syscall(__NR_bpf, BPF_OBJ_PIN, &attr, sizeof(attr)); in bpf_obj_pin()
1479 union bpf_attr attr; in bpf_obj_get() local
1481 memset(&attr, 0, sizeof(attr)); in bpf_obj_get()
1482 attr.pathname = ptr_to_u64((void *)pathname); in bpf_obj_get()
1484 return syscall(__NR_bpf, BPF_OBJ_GET, &attr, sizeof(attr)); in bpf_obj_get()
1489 union bpf_attr attr; in bpf_prog_get_next_id() local
1492 memset(&attr, 0, sizeof(attr)); in bpf_prog_get_next_id()
1493 attr.start_id = start_id; in bpf_prog_get_next_id()
1495 err = syscall(__NR_bpf, BPF_PROG_GET_NEXT_ID, &attr, sizeof(attr)); in bpf_prog_get_next_id()
1497 *next_id = attr.next_id; in bpf_prog_get_next_id()
1504 union bpf_attr attr; in bpf_prog_get_fd_by_id() local
1506 memset(&attr, 0, sizeof(attr)); in bpf_prog_get_fd_by_id()
1507 attr.prog_id = id; in bpf_prog_get_fd_by_id()
1509 return syscall(__NR_bpf, BPF_PROG_GET_FD_BY_ID, &attr, sizeof(attr)); in bpf_prog_get_fd_by_id()
1514 union bpf_attr attr; in bpf_map_get_fd_by_id() local
1516 memset(&attr, 0, sizeof(attr)); in bpf_map_get_fd_by_id()
1517 attr.map_id = id; in bpf_map_get_fd_by_id()
1519 return syscall(__NR_bpf, BPF_MAP_GET_FD_BY_ID, &attr, sizeof(attr)); in bpf_map_get_fd_by_id()