24 Dec, 2016

1 commit

  • Pull perf fixes from Ingo Molnar:
    "On the kernel side there's two x86 PMU driver fixes and a uprobes fix,
    plus on the tooling side there's a number of fixes and some late
    updates"

    * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (36 commits)
    perf sched timehist: Fix invalid period calculation
    perf sched timehist: Remove hardcoded 'comm_width' check at print_summary
    perf sched timehist: Enlarge default 'comm_width'
    perf sched timehist: Honour 'comm_width' when aligning the headers
    perf/x86: Fix overlap counter scheduling bug
    perf/x86/pebs: Fix handling of PEBS buffer overflows
    samples/bpf: Move open_raw_sock to separate header
    samples/bpf: Remove perf_event_open() declaration
    samples/bpf: Be consistent with bpf_load_program bpf_insn parameter
    tools lib bpf: Add bpf_prog_{attach,detach}
    samples/bpf: Switch over to libbpf
    perf diff: Do not overwrite valid build id
    perf annotate: Don't throw error for zero length symbols
    perf bench futex: Fix lock-pi help string
    perf trace: Check if MAP_32BIT is defined (again)
    samples/bpf: Make perf_event_read() static
    uprobes: Fix uprobes on MIPS, allow for a cache flush after ixol breakpoint creation
    samples/bpf: Make samples more libbpf-centric
    tools lib bpf: Add flags to bpf_create_map()
    tools lib bpf: use __u32 from linux/types.h
    ...

    Linus Torvalds
     

20 Dec, 2016

1 commit

  • Commit d8c5b17f2bc0 ("samples: bpf: add userspace example for attaching
    eBPF programs to cgroups") added these functions to samples/libbpf, but
    during this merge all of the samples libbpf functionality is shifting to
    tools/lib/bpf. Shift these functions there.

    Committer notes:

    Use bzero + attr.FIELD = value instead of 'attr = { .FIELD = value, just
    like the other wrapper calls to sys_bpf with bpf_attr to make this build
    in older toolchais, such as the ones in CentOS 5 and 6.

    Signed-off-by: Joe Stringer
    Cc: Alexei Starovoitov
    Cc: Daniel Borkmann
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-au2zvtsh55vqeo3v3uw7jr4c@git.kernel.org
    Link: https://github.com/joestringer/linux/commit/353e6f298c3d0a92fa8bfa61ff898c5050261a12.patch
    Signed-off-by: Arnaldo Carvalho de Melo

    Joe Stringer
     

18 Dec, 2016

1 commit

  • Pull kbuild updates from Michal Marek:

    - prototypes for x86 asm-exported symbols (Adam Borowski) and a warning
    about missing CRCs (Nick Piggin)

    - asm-exports fix for LTO (Nicolas Pitre)

    - thin archives improvements (Nick Piggin)

    - linker script fix for CONFIG_LD_DEAD_CODE_DATA_ELIMINATION (Nick
    Piggin)

    - genksyms support for __builtin_va_list keyword

    - misc minor fixes

    * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
    x86/kbuild: enable modversions for symbols exported from asm
    kbuild: fix scripts/adjust_autoksyms.sh* for the no modules case
    scripts/kallsyms: remove last remnants of --page-offset option
    make use of make variable CURDIR instead of calling pwd
    kbuild: cmd_export_list: tighten the sed script
    kbuild: minor improvement for thin archives build
    kbuild: modpost warn if export version crc is missing
    kbuild: keep data tables through dead code elimination
    kbuild: improve linker compatibility with lib-ksyms.o build
    genksyms: Regenerate parser
    kbuild/genksyms: handle va_list type
    kbuild: thin archives for multi-y targets
    kbuild: kallsyms allow 3-pass generation if symbols size has changed

    Linus Torvalds
     

16 Dec, 2016

2 commits

  • Commit 6c905981743 ("bpf: pre-allocate hash map elements") introduces
    map_flags to bpf_attr for BPF_MAP_CREATE command. Expose this new
    parameter in libbpf.

    By exposing it, users can access flags such as whether or not to
    preallocate the map.

    Signed-off-by: Joe Stringer
    Acked-by: Wang Nan
    Cc: Alexei Starovoitov
    Cc: Daniel Borkmann
    Link: http://lkml.kernel.org/r/20161209024620.31660-4-joe@ovn.org
    [ Added clarifying comment made by Wang Nan ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Joe Stringer
     
  • Fixes the following issue when building without access to 'u32' type:

    ./tools/lib/bpf/bpf.h:27:23: error: unknown type name ‘u32’

    Signed-off-by: Joe Stringer
    Acked-by: Wang Nan
    Cc: Alexei Starovoitov
    Cc: Daniel Borkmann
    Link: http://lkml.kernel.org/r/20161209024620.31660-3-joe@ovn.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Joe Stringer
     

11 Dec, 2016

1 commit


29 Nov, 2016

3 commits

  • Add a new API to libbpf, caller is able to get bpf_map through the
    offset of bpf_map_def to 'maps' section.

    The API will be used to help jitted perf hook code find fd of a map.

    Signed-off-by: Wang Nan
    Acked-by: Alexei Starovoitov
    Cc: He Kuang
    Cc: Jiri Olsa
    Cc: Joe Stringer
    Cc: Zefan Li
    Cc: pi3orama@163.com
    Link: http://lkml.kernel.org/r/20161126070354.141764-4-wangnan0@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Wang Nan
     
  • Similar to other classes defined in libbpf.h (map and program), allow
    'object' class has its own private data.

    Signed-off-by: Wang Nan
    Acked-by: Alexei Starovoitov
    Cc: He Kuang
    Cc: Joe Stringer
    Cc: Zefan Li
    Cc: pi3orama@163.com
    Link: http://lkml.kernel.org/r/20161126070354.141764-3-wangnan0@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Wang Nan
     
  • Add more BPF map operations to libbpf. Also add bpf_obj_{pin,get}(). They
    can be used on not only BPF maps but also BPF programs.

    Signed-off-by: Wang Nan
    Acked-by: Alexei Starovoitov
    Cc: He Kuang
    Cc: Joe Stringer
    Cc: Zefan Li
    Cc: pi3orama@163.com
    Link: http://lkml.kernel.org/r/20161126070354.141764-2-wangnan0@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Wang Nan
     

25 Nov, 2016

1 commit

  • It is not correct to assimilate the elf data of the maps section to an
    array of map definition. In fact the sizes differ. The offset provided
    in the symbol section has to be used instead.

    This patch fixes a bug causing a elf with two maps not to load
    correctly.

    Wang Nan added:

    This patch requires a name for each BPF map, so array of BPF maps is not
    allowed. This restriction is reasonable, because kernel verifier forbid
    indexing BPF map from such array unless the index is a fixed value, but
    if the index is fixed why not merging it into name?

    For example:

    Program like this:
    ...
    unsigned long cpu = get_smp_processor_id();
    int *pval = map_lookup_elem(&map_array[cpu], &key);
    ...

    Generates bytecode like this:

    0: (b7) r1 = 0
    1: (63) *(u32 *)(r10 -4) = r1
    2: (b7) r1 = 680997
    3: (63) *(u32 *)(r10 -8) = r1
    4: (85) call 8
    5: (67) r0 <
    Cc: Alexei Starovoitov
    Cc: He Kuang
    Cc: Wang Nan
    [ Merge bpf_object__init_maps_name into bpf_object__init_maps.
    Fix segfault for buggy BPF script Validate obj->maps ]
    Cc: Zefan Li
    Cc: pi3orama@163.com
    Link: http://lkml.kernel.org/r/20161115040617.69788-5-wangnan0@huawei.com
    Signed-off-by: Wang Nan
    Signed-off-by: Arnaldo Carvalho de Melo

    Eric Leblond
     

23 Nov, 2016

2 commits

  • Add a way to retrieve the preempt count as well as the latency flags from a
    pevent_record.

    int pevent_data_preempt_count(pevent, record);

    returns the preempt count of a record.

    int pevent_data_flags(pevent, record);

    returns the latency flags for a record.

    Signed-off-by: Steven Rostedt
    Acked-by: Namhyung Kim
    Cc: Andrew Morton
    Cc: Jiri Olsa
    Link: http://lkml.kernel.org/r/20161122113158.03a010a8@gandalf.local.home
    Signed-off-by: Arnaldo Carvalho de Melo

    Steven Rostedt
     
  • Instead of using 1000000, use the define in time64.h instead.

    Also remove the the duplicate defines for NSECS_PER_SEC.

    Signed-off-by: Steven Rostedt
    Acked-by: Namhyung Kim
    Cc: Andrew Morton
    Cc: Jiri Olsa
    Link: http://lkml.kernel.org/r/20161121114149.67111981@gandalf.local.home
    Signed-off-by: Arnaldo Carvalho de Melo

    Steven Rostedt
     

25 Oct, 2016

1 commit

  • Sometimes subcommand have common options and it can only handled in the
    upper level command unless it duplicates the options.

    This patch adds a parent field and fallback to the parent if the given
    argument was not found in the current options.

    Signed-off-by: Namhyung Kim
    Acked-by: Jiri Olsa
    Cc: Andi Kleen
    Cc: David Ahern
    Cc: Josh Poimboeuf
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/20161024030003.28534-1-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     

24 Oct, 2016

5 commits

  • Adding for_each_clear_bit macro plus all its the necessary backbone
    functions. Taken from related kernel code. It will be used in following
    patch.

    Signed-off-by: Jiri Olsa
    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-cayv2zbqi0nlmg5sjjxs1775@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Adding version support for libtraceevent.so object.

    Using the existing EVENT_PARSE_VERSION variable to construct
    the .so object version string, which now consists of:

    $(EP_VERSION).$(EP_PATCHLEVEL).$(EP_EXTRAVERSION)

    Looks like it was created for this purpose anyway.

    The build will now produce following traeceevent libraries:

    $ ll libtraceevent*
    libtraceevent.a
    libtraceevent.so -> libtraceevent.so.1.1.0
    libtraceevent.so.1 -> libtraceevent.so.1.1.0
    libtraceevent.so.1.1.0

    Also the install target will carry them:

    $ make DESTDIR=/tmp/krava prefix=/usr install
    INSTALL trace_plugins
    INSTALL libtraceevent.a
    INSTALL libtraceevent.so.1.1.0

    $ find /tmp/krava/ | xargs ls -l
    ...
    /tmp/krava/usr/lib64:
    total 572
    libtraceevent.a
    libtraceevent.so -> libtraceevent.so.1.1.0
    libtraceevent.so.1 -> libtraceevent.so.1.1.0
    libtraceevent.so.1.1.0
    ...

    Signed-off-by: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/n/tip-v64z62fh0dwt0ueie5usrnac@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • To ease up following patch.

    Signed-off-by: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/n/tip-zpv5gd8y7clwrhh6dq03ucd5@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Decompose the do_install function to ease up
    the following patch a little.

    Signed-off-by: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/n/tip-zzs19yx8seyors532vuer37w@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Adding install_headers target to install all headers
    under 'include/traceevent' path, like:

    $ make DESTDIR=/tmp/krava prefix=/usr install_headers
    $ find /tmp/krava/ -type f
    /tmp/krava/usr/include/traceevent/kbuffer.h
    /tmp/krava/usr/include/traceevent/event-utils.h
    /tmp/krava/usr/include/traceevent/event-parse.h

    Signed-off-by: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/n/tip-if70lj3zhdc3csdqm5webjvc@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

05 Oct, 2016

1 commit

  • When it's called with an offset less than or equal to the first event,
    it'll return a garbage value since the data is not initialized.

    Signed-off-by: Namhyung Kim
    Acked-by: Steven Rostedt
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20161001101700.29146-1-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     

04 Oct, 2016

1 commit

  • Automatically adapt the now wider and word wrapped perf list output to
    wider terminals. This requires querying the terminal before the auto
    pager takes over, and exporting this information from the pager
    subsystem.

    Signed-off-by: Andi Kleen
    Signed-off-by: Sukadev Bhattiprolu
    Acked-by: Ingo Molnar
    Acked-by: Jiri Olsa
    Acked-by: Namhyung Kim
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Madhavan Srinivasan
    Cc: Peter Zijlstra
    Cc: linuxppc-dev@lists.ozlabs.org
    Link: http://lkml.kernel.org/r/1473978296-20712-8-git-send-email-sukadev@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Andi Kleen
     

08 Sep, 2016

1 commit

  • Detect hugetlbfs. hugetlbfs__mountpoint() will be used during recording
    to help identifying hugetlb mmaps: which should be recognized as anon
    mapping.

    Signed-off-by: Wang Nan
    Reviewed-by: Nilay Vaish
    Cc: He Kuang
    Cc: Hou Pengyang
    Cc: Zefan Li
    Link: http://lkml.kernel.org/r/1473137909-142064-3-git-send-email-wangnan0@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Wang Nan
     

04 Aug, 2016

1 commit

  • …ernel/git/acme/linux into perf/urgent

    Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:

    New features:

    - Add --sample-cpu to 'perf record', to explicitely ask for sampling
    the CPU (Jiri Olsa)

    Fixes:

    - Fix processing of multi byte chunks in objdump output, fixing
    disassemble processing for annotation on at least ARM64 (Jan Stancek)

    - Use SyS_epoll_wait in a BPF 'perf test' entry instead of sys_epoll_wait, that
    is not present in the DWARF info in vmlinux files (Arnaldo Carvalho de Melo)

    - Add -wno-shadow when processing files using perl headers, fixing
    the build on Fedora Rawhide and Arch Linux (Namhyung Kim)

    Infrastructure changes:

    - Annotate prep work to better catch and report errors related to
    using objdump to disassemble DSOs (Arnaldo Carvalho de Melo)

    - Add 'alloc', 'scnprintf' and 'and' methods for bitmap processing (Jiri Olsa)

    - Add nested output resorting callback in hists processing (Jiri Olsa)

    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Ingo Molnar
     

03 Aug, 2016

2 commits

  • Add support to perform logical and on bitmaps. Code taken from kernel's
    include/linux/bitmap.h.

    Signed-off-by: Jiri Olsa
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1470074555-24889-4-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Add support to print bitmap list. Code mostly taken from kernel's
    bitmap_list_string.

    Signed-off-by: Jiri Olsa
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1470074555-24889-3-git-send-email-jolsa@kernel.org
    [ s/bitmap_snprintf/bitmap_scnprintf/g as it is a scnprintf wrapper, having the same semantics wrt return value ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

02 Aug, 2016

1 commit


28 Jul, 2016

1 commit

  • Because it uses that function, which would lead every tool using it
    to need to link against tools/lib/str_error_r.o.

    This fixes building tools/vm/, that links with libapi.

    Reported-by: Arjan van de Ven
    Reported-by: Randy Dunlap
    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Fixes: b31e3e3316a7 ("tools lib api fs: Use str_error_r()")
    Link: http://lkml.kernel.org/n/tip-aedt3qzibhnhaov2j4caqi61@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

26 Jul, 2016

1 commit

  • New LLVM will issue newly assigned EM_BPF machine code. The new code
    will be propagated to glibc and libelf.

    This patch introduces the new machine code to libbpf.

    Signed-off-by: Wang Nan
    Acked-by: Alexei Starovoitov
    Cc: Zefan Li
    Cc: pi3orama@163.com
    Link: http://lkml.kernel.org/r/1468821668-60088-1-git-send-email-wangnan0@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Wang Nan
     

16 Jul, 2016

2 commits

  • Add a 'ptr' field to fdarray->priv array.

    This feature will be used by following commits, which introduce
    muiltiple 'struct perf_mmap' arrays for different types of mapping.

    Because of this, during fdarray__filter(), a simple 'idx' is not enough.

    Add a pointer cookie that allows to directly associate a 'struct
    perf_mmap' pointer to an fdarray entry.

    Signed-off-by: Wang Nan
    Acked-by: Jiri Olsa
    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: He Kuang
    Cc: Masami Hiramatsu
    Cc: Namhyung Kim
    Cc: Nilay Vaish
    Cc: Peter Zijlstra
    Cc: Zefan Li
    Cc: pi3orama@163.com
    Link: http://lkml.kernel.org/r/1468485287-33422-3-git-send-email-wangnan0@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Wang Nan
     
  • By using 0 for base, the strtoull() detects the base automatically (see
    'man strtoull').

    ATM we have just one user of this function, the cpu__get_max_freq
    function reading the "cpuinfo_max_freq" sysfs file. It should not get
    affected by this change.

    Committer note:

    This change seems motivated by this discussion:

    "[PATCH] [RFC V1]s390/perf: fix 'start' address of module's map"
    http://lkml.kernel.org/r/20160711120155.GA29929@krava

    I.e. this patches paves the way for filename__read_ull() to be used in a
    S/390 related fix.

    Signed-off-by: Jiri Olsa
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Songshan Gong
    Link: http://lkml.kernel.org/r/1468567797-27564-4-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

14 Jul, 2016

3 commits

  • We need to include netinet/in.h to get the in6_addr struct definition, needed to
    build it on the Android NDK:

    In file included from event-parse.c:36:0:
    /home/acme/android/android-ndk-r12/platforms/android-24/arch-arm/usr/include/netinet/ip6.h:82:18: error: field 'ip6_src' has incomplete type
    struct in6_addr ip6_src; /* source address */

    And it is the canonical way of getting IPv6 definitions, as described,
    for instance, in Linux's 'man ipv6'

    Doing that uncovers another problem: this source file uses PRIu64 but
    doesn't include it, depending on it being included by chance via the now
    replaced header (netinet/ip6.h), fix it.

    Cc: Adrian Hunter
    Cc: Chris Phlipot
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Steven Rostedt
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-tilr31n3yaba1whsd47qlwa3@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Now libbpf support tracepoint program type. Report meaningful error when kernel
    version is less than 4.7.

    Signed-off-by: Wang Nan
    Cc: Alexei Starovoitov
    Cc: Jiri Olsa
    Cc: Zefan Li
    Cc: pi3orama@163.com
    Link: http://lkml.kernel.org/r/1468406646-21642-3-git-send-email-wangnan0@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Wang Nan
     
  • Add 4 new APIs to adjust and query the type of a BPF program.
    Load program according to type set by caller. Default is set to
    BPF_PROG_TYPE_KPROBE.

    Signed-off-by: Wang Nan
    Cc: Alexei Starovoitov
    Cc: Jiri Olsa
    Cc: Zefan Li
    Cc: pi3orama@163.com
    Link: http://lkml.kernel.org/r/1468406646-21642-2-git-send-email-wangnan0@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Wang Nan
     

13 Jul, 2016

7 commits

  • Add a 'CPU' special field to allow the filter in trace-cmd report to
    filter on the task's CPU.

    By adding a special field 'CPU' (all caps) the user can now filter out
    tasks based on which CPU they are on. This is useful when filtering out
    (or in) a bunch of threads.

    -F 'CPU == 0'

    Signed-off-by: Steven Rostedt
    Cc: Andrew Morton
    Cc: Namhyung Kim
    Link: http://lkml.kernel.org/r/20160712093306.5b058103@gandalf.local.home
    Signed-off-by: Arnaldo Carvalho de Melo

    Steven Rostedt
     
  • To allow the build to complete on older systems, where those files are
    either not uptodate, lacking some recent additions or not present at
    all.

    And check if the copy drifts from the kernel, as in this synthetic test:

    BUILD: Doing 'make -j4' parallel build
    Warning: tools/include/linux/bpf.h differs from kernel
    Warning: tools/include/linux/bpf_common.h differs from kernel

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-5plvi2gq4x469dcyybiu226q@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • To make it portable to non-glibc systems, that follow the XSI variant
    instead of the GNU specific one that gets in place when _GNU_SOURCE is
    defined.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Josh Poimboeuf
    Cc: Namhyung Kim
    Cc: Steven Rostedt
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-bozcszy93tpgw9ad6qm3dhpx@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • To make it portable to non-glibc systems, that follow the XSI variant
    instead of the GNU specific one that gets in place when _GNU_SOURCE is
    defined.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Steven Rostedt
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-mixgnh3iyajuqogn2opsocdy@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • To make it portable to non-glibc systems, that follow the XSI variant
    instead of the GNU specific one that gets in place when _GNU_SOURCE is
    defined.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Steven Rostedt
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-c1gn8x978qfop65m510wy43o@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • They were in tools/include/linux/kernel.h, requiring that it in turn
    included stdio.h, which is way too heavy.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Josh Poimboeuf
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-855h8olnkot9v0dajuee1lo3@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • 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
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-d4t42fnf48ytlk8rjxs822tf@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

05 Jul, 2016

1 commit