]> git.baikalelectronics.ru Git - kernel.git/commit
tools: Introduce str_error_r()
authorArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 6 Jul 2016 14:56:20 +0000 (11:56 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 12 Jul 2016 18:19:47 +0000 (15:19 -0300)
commit7f9c82b3bba51d4c31d802258a8e7f58c1f2a16e
treee6f40aa67f1a3ea28c53bf74fc1d51c9c3ec74c2
parent6dbbae2d735b917f038ae8a0d39faba85cfac692
tools: Introduce str_error_r()

The tools so far have been using the strerror_r() GNU variant, that
returns a string, be it the buffer passed or something else.

But that, besides being tricky in cases where we expect that the
function using strerror_r() returns the error formatted in a provided
buffer (we have to check if it returned something else and copy that
instead), breaks the build on systems not using glibc, like Alpine
Linux, where musl libc is used.

So, introduce yet another wrapper, str_error_r(), that has the GNU
interface, but uses the portable XSI variant of strerror_r(), so that
users rest asured that the provided buffer is used and it is what is
returned.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-d4t42fnf48ytlk8rjxs822tf@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
41 files changed:
tools/include/linux/string.h
tools/lib/str_error_r.c [new file with mode: 0644]
tools/perf/MANIFEST
tools/perf/arch/x86/tests/rdpmc.c
tools/perf/builtin-buildid-cache.c
tools/perf/builtin-help.c
tools/perf/builtin-kvm.c
tools/perf/builtin-probe.c
tools/perf/builtin-record.c
tools/perf/builtin-sched.c
tools/perf/builtin-stat.c
tools/perf/builtin-top.c
tools/perf/builtin-trace.c
tools/perf/perf.c
tools/perf/tests/backward-ring-buffer.c
tools/perf/tests/bpf.c
tools/perf/tests/builtin-test.c
tools/perf/tests/event-times.c
tools/perf/tests/mmap-basic.c
tools/perf/tests/openat-syscall-all-cpus.c
tools/perf/tests/openat-syscall-tp-fields.c
tools/perf/tests/openat-syscall.c
tools/perf/tests/perf-record.c
tools/perf/tests/sw-clock.c
tools/perf/tests/task-exit.c
tools/perf/ui/browsers/hists.c
tools/perf/util/Build
tools/perf/util/bpf-loader.c
tools/perf/util/cloexec.c
tools/perf/util/data.c
tools/perf/util/debug.h
tools/perf/util/dso.c
tools/perf/util/evlist.c
tools/perf/util/evsel.c
tools/perf/util/llvm-utils.c
tools/perf/util/probe-event.c
tools/perf/util/probe-file.c
tools/perf/util/probe-finder.c
tools/perf/util/python-ext-sources
tools/perf/util/target.c
tools/perf/util/util.h