Re: Fix build with musl
William Cohen <[email protected]> Thu, 10 Sep 2020 16:01:31 -0400
| Newsgroups | gmane.linux.oprofile |
|---|---|
| Message-ID | <[email protected]> |
On 9/5/20 7:41 AM, Andrew Savchenko wrote:
Thanks for the patch it has been put into the upstream oprofile git repository. -Will
> When musl is used instead of glibc, oprofile build fails because it
> uses glibc-specific FTW extension: FTW_ACTIONRETVAL for custom
> __delete_old_previous_sample_data return codes and FTW_STOP,
> FTW_CONTINUE for such return codes. Musl supports only POSIX ftw, so
> build fails.
>
> However, this extension is not really needed by oprofile, because
> FTW_SKIP_* are not used and {FTW_STOP,FTW_CONTINUE} can be handled
> by standard return codes {1,0} (more precisely standard defines
> {!0,0}, but in glibc FTW_STOP = 1, so I keep this value).
>
> Signed-off-by: Andrew Savchenko <[email protected]>
> ---
> pe_profiling/operf.cpp | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/pe_profiling/operf.cpp b/pe_profiling/operf.cpp
> index 06a0ea3c..1b882b7c 100644
> --- a/pe_profiling/operf.cpp
> +++ b/pe_profiling/operf.cpp
> @@ -860,9 +860,9 @@ static int __delete_old_previous_sample_data(const char *fpath,
> {
> if (remove(fpath)) {
> perror("sample data removal error");
> - return FTW_STOP;
> + return 1;
> } else {
> - return FTW_CONTINUE;
> + return 0;
> }
> }
>
> @@ -897,7 +897,7 @@ static void convert_sample_data(void)
> return;
>
> if (!operf_options::append) {
> - int flags = FTW_DEPTH | FTW_ACTIONRETVAL;
> + int flags = FTW_DEPTH;
> errno = 0;
> if (nftw(previous_sampledir.c_str(), __delete_old_previous_sample_data, 32, flags) !=0 &&
> errno != ENOENT) {
> --
> 2.24.0
>
> Best regards,
> Andrew Savchenko
>
>
> _______________________________________________
> oprofile-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/oprofile-list