Merge tag 'powerpc-5.11-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[linux/fpc-iii.git] / tools / perf / perf-read-vdso.c
blobaaa5210ea84ab666bfac02b227fae0cd00e55f59
1 // SPDX-License-Identifier: GPL-2.0
2 #include <stdio.h>
3 #include <string.h>
5 #define VDSO__MAP_NAME "[vdso]"
7 /*
8 * Include definition of find_map() also used in util/vdso.c for
9 * building perf.
11 #include "util/find-map.c"
13 int main(void)
15 void *start, *end;
16 size_t size, written;
18 if (find_map(&start, &end, VDSO__MAP_NAME))
19 return 1;
21 size = end - start;
23 while (size) {
24 written = fwrite(start, 1, size, stdout);
25 if (!written)
26 return 1;
27 start += written;
28 size -= written;
31 if (fflush(stdout))
32 return 1;
34 return 0;