Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1 | Fix glibc-isms so that oprofile builds with musl. |
| 2 | |
| 3 | Patch taken from openwrt (https://github.com/openwrt-mirror/openwrt/blob/master/package/devel/oprofile/patches/100-musl.patch) |
| 4 | |
| 5 | Upstream-Status: Pending |
| 6 | Signed-off-by: Ross Burton <ross.burton@intel.com> |
| 7 | |
| 8 | --- a/pe_profiling/operf.cpp |
| 9 | +++ b/pe_profiling/operf.cpp |
| 10 | @@ -857,11 +857,14 @@ static int __delete_old_previous_sample_ |
| 11 | int tflag __attribute__((unused)), |
| 12 | struct FTW *ftwbuf __attribute__((unused))) |
| 13 | { |
| 14 | + int err; |
| 15 | + |
| 16 | if (remove(fpath)) { |
| 17 | + err = errno; |
| 18 | perror("sample data removal error"); |
| 19 | - return FTW_STOP; |
| 20 | + return err; |
| 21 | } else { |
| 22 | - return FTW_CONTINUE; |
| 23 | + return 0; |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | @@ -896,7 +899,7 @@ static void convert_sample_data(void) |
| 28 | return; |
| 29 | |
| 30 | if (!operf_options::append) { |
| 31 | - int flags = FTW_DEPTH | FTW_ACTIONRETVAL; |
| 32 | + int flags = FTW_DEPTH; |
| 33 | errno = 0; |
| 34 | if (nftw(previous_sampledir.c_str(), __delete_old_previous_sample_data, 32, flags) !=0 && |
| 35 | errno != ENOENT) { |
| 36 | --- a/libop/op_events.c |
| 37 | +++ b/libop/op_events.c |
| 38 | @@ -83,7 +83,7 @@ static int parse_hex(char const * str) |
| 39 | static u64 parse_long_hex(char const * str) |
| 40 | { |
| 41 | u64 value; |
| 42 | - if (sscanf(str, "%Lx", &value) != 1) |
| 43 | + if (sscanf(str, "0x%llx", &value) != 1) |
| 44 | parse_error("expected long hexadecimal value"); |
| 45 | |
| 46 | fflush(stderr); |