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