perf-read-vdso.c 510 B

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