xref: /linux/tools/perf/perf-read-vdso.c (revision 93df8a1ed6231727c5db94a80b1a6bd5ee67cec3)
1 #include <stdio.h>
2 #include <string.h>
3 
4 #define VDSO__MAP_NAME "[vdso]"
5 
6 /*
7  * Include definition of find_vdso_map() also used in util/vdso.c for
8  * building perf.
9  */
10 #include "util/find-vdso-map.c"
11 
12 int main(void)
13 {
14 	void *start, *end;
15 	size_t size, written;
16 
17 	if (find_vdso_map(&start, &end))
18 		return 1;
19 
20 	size = end - start;
21 
22 	while (size) {
23 		written = fwrite(start, 1, size, stdout);
24 		if (!written)
25 			return 1;
26 		start += written;
27 		size -= written;
28 	}
29 
30 	if (fflush(stdout))
31 		return 1;
32 
33 	return 0;
34 }
35