1From 5ed9bda8baf7465172a99ff86ed7f46397b06c7f Mon Sep 17 00:00:00 2001 2From: Andrew Savchenko <bircoph@gmail.com> 3Date: Sat, 5 Sep 2020 14:41:30 +0300 4Subject: [PATCH 01/10] Fix build with musl 5 6--Signature=_Sat__5_Sep_2020_14_41_30_+0300_B.qpPPwu83bbA.32 7Content-Type: text/plain; charset=US-ASCII 8Content-Disposition: inline 9Content-Transfer-Encoding: quoted-printable 10 11When musl is used instead of glibc, oprofile build fails because it 12uses glibc-specific FTW extension: FTW_ACTIONRETVAL for custom 13__delete_old_previous_sample_data return codes and FTW_STOP, 14FTW_CONTINUE for such return codes. Musl supports only POSIX ftw, so 15build fails. 16 17However, this extension is not really needed by oprofile, because 18FTW_SKIP_* are not used and {FTW_STOP,FTW_CONTINUE} can be handled 19by standard return codes {1,0} (more precisely standard defines 20{!0,0}, but in glibc FTW_STOP = 1, so I keep this value). 21 22Upstream-Status: Backport [https://sourceforge.net/p/oprofile/oprofile/ci/5ed9bda8baf7465172a99ff86ed7f46397b06c7f/] 23Signed-off-by: Andrew Savchenko <bircoph@gmail.com> 24--- 25 pe_profiling/operf.cpp | 6 +++--- 26 1 file changed, 3 insertions(+), 3 deletions(-) 27 28diff --git a/pe_profiling/operf.cpp b/pe_profiling/operf.cpp 29index 06a0ea3c..00834409 100644 30--- a/pe_profiling/operf.cpp 31+++ b/pe_profiling/operf.cpp 32@@ -860,9 +860,9 @@ static int __delete_old_previous_sample_data(const char *fpath, 33 { 34 if (remove(fpath)) { 35 perror("sample data removal error"); 36- return FTW_STOP; 37+ return 1; 38 } else { 39- return FTW_CONTINUE; 40+ return 0; 41 } 42 } 43 44@@ -897,7 +897,7 @@ static void convert_sample_data(void) 45 return; 46 47 if (!operf_options::append) { 48- int flags = FTW_DEPTH | FTW_ACTIONRETVAL; 49+ int flags = FTW_DEPTH; 50 errno = 0; 51 if (nftw(previous_sampledir.c_str(), __delete_old_previous_sample_data, 32, flags) !=0 && 52 errno != ENOENT) { 53-- 542.31.0 55 56