blob: aaa5210ea84ab666bfac02b227fae0cd00e55f59 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001// SPDX-License-Identifier: GPL-2.0
Adrian Huntere477f3f2014-10-23 18:16:03 -03002#include <stdio.h>
3#include <string.h>
4
5#define VDSO__MAP_NAME "[vdso]"
6
7/*
Florian Fainelli01153232018-12-20 19:43:36 -08008 * Include definition of find_map() also used in util/vdso.c for
Adrian Huntere477f3f2014-10-23 18:16:03 -03009 * building perf.
10 */
Florian Fainelli01153232018-12-20 19:43:36 -080011#include "util/find-map.c"
Adrian Huntere477f3f2014-10-23 18:16:03 -030012
13int main(void)
14{
15 void *start, *end;
16 size_t size, written;
17
Florian Fainelli01153232018-12-20 19:43:36 -080018 if (find_map(&start, &end, VDSO__MAP_NAME))
Adrian Huntere477f3f2014-10-23 18:16:03 -030019 return 1;
20
21 size = end - start;
22
23 while (size) {
24 written = fwrite(start, 1, size, stdout);
25 if (!written)
26 return 1;
27 start += written;
28 size -= written;
29 }
30
31 if (fflush(stdout))
32 return 1;
33
34 return 0;
35}