mirror of
https://github.com/torvalds/linux.git
synced 2026-11-24 23:47:06 +00:00
In preparation for checking that the vectors page on the ARM architecture, refactor the find_vdso_map() function to accept finding an arbitrary string and create a dedicated helper function for that under util/find-map.c and update the filename to find-map.c and all references to it: perf-read-vdso.c and util/vdso.c. Signed-off-by: Florian Fainelli <[email protected]> Acked-by: Jiri Olsa <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Chris Healy <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Kim Phillips <[email protected]> Cc: Lucas Stach <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Ravi Bangoria <[email protected]> Cc: Russell King <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Thomas Richter <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
36 lines
547 B
C
36 lines
547 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
#define VDSO__MAP_NAME "[vdso]"
|
|
|
|
/*
|
|
* Include definition of find_map() also used in util/vdso.c for
|
|
* building perf.
|
|
*/
|
|
#include "util/find-map.c"
|
|
|
|
int main(void)
|
|
{
|
|
void *start, *end;
|
|
size_t size, written;
|
|
|
|
if (find_map(&start, &end, VDSO__MAP_NAME))
|
|
return 1;
|
|
|
|
size = end - start;
|
|
|
|
while (size) {
|
|
written = fwrite(start, 1, size, stdout);
|
|
if (!written)
|
|
return 1;
|
|
start += written;
|
|
size -= written;
|
|
}
|
|
|
|
if (fflush(stdout))
|
|
return 1;
|
|
|
|
return 0;
|
|
}
|