Linux Audio

Check our new training course

Loading...
Note: File does not exist in v6.13.7.
 1// SPDX-License-Identifier: GPL-2.0
 2static int find_vdso_map(void **start, void **end)
 3{
 4	FILE *maps;
 5	char line[128];
 6	int found = 0;
 7
 8	maps = fopen("/proc/self/maps", "r");
 9	if (!maps) {
10		fprintf(stderr, "vdso: cannot open maps\n");
11		return -1;
12	}
13
14	while (!found && fgets(line, sizeof(line), maps)) {
15		int m = -1;
16
17		/* We care only about private r-x mappings. */
18		if (2 != sscanf(line, "%p-%p r-xp %*x %*x:%*x %*u %n",
19				start, end, &m))
20			continue;
21		if (m < 0)
22			continue;
23
24		if (!strncmp(&line[m], VDSO__MAP_NAME,
25			     sizeof(VDSO__MAP_NAME) - 1))
26			found = 1;
27	}
28
29	fclose(maps);
30	return !found;
31}