| .. | .. |
|---|
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0 |
|---|
| 2 | 2 | #include <errno.h> |
|---|
| 3 | +#include <limits.h> |
|---|
| 3 | 4 | #include <stdio.h> |
|---|
| 5 | +#include <stdlib.h> |
|---|
| 6 | +#include <unistd.h> |
|---|
| 4 | 7 | #include <sys/epoll.h> |
|---|
| 5 | | -#include <util/evlist.h> |
|---|
| 8 | +#include <util/symbol.h> |
|---|
| 6 | 9 | #include <linux/filter.h> |
|---|
| 7 | 10 | #include "tests.h" |
|---|
| 8 | 11 | #include "debug.h" |
|---|
| 9 | 12 | #include "probe-file.h" |
|---|
| 10 | 13 | #include "build-id.h" |
|---|
| 14 | +#include "util.h" |
|---|
| 11 | 15 | |
|---|
| 12 | 16 | /* To test SDT event, we need libelf support to scan elf binary */ |
|---|
| 13 | 17 | #if defined(HAVE_SDT_EVENT) && defined(HAVE_LIBELF_SUPPORT) |
|---|
| .. | .. |
|---|
| 24 | 28 | static int build_id_cache__add_file(const char *filename) |
|---|
| 25 | 29 | { |
|---|
| 26 | 30 | char sbuild_id[SBUILD_ID_SIZE]; |
|---|
| 27 | | - u8 build_id[BUILD_ID_SIZE]; |
|---|
| 31 | + struct build_id bid; |
|---|
| 28 | 32 | int err; |
|---|
| 29 | 33 | |
|---|
| 30 | | - err = filename__read_build_id(filename, &build_id, sizeof(build_id)); |
|---|
| 34 | + err = filename__read_build_id(filename, &bid); |
|---|
| 31 | 35 | if (err < 0) { |
|---|
| 32 | 36 | pr_debug("Failed to read build id of %s\n", filename); |
|---|
| 33 | 37 | return err; |
|---|
| 34 | 38 | } |
|---|
| 35 | 39 | |
|---|
| 36 | | - build_id__sprintf(build_id, sizeof(build_id), sbuild_id); |
|---|
| 40 | + build_id__sprintf(&bid, sbuild_id); |
|---|
| 37 | 41 | err = build_id_cache__add_s(sbuild_id, filename, NULL, false, false); |
|---|
| 38 | 42 | if (err < 0) |
|---|
| 39 | 43 | pr_debug("Failed to add build id cache of %s\n", filename); |
|---|