dsos.c (cbecf716ca618fd44feda6bd9a64a8179d031fc5) dsos.c (67fd18924647bdcafab18c2945a79ddea73653de)
1// SPDX-License-Identifier: GPL-2.0
2#include "debug.h"
3#include "dsos.h"
4#include "dso.h"
1// SPDX-License-Identifier: GPL-2.0
2#include "debug.h"
3#include "dsos.h"
4#include "dso.h"
5#include "util.h"
5#include "vdso.h"
6#include "namespaces.h"
6#include "vdso.h"
7#include "namespaces.h"
8#include <errno.h>
7#include <libgen.h>
8#include <stdlib.h>
9#include <string.h>
10#include <symbol.h> // filename__read_build_id
9#include <libgen.h>
10#include <stdlib.h>
11#include <string.h>
12#include <symbol.h> // filename__read_build_id
13#include <unistd.h>
11
12static int __dso_id__cmp(struct dso_id *a, struct dso_id *b)
13{
14 if (a->maj > b->maj) return -1;
15 if (a->maj < b->maj) return 1;
16
17 if (a->min > b->min) return -1;
18 if (a->min < b->min) return 1;

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

71 if (pos->has_build_id) {
72 have_build_id = true;
73 continue;
74 }
75 nsinfo__mountns_enter(pos->nsinfo, &nsc);
76 if (filename__read_build_id(pos->long_name, &pos->bid) > 0) {
77 have_build_id = true;
78 pos->has_build_id = true;
14
15static int __dso_id__cmp(struct dso_id *a, struct dso_id *b)
16{
17 if (a->maj > b->maj) return -1;
18 if (a->maj < b->maj) return 1;
19
20 if (a->min > b->min) return -1;
21 if (a->min < b->min) return 1;

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

74 if (pos->has_build_id) {
75 have_build_id = true;
76 continue;
77 }
78 nsinfo__mountns_enter(pos->nsinfo, &nsc);
79 if (filename__read_build_id(pos->long_name, &pos->bid) > 0) {
80 have_build_id = true;
81 pos->has_build_id = true;
82 } else if (errno == ENOENT && pos->nsinfo) {
83 char *new_name = filename_with_chroot(pos->nsinfo->pid,
84 pos->long_name);
85
86 if (new_name && filename__read_build_id(new_name,
87 &pos->bid) > 0) {
88 have_build_id = true;
89 pos->has_build_id = true;
90 }
91 free(new_name);
79 }
80 nsinfo__mountns_exit(&nsc);
81 }
82
83 return have_build_id;
84}
85
86static int __dso__cmp_long_name(const char *long_name, struct dso_id *id, struct dso *b)

--- 224 unchanged lines hidden ---
92 }
93 nsinfo__mountns_exit(&nsc);
94 }
95
96 return have_build_id;
97}
98
99static int __dso__cmp_long_name(const char *long_name, struct dso_id *id, struct dso *b)

--- 224 unchanged lines hidden ---