perf-read-vdso.c 546 B

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