mirror of
https://github.com/torvalds/linux.git
synced 2026-11-27 08:52:27 +00:00
perf tools copy VDSO out of memory. However, on 64-bit machines there may be 32-bit compatibility VDOs also. To copy those requires separate 32-bit executables. This patch adds to the build additional programs perf-read-vdso32 and perf-read-vdsox32 for 32-bit and x32 respectively. Signed-off-by: Adrian Hunter <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: David Ahern <[email protected]> Cc: Frederic Weisbecker <[email protected]>, Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Stephane Eranian <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
31 lines
581 B
C
31 lines
581 B
C
static int find_vdso_map(void **start, void **end)
|
|
{
|
|
FILE *maps;
|
|
char line[128];
|
|
int found = 0;
|
|
|
|
maps = fopen("/proc/self/maps", "r");
|
|
if (!maps) {
|
|
fprintf(stderr, "vdso: cannot open maps\n");
|
|
return -1;
|
|
}
|
|
|
|
while (!found && fgets(line, sizeof(line), maps)) {
|
|
int m = -1;
|
|
|
|
/* We care only about private r-x mappings. */
|
|
if (2 != sscanf(line, "%p-%p r-xp %*x %*x:%*x %*u %n",
|
|
start, end, &m))
|
|
continue;
|
|
if (m < 0)
|
|
continue;
|
|
|
|
if (!strncmp(&line[m], VDSO__MAP_NAME,
|
|
sizeof(VDSO__MAP_NAME) - 1))
|
|
found = 1;
|
|
}
|
|
|
|
fclose(maps);
|
|
return !found;
|
|
}
|