libbpf.c (94fb1afb14c4f0ceb8c5508ddddac6819f662e95) libbpf.c (74fc097de327b37e8fe3ff580ce7ffaa7c1740dd)
1// SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
2
3/*
4 * Common eBPF ELF object loading operations.
5 *
6 * Copyright (C) 2013-2015 Alexei Starovoitov <ast@kernel.org>
7 * Copyright (C) 2015 Wang Nan <wangnan0@huawei.com>
8 * Copyright (C) 2015 Huawei Inc.

--- 8292 unchanged lines hidden (view full) ---

8301 char errmsg[STRERR_BUFSIZE];
8302 struct bpf_link *link;
8303 int prog_fd, link_fd;
8304 __u32 target_fd = 0;
8305
8306 if (!OPTS_VALID(opts, bpf_iter_attach_opts))
8307 return ERR_PTR(-EINVAL);
8308
1// SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
2
3/*
4 * Common eBPF ELF object loading operations.
5 *
6 * Copyright (C) 2013-2015 Alexei Starovoitov <ast@kernel.org>
7 * Copyright (C) 2015 Wang Nan <wangnan0@huawei.com>
8 * Copyright (C) 2015 Huawei Inc.

--- 8292 unchanged lines hidden (view full) ---

8301 char errmsg[STRERR_BUFSIZE];
8302 struct bpf_link *link;
8303 int prog_fd, link_fd;
8304 __u32 target_fd = 0;
8305
8306 if (!OPTS_VALID(opts, bpf_iter_attach_opts))
8307 return ERR_PTR(-EINVAL);
8308
8309 if (OPTS_HAS(opts, map_fd)) {
8310 target_fd = opts->map_fd;
8311 link_create_opts.flags = BPF_ITER_LINK_MAP_FD;
8312 }
8309 link_create_opts.iter_info = OPTS_GET(opts, link_info, (void *)0);
8310 link_create_opts.iter_info_len = OPTS_GET(opts, link_info_len, 0);
8313
8314 prog_fd = bpf_program__fd(prog);
8315 if (prog_fd < 0) {
8316 pr_warn("program '%s': can't attach before loaded\n",
8317 bpf_program__title(prog, false));
8318 return ERR_PTR(-EINVAL);
8319 }
8320

--- 1081 unchanged lines hidden ---
8311
8312 prog_fd = bpf_program__fd(prog);
8313 if (prog_fd < 0) {
8314 pr_warn("program '%s': can't attach before loaded\n",
8315 bpf_program__title(prog, false));
8316 return ERR_PTR(-EINVAL);
8317 }
8318

--- 1081 unchanged lines hidden ---