• Home
  • Raw
  • Download

Lines Matching +full:path +full:- +full:map

1 /* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */
6 * Copyright (C) 2013-2015 Alexei Starovoitov <ast@kernel.org>
73 * @brief **libbpf_bpf_map_type_str()** converts the provided map type value
75 * @param t The map type.
76 * @return Pointer to a static string identifying the map type. NULL is
100 * @brief **libbpf_set_print()** sets user-provided log callback function to
105 * This function is thread-safe.
116 * - for object open from file, this will override setting object
117 * name from file path's base name;
118 * - for object open from memory buffer, this will specify an object
119 * name and will override default "<addr>-<buf-size>" name;
122 /* parse map definitions non-strictly, allowing extra attributes/data */
126 * auto-pinned to that path on load; defaults to "/sys/fs/bpf".
136 /* Path to the custom BTF to be used for BPF CO-RE relocations.
138 * for the purpose of CO-RE relocations.
145 * passed-through to bpf() syscall. Keep in mind that kernel might
146 * fail operation with -ENOSPC error if provided buffer is too small
152 * - each BPF progral load (BPF_PROG_LOAD) attempt, unless overriden
153 * with bpf_program__set_log() on per-program level, to get
155 * - during BPF object's BTF load into kernel (BPF_BTF_LOAD) to get
159 * previous contents, so if you need more fine-grained control, set
160 * per-program buffer with bpf_program__set_log_buf() to preserve each
174 * could be either libbpf's own auto-allocated log buffer, if
175 * kernel_log_buffer is NULL, or user-provided custom kernel_log_buf.
187 * the BPF ELF object file pointed to by the passed path and loading it
189 * @param path BPF object file path.
193 LIBBPF_API struct bpf_object *bpf_object__open(const char *path);
197 * the BPF ELF object file pointed to by the passed path and loading it
199 * @param path BPF object file path
206 bpf_object__open_file(const char *path, const struct bpf_object_open_opts *opts);
239 * @brief **bpf_object__pin_maps()** pins each map contained within
242 * @param path A directory where maps should be pinned.
245 * If `path` is NULL `bpf_map__pin` (which is being used on each map)
246 * will use the pin_path attribute of each map. In this case, maps that
249 LIBBPF_API int bpf_object__pin_maps(struct bpf_object *obj, const char *path);
252 * @brief **bpf_object__unpin_maps()** unpins each map contained within
255 * @param path A directory where pinned maps should be searched for.
258 * If `path` is NULL `bpf_map__unpin` (which is being used on each map)
259 * will use the pin_path attribute of each map. In this case, maps that
263 const char *path);
265 const char *path);
267 const char *path);
268 LIBBPF_API int bpf_object__pin(struct bpf_object *object, const char *path);
269 LIBBPF_API int bpf_object__unpin(struct bpf_object *object, const char *path);
318 * @brief **bpf_program__insns()** gives read-only access to BPF program's
332 * instructions will be CO-RE-relocated, BPF subprograms instructions will be
371 * in the BPF FS specified by a path. This increments the programs
376 * @param path file path in a BPF file system
379 LIBBPF_API int bpf_program__pin(struct bpf_program *prog, const char *path);
383 * in the BPFFS specified by a path. This decrements the programs
390 * @param path file path to the pin in a BPF file system
393 LIBBPF_API int bpf_program__unpin(struct bpf_program *prog, const char *path);
398 LIBBPF_API struct bpf_link *bpf_link__open(const char *path);
403 * in the BPF FS specified by a path. This increments the links
408 * @param path file path in a BPF file system
412 LIBBPF_API int bpf_link__pin(struct bpf_link *link, const char *path);
416 * in the BPFFS specified by a path. This decrements the links
423 * @param path file path to the pin in a BPF file system
435 * a BPF program based on auto-detection of program type, attach type,
443 * - kprobe/kretprobe (depends on SEC() definition)
444 * - uprobe/uretprobe (depends on SEC() definition)
445 * - tracepoint
446 * - raw tracepoint
447 * - tracing programs (typed raw TP/fentry/fexit/fmod_ret)
455 /* custom user-provided value fetchable through bpf_get_attach_cookie() */
471 * enum probe_attach_mode - the mode to attach kprobe/uprobe
473 * force libbpf to attach kprobe/uprobe in specific mode, -ENOTSUP will
490 /* custom user-provided value fetchable through bpf_get_attach_cookie() */
517 /* array of user-provided values fetchable through bpf_get_attach_cookie */
559 * 1) use only path/func_pattern/pid arguments
561 * 2) use path/pid with allowed combinations of
564 * - syms and offsets are mutually exclusive
565 * - ref_ctr_offsets and cookies are optional
570 * -1 for all processes
571 * @param binary_path Path to binary
587 /* custom user-provided value fetchable through bpf_get_attach_cookie() */
612 * system supports compat syscalls or defines 32-bit syscalls in 64-bit
617 * compat and 32-bit interfaces is required.
634 * a6ca88b241d5 ("trace_uprobe: support reference counter in fd-based uprobe")
637 /* custom user-provided value fetchable through bpf_get_attach_cookie() */
641 /* Function name to attach to. Could be an unqualified ("abc") or library-qualified
657 * to the userspace function which is found by binary path and
665 * -1 for all processes
666 * @param binary_path Path to binary that contains the function symbol
683 * -1 for all processes
684 * @param binary_path Path to binary that contains the function symbol
698 /* custom user-provided value accessible through usdt_cookie() */
706 * bpf_program__attach_uprobe_opts() except it covers USDT (User-space
708 * user-space function entry or exit.
712 * -1 for all processes
713 * @param binary_path Path to binary that contains provided USDT probe
729 /* custom user-provided value fetchable through bpf_get_attach_cookie() */
751 /* custom user-provided value fetchable through bpf_get_attach_cookie() */
805 LIBBPF_API struct bpf_link *bpf_map__attach_struct_ops(const struct bpf_map *map);
806 LIBBPF_API int bpf_link__update_map(struct bpf_link *link, const struct bpf_map *map);
825 * @param type program type to set the BPF map to have
841 * auto-detection of attachment when programs are loaded.
843 * @param type attach type to set the BPF map to have
857 /* Per-program log level and log buffer getters/setters.
867 * @brief **bpf_program__set_attach_target()** sets BTF-based attach target
869 * - BTF-aware raw tracepoints (tp_btf);
870 * - fentry/fexit/fmod_ret;
871 * - lsm;
872 * - freplace.
874 * @param type attach type to set the BPF map to have
882 * @brief **bpf_object__find_map_by_name()** returns BPF map of
885 * @param name name of the BPF map
886 * @return BPF map instance, if such map exists within the BPF object;
896 bpf_object__next_map(const struct bpf_object *obj, const struct bpf_map *map);
905 bpf_object__prev_map(const struct bpf_object *obj, const struct bpf_map *map);
908 * @brief **bpf_map__set_autocreate()** sets whether libbpf has to auto-create
909 * BPF map during BPF object load phase.
910 * @param map the BPF map instance
911 * @param autocreate whether to create BPF map during BPF object load
912 * @return 0 on success; -EBUSY if BPF object was already loaded
914 * **bpf_map__set_autocreate()** allows to opt-out from libbpf auto-creating
915 * BPF map. By default, libbpf will attempt to create every single BPF map
917 * and fill in map FD in BPF instructions.
919 * This API allows to opt-out of this process for specific map instance. This
920 * can be useful if host kernel doesn't support such BPF map type or used
922 * a map in the first place. User is still responsible to make sure that their
923 * BPF-side code that expects to use such missing BPF map is recognized by BPF
926 LIBBPF_API int bpf_map__set_autocreate(struct bpf_map *map, bool autocreate);
927 LIBBPF_API bool bpf_map__autocreate(const struct bpf_map *map);
931 * BPF map
932 * @param map the BPF map instance
933 * @return the file descriptor; or -EINVAL in case of an error
935 LIBBPF_API int bpf_map__fd(const struct bpf_map *map);
936 LIBBPF_API int bpf_map__reuse_fd(struct bpf_map *map, int fd);
937 /* get map name */
938 LIBBPF_API const char *bpf_map__name(const struct bpf_map *map);
939 /* get/set map type */
940 LIBBPF_API enum bpf_map_type bpf_map__type(const struct bpf_map *map);
941 LIBBPF_API int bpf_map__set_type(struct bpf_map *map, enum bpf_map_type type);
942 /* get/set map size (max_entries) */
943 LIBBPF_API __u32 bpf_map__max_entries(const struct bpf_map *map);
944 LIBBPF_API int bpf_map__set_max_entries(struct bpf_map *map, __u32 max_entries);
945 /* get/set map flags */
946 LIBBPF_API __u32 bpf_map__map_flags(const struct bpf_map *map);
947 LIBBPF_API int bpf_map__set_map_flags(struct bpf_map *map, __u32 flags);
948 /* get/set map NUMA node */
949 LIBBPF_API __u32 bpf_map__numa_node(const struct bpf_map *map);
950 LIBBPF_API int bpf_map__set_numa_node(struct bpf_map *map, __u32 numa_node);
951 /* get/set map key size */
952 LIBBPF_API __u32 bpf_map__key_size(const struct bpf_map *map);
953 LIBBPF_API int bpf_map__set_key_size(struct bpf_map *map, __u32 size);
954 /* get map value size */
955 LIBBPF_API __u32 bpf_map__value_size(const struct bpf_map *map);
957 * @brief **bpf_map__set_value_size()** sets map value size.
958 * @param map the BPF map instance
961 * There is a special case for maps with associated memory-mapped regions, like
963 * on such a map, the mapped region is resized. Afterward, an attempt is made to
964 * adjust the corresponding BTF info. This attempt is best-effort and can only
965 * succeed if the last variable of the data section map is an array. The array
970 LIBBPF_API int bpf_map__set_value_size(struct bpf_map *map, __u32 size);
971 /* get map key/value BTF type IDs */
972 LIBBPF_API __u32 bpf_map__btf_key_type_id(const struct bpf_map *map);
973 LIBBPF_API __u32 bpf_map__btf_value_type_id(const struct bpf_map *map);
974 /* get/set map if_index */
975 LIBBPF_API __u32 bpf_map__ifindex(const struct bpf_map *map);
976 LIBBPF_API int bpf_map__set_ifindex(struct bpf_map *map, __u32 ifindex);
977 /* get/set map map_extra flags */
978 LIBBPF_API __u64 bpf_map__map_extra(const struct bpf_map *map);
979 LIBBPF_API int bpf_map__set_map_extra(struct bpf_map *map, __u64 map_extra);
981 LIBBPF_API int bpf_map__set_initial_value(struct bpf_map *map,
983 LIBBPF_API void *bpf_map__initial_value(struct bpf_map *map, size_t *psize);
987 * passed map is a special map created by libbpf automatically for things like
989 * @param map the bpf_map
990 * @return true, if the map is an internal map; false, otherwise
992 LIBBPF_API bool bpf_map__is_internal(const struct bpf_map *map);
995 * @brief **bpf_map__set_pin_path()** sets the path attribute that tells where the
996 * BPF map should be pinned. This does not actually create the 'pin'.
997 * @param map The bpf_map
998 * @param path The path
1001 LIBBPF_API int bpf_map__set_pin_path(struct bpf_map *map, const char *path);
1004 * @brief **bpf_map__pin_path()** gets the path attribute that tells where the
1005 * BPF map should be pinned.
1006 * @param map The bpf_map
1007 * @return The path string; which can be NULL
1009 LIBBPF_API const char *bpf_map__pin_path(const struct bpf_map *map);
1013 * passed map has been pinned via a 'pin' file.
1014 * @param map The bpf_map
1015 * @return true, if the map is pinned; false, otherwise
1017 LIBBPF_API bool bpf_map__is_pinned(const struct bpf_map *map);
1021 * for the BPF map. This increments the reference count on the
1022 * BPF map which will keep the BPF map loaded even after the
1024 * @param map The bpf_map to pin
1025 * @param path A file path for the 'pin'
1028 * If `path` is NULL the maps `pin_path` attribute will be used. If this is
1029 * also NULL, an error will be returned and the map will not be pinned.
1031 LIBBPF_API int bpf_map__pin(struct bpf_map *map, const char *path);
1035 * 'pin' for the BPF map.
1036 * @param map The bpf_map to unpin
1037 * @param path A file path for the 'pin'
1040 * The `path` parameter can be NULL, in which case the `pin_path`
1041 * map attribute is unpinned. If both the `path` parameter and
1042 * `pin_path` map attribute are set, they must be equal.
1044 LIBBPF_API int bpf_map__unpin(struct bpf_map *map, const char *path);
1046 LIBBPF_API int bpf_map__set_inner_map_fd(struct bpf_map *map, int fd);
1047 LIBBPF_API struct bpf_map *bpf_map__inner_map(struct bpf_map *map);
1050 * @brief **bpf_map__lookup_elem()** allows to lookup BPF map value
1052 * @param map BPF map to lookup element in
1054 * @param key_sz size in bytes of key data, needs to match BPF map definition's **key_size**
1056 * @param value_sz size in byte of value data memory; it has to match BPF map
1057 * definition's **value_size**. For per-CPU BPF maps value size has to be
1058 * a product of BPF map value size and number of possible CPUs in the system
1060 * per-CPU values value size has to be aligned up to closest 8 bytes for
1066 * **bpf_map__lookup_elem()** is high-level equivalent of
1069 LIBBPF_API int bpf_map__lookup_elem(const struct bpf_map *map,
1075 * map that corresponds to provided key.
1076 * @param map BPF map to insert to or update element in
1078 * @param key_sz size in bytes of key data, needs to match BPF map definition's **key_size**
1080 * @param value_sz size in byte of value data memory; it has to match BPF map
1081 * definition's **value_size**. For per-CPU BPF maps value size has to be
1082 * a product of BPF map value size and number of possible CPUs in the system
1084 * per-CPU values value size has to be aligned up to closest 8 bytes for
1090 * **bpf_map__update_elem()** is high-level equivalent of
1093 LIBBPF_API int bpf_map__update_elem(const struct bpf_map *map,
1098 * @brief **bpf_map__delete_elem()** allows to delete element in BPF map that
1100 * @param map BPF map to delete element from
1102 * @param key_sz size in bytes of key data, needs to match BPF map definition's **key_size**
1106 * **bpf_map__delete_elem()** is high-level equivalent of
1109 LIBBPF_API int bpf_map__delete_elem(const struct bpf_map *map,
1113 * @brief **bpf_map__lookup_and_delete_elem()** allows to lookup BPF map value
1115 * @param map BPF map to lookup element in
1117 * @param key_sz size in bytes of key data, needs to match BPF map definition's **key_size**
1119 * @param value_sz size in byte of value data memory; it has to match BPF map
1120 * definition's **value_size**. For per-CPU BPF maps value size has to be
1121 * a product of BPF map value size and number of possible CPUs in the system
1123 * per-CPU values value size has to be aligned up to closest 8 bytes for
1129 * **bpf_map__lookup_and_delete_elem()** is high-level equivalent of
1132 LIBBPF_API int bpf_map__lookup_and_delete_elem(const struct bpf_map *map,
1137 * @brief **bpf_map__get_next_key()** allows to iterate BPF map keys by
1139 * @param map BPF map to fetch next key from
1143 * @param key_sz size in bytes of key data, needs to match BPF map definition's **key_size**
1144 * @return 0, on success; -ENOENT if **cur_key** is the last key in BPF map;
1147 * **bpf_map__get_next_key()** is high-level equivalent of
1150 LIBBPF_API int bpf_map__get_next_key(const struct bpf_map *map,
1262 * @param map_fd A file descriptor to a BPF_MAP_TYPE_USER_RINGBUF map.
1275 * @return A pointer to an 8-byte aligned reserved region of the user ring
1298 * should block when waiting for a sample. -1 causes the caller to block
1300 * @return A pointer to an 8-byte aligned reserved region of the user ring
1306 * If **timeout_ms** is -1, the function will block indefinitely until a sample
1307 * becomes available. Otherwise, **timeout_ms** must be non-negative, or errno
1381 * BPF_PERF_EVENT_ARRAY map
1382 * @param map_fd FD of BPF_PERF_EVENT_ARRAY BPF map that will be used by BPF
1383 * code to send data over to user-space
1384 * @param page_cnt number of memory pages allocated for each per-CPU buffer
1387 * @param ctx user-provided extra context passed into *sample_cb* and *lost_cb*
1398 LIBBPF_PERF_EVENT_ERROR = -1,
1399 LIBBPF_PERF_EVENT_CONT = -2,
1413 * max_entries of given PERF_EVENT_ARRAY map)
1418 /* if cpu_cnt > 0, map_keys specify map keys to set per-CPU FDs for */
1438 * @brief **perf_buffer__buffer()** returns the per-cpu raw mmap()'ed underlying
1492 * @param map_type BPF map type to detect kernel support for
1494 * @return 1, if given map type is supported; 0, if given map type is
1536 struct bpf_map **map; member
1574 struct bpf_map **map; member
1659 * auto-attach is not supported, callback should return 0 and set link to
1671 /* User-provided value that is passed to prog_setup_fn,
1701 * @return Non-negative handler ID is returned on success. This handler ID has
1707 * - if *sec* is just a plain string (e.g., "abc"), it will match only
1710 * - if *sec* is of the form "abc/", proper SEC() form is
1713 * - if *sec* is of the form "abc+", it will successfully match both
1715 * - if *sec* is NULL, custom handler is registered for any BPF program that
1723 * (i.e., it's possible to have custom SEC("perf_event/LLC-load-misses")
1727 * libbpf_set_strict_mode(), etc)) these APIs are not thread-safe. User needs
1743 * libbpf_set_strict_mode(), etc)) these APIs are not thread-safe. User needs