xref: /OK3568_Linux_fs/buildroot/package/oprofile/0001-musl.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1Remove non-Posix use of FTW_ACTIONRETVAL
2
3The musl implementation of nftw doesn't support the glibc extension
4FTW_ACTIONRETVAL. Since none of the features of FTW_ACTIONRETVAL are
5used here, just use the normal nftw return value.
6
7Downloaded from:
8https://github.com/openwrt-mirror/openwrt/blob/f22d5e25660106a48727c7aa5d1a73e4171a7987/package/devel/oprofile/patches/100-musl.patch
9after I found a hint for the patch here:
10http://patchwork.openembedded.org/patch/112675/
11
12Removed unneeded patch for libop/op_events.c.
13
14Because openwrt removed the oprofile package from their repo last week
15https://github.com/openwrt-mirror/openwrt/commit/aaf46a8524e138e1673a398e8d2dd9357405b313#diff-fe14456f94abf436d997e2c01c10f3bd
16I decided to put this patch into the buildroot repo instead of adding
17_PATCH to oprofile.mk
18
19Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
20
21--- a/pe_profiling/operf.cpp
22+++ b/pe_profiling/operf.cpp
23@@ -857,11 +857,14 @@ static int __delete_old_previous_sample_
24                                 int tflag  __attribute__((unused)),
25                                 struct FTW *ftwbuf __attribute__((unused)))
26 {
27+	int err;
28+
29 	if (remove(fpath)) {
30+		err = errno;
31 		perror("sample data removal error");
32-		return FTW_STOP;
33+		return err;
34 	} else {
35-		return FTW_CONTINUE;
36+		return 0;
37 	}
38 }
39
40@@ -896,7 +899,7 @@ static void convert_sample_data(void)
41 		return;
42
43 	if (!operf_options::append) {
44-                int flags = FTW_DEPTH | FTW_ACTIONRETVAL;
45+                int flags = FTW_DEPTH;
46 		errno = 0;
47 		if (nftw(previous_sampledir.c_str(), __delete_old_previous_sample_data, 32, flags) !=0 &&
48 				errno != ENOENT) {
49