xref: /openbmc/linux/tools/perf/arch/s390/util/machine.c (revision e2c75e76)
1 // SPDX-License-Identifier: GPL-2.0
2 #include <unistd.h>
3 #include <stdio.h>
4 #include <string.h>
5 #include "util.h"
6 #include "machine.h"
7 #include "api/fs/fs.h"
8 
9 int arch__fix_module_text_start(u64 *start, const char *name)
10 {
11 	char path[PATH_MAX];
12 
13 	snprintf(path, PATH_MAX, "module/%.*s/sections/.text",
14 				(int)strlen(name) - 2, name + 1);
15 
16 	if (sysfs__read_ull(path, (unsigned long long *)start) < 0)
17 		return -1;
18 
19 	return 0;
20 }
21