Lines Matching refs:path

714 	char path[];
1294 static struct bpf_object *bpf_object__new(const char *path,
1302 obj = calloc(1, sizeof(struct bpf_object) + strlen(path) + 1);
1304 pr_warn("alloc memory failed for %s\n", path);
1308 strcpy(obj->path, path);
1313 libbpf_strlcpy(obj->name, basename((void *)path), sizeof(obj->name));
1395 obj->efile.fd = open(obj->path, O_RDONLY | O_CLOEXEC);
1401 pr_warn("elf: failed to open %s: %s\n", obj->path, cp);
1410 pr_warn("elf: failed to open %s as ELF file: %s\n", obj->path, elf_errmsg(-1));
1419 pr_warn("elf: '%s' is not a proper ELF object\n", obj->path);
1428 pr_warn("elf: '%s' is not a 64-bit ELF object\n", obj->path);
1437 pr_warn("elf: failed to get ELF header from %s: %s\n", obj->path, elf_errmsg(-1));
1445 obj->path, elf_errmsg(-1));
1453 obj->path, elf_errmsg(-1));
1462 pr_warn("elf: %s is not a valid eBPF object file\n", obj->path);
1484 pr_warn("elf: endianness mismatch in %s.\n", obj->path);
1492 pr_warn("invalid license section in %s\n", obj->path);
1499 pr_debug("license of %s is %s\n", obj->path, obj->license);
1509 pr_warn("invalid kver section in %s\n", obj->path);
1514 pr_debug("kernel version of %s is %x\n", obj->path, obj->kern_version);
2261 static int pathname_concat(char *buf, size_t buf_sz, const char *path, const char *name)
2265 len = snprintf(buf, buf_sz, "%s/%s", path, name);
2274 static int build_map_pin_path(struct bpf_map *map, const char *path)
2279 if (!path)
2280 path = "/sys/fs/bpf";
2282 err = pathname_concat(buf, sizeof(buf), path, bpf_map__name(map));
2686 pr_warn("map '%s': couldn't build pin path.\n", map->name);
2736 MAPS_ELF_SEC, obj->path);
3413 off, obj->path, elf_errmsg(-1));
3431 off, obj->path, elf_errmsg(-1));
3446 idx, obj->path, elf_errmsg(-1));
3481 elf_ndxscn(scn), obj->path, elf_errmsg(-1));
3503 elf_ndxscn(scn), obj->path, elf_errmsg(-1));
3538 idx, obj->path, elf_errmsg(-1));
3558 obj->path, elf_errmsg(-1));
3684 obj->path, elf_errmsg(-1));
3712 pr_warn("elf: multiple symbol tables in %s\n", obj->path);
3765 obj->path);
3928 pr_warn("elf: symbol strings section missing or invalid in %s\n", obj->path);
5261 link_opts.uprobe_multi.path = "/";
7819 static struct bpf_object *bpf_object_open(const char *path, const void *obj_buf, size_t obj_buf_sz,
7833 path ? : "(mem buf)");
7849 path = obj_name;
7861 obj = bpf_object__new(path, obj_buf, obj_buf_sz, obj_name);
7911 bpf_object__open_file(const char *path, const struct bpf_object_open_opts *opts)
7913 if (!path)
7916 pr_debug("loading %s\n", path);
7918 return libbpf_ptr(bpf_object_open(path, NULL, 0, opts));
7921 struct bpf_object *bpf_object__open(const char *path)
7923 return bpf_object__open_file(path, NULL);
8429 pr_warn("failed to load object '%s'\n", obj->path);
8438 static int make_parent_dir(const char *path)
8444 dname = strdup(path);
8455 pr_warn("failed to mkdir %s: %s\n", path, cp);
8460 static int check_path(const char *path)
8467 if (path == NULL)
8470 dname = strdup(path);
8483 pr_warn("specified path %s is not on BPF FS\n", path);
8490 int bpf_program__pin(struct bpf_program *prog, const char *path)
8500 err = make_parent_dir(path);
8504 err = check_path(path);
8508 if (bpf_obj_pin(prog->fd, path)) {
8511 pr_warn("prog '%s': failed to pin at '%s': %s\n", prog->name, path, cp);
8515 pr_debug("prog '%s': pinned at '%s'\n", prog->name, path);
8519 int bpf_program__unpin(struct bpf_program *prog, const char *path)
8528 err = check_path(path);
8532 err = unlink(path);
8536 pr_debug("prog '%s': unpinned from '%s'\n", prog->name, path);
8540 int bpf_map__pin(struct bpf_map *map, const char *path)
8551 if (path && strcmp(path, map->pin_path)) {
8552 pr_warn("map '%s' already has pin path '%s' different from '%s'\n",
8553 bpf_map__name(map), map->pin_path, path);
8561 if (!path) {
8562 pr_warn("missing a path to pin map '%s' at\n",
8570 map->pin_path = strdup(path);
8601 int bpf_map__unpin(struct bpf_map *map, const char *path)
8611 if (path && strcmp(path, map->pin_path)) {
8612 pr_warn("map '%s' already has pin path '%s' different from '%s'\n",
8613 bpf_map__name(map), map->pin_path, path);
8616 path = map->pin_path;
8617 } else if (!path) {
8618 pr_warn("no path to unpin map '%s' from\n",
8623 err = check_path(path);
8627 err = unlink(path);
8632 pr_debug("unpinned map '%s' from '%s'\n", bpf_map__name(map), path);
8637 int bpf_map__set_pin_path(struct bpf_map *map, const char *path)
8641 if (path) {
8642 new = strdup(path);
8667 /* bpffs disallows periods in path names */
8675 int bpf_object__pin_maps(struct bpf_object *obj, const char *path)
8695 if (path) {
8696 err = pathname_concat(buf, sizeof(buf), path, bpf_map__name(map));
8723 int bpf_object__unpin_maps(struct bpf_object *obj, const char *path)
8735 if (path) {
8736 err = pathname_concat(buf, sizeof(buf), path, bpf_map__name(map));
8753 int bpf_object__pin_programs(struct bpf_object *obj, const char *path)
8768 err = pathname_concat(buf, sizeof(buf), path, prog->name);
8781 if (pathname_concat(buf, sizeof(buf), path, prog->name))
8790 int bpf_object__unpin_programs(struct bpf_object *obj, const char *path)
8801 err = pathname_concat(buf, sizeof(buf), path, prog->name);
8813 int bpf_object__pin(struct bpf_object *obj, const char *path)
8817 err = bpf_object__pin_maps(obj, path);
8821 err = bpf_object__pin_programs(obj, path);
8823 bpf_object__unpin_maps(obj, path);
8830 int bpf_object__unpin(struct bpf_object *obj, const char *path)
8834 err = bpf_object__unpin_programs(obj, path);
8838 err = bpf_object__unpin_maps(obj, path);
10441 struct bpf_link *bpf_link__open(const char *path)
10446 fd = bpf_obj_get(path);
10449 pr_warn("failed to open link at %s: %d\n", path, fd);
10461 link->pin_path = strdup(path);
10475 int bpf_link__pin(struct bpf_link *link, const char *path)
10481 err = make_parent_dir(path);
10484 err = check_path(path);
10488 link->pin_path = strdup(path);
11566 /* Find offset of function name in object specified by path. "name" matches
11675 /* Get full path to program/shared library. */
11721 const char *path,
11748 * 1) use only path/func_pattern/pid arguments
11750 * 2) use path/pid with allowed combinations of:
11759 if (!path)
11773 if (!strchr(path, '/')) {
11774 err = resolve_full_path(path, full_path, sizeof(full_path));
11776 pr_warn("prog '%s': failed to resolve full path for '%s': %d\n",
11777 prog->name, path, err);
11780 path = full_path;
11783 err = elf_resolve_pattern_offsets(path, func_pattern,
11789 err = elf_resolve_syms_offsets(path, cnt, syms, &resolved_offsets);
11795 lopts.uprobe_multi.path = path;
11870 pr_warn("prog '%s': failed to resolve full path for '%s': %d\n",
11971 * binary can be an absolute/relative path or a filename; the latter is resolved to a
11972 * full binary path via bpf_program__attach_uprobe_opts.
12070 pr_warn("prog '%s': failed to resolve full path for '%s': %d\n",
12101 char *path = NULL, *provider = NULL, *name = NULL;
12112 n = sscanf(sec_name, "usdt/%m[^:]:%m[^:]:%m[^:]", &path, &provider, &name);
12114 pr_warn("invalid section '%s', expected SEC(\"usdt/<path>:<provider>:<name>\")\n",
12118 *link = bpf_program__attach_usdt(prog, -1 /* any process */, path,
12122 free(path);
12140 pr_debug("tracepoint %s/%s path is too long\n",