9 #include <linux/kernel.h>
15 #include "linux/string.h"
18 static bool vdso_found
;
19 static char vdso_file
[] = "/tmp/perf-vdso.so-XXXXXX";
21 static int find_vdso_map(void **start
, void **end
)
27 maps
= fopen("/proc/self/maps", "r");
29 pr_err("vdso: cannot open maps\n");
33 while (!found
&& fgets(line
, sizeof(line
), maps
)) {
36 /* We care only about private r-x mappings. */
37 if (2 != sscanf(line
, "%p-%p r-xp %*x %*x:%*x %*u %n",
43 if (!strncmp(&line
[m
], VDSO__MAP_NAME
,
44 sizeof(VDSO__MAP_NAME
) - 1))
52 static char *get_file(void)
63 if (find_vdso_map(&start
, &end
))
68 buf
= memdup(start
, size
);
72 fd
= mkstemp(vdso_file
);
76 if (size
== (size_t) write(fd
, buf
, size
))
84 vdso_found
= (vdso
!= NULL
);
94 struct dso
*vdso__dso_findnew(struct machine
*machine
)
96 struct dso
*dso
= dsos__find(&machine
->user_dsos
, VDSO__MAP_NAME
, true);
105 dso
= dso__new(VDSO__MAP_NAME
);
107 dsos__add(&machine
->user_dsos
, dso
);
108 dso__set_long_name(dso
, file
, false);
This page took 0.03282 seconds and 5 git commands to generate.