perf probe: Fix to probe on gcc generated functions in modules
[linux/fpc-iii.git] / tools / perf / util / find-vdso-map.c
blob95ef1cffc0562ffc78b617f7d1a1cde7bc0abc36
1 static int find_vdso_map(void **start, void **end)
3 FILE *maps;
4 char line[128];
5 int found = 0;
7 maps = fopen("/proc/self/maps", "r");
8 if (!maps) {
9 fprintf(stderr, "vdso: cannot open maps\n");
10 return -1;
13 while (!found && fgets(line, sizeof(line), maps)) {
14 int m = -1;
16 /* We care only about private r-x mappings. */
17 if (2 != sscanf(line, "%p-%p r-xp %*x %*x:%*x %*u %n",
18 start, end, &m))
19 continue;
20 if (m < 0)
21 continue;
23 if (!strncmp(&line[m], VDSO__MAP_NAME,
24 sizeof(VDSO__MAP_NAME) - 1))
25 found = 1;
28 fclose(maps);
29 return !found;