• Igor Lubashev's avatar
    perf tools: Add helpers to use capabilities if present · c22e150e
    Igor Lubashev authored
    Add utilities to help checking capabilities of the running procss.  Make
    perf link with libcap, if it is available. If no libcap-dev[el],
    fallback to the geteuid() == 0 test used before.
    
    Committer notes:
    
      $ perf test python
      18: 'import perf' in python                               : FAILED!
      $ perf test -v python
      Couldn't bump rlimit(MEMLOCK), failures may take place when creating BPF maps, etc
      18: 'import perf' in python                               :
      --- start ---
      test child forked, pid 23288
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
      ImportError: /tmp/build/perf/python/perf.so: undefined symbol: cap_get_flag
      test child finished with -1
      ---- end ----
      'import perf' in python: FAILED!
      $
    
    This happens because differently from the perf binary generated with
    this patch applied:
    
      $ ldd /tmp/build/perf/perf | grep libcap
      	libcap.so.2 => /lib64/libcap.so.2 (0x00007f724a4ef000)
      $
    
    The python bi...
    c22e150e
cap.c 468 Bytes