Merge pull request #148535 from martinetd/bpf
bpf update: bcc remove linux kernel dep + devendor libbpf again, bpftrace 0.13.0 -> 0.14.0 + remove kernel dep, pahole 1.20 -> 1.22 + remove submodule, libbpf revert 0.6.0 -> 0.5.0 (unusable)main
commit
c7fa870f5a
@ -1,9 +1,9 @@ |
||||
{ config, lib, ... }: |
||||
{ config, pkgs, lib, ... }: |
||||
{ |
||||
options.programs.bcc.enable = lib.mkEnableOption "bcc"; |
||||
|
||||
config = lib.mkIf config.programs.bcc.enable { |
||||
environment.systemPackages = [ config.boot.kernelPackages.bcc ]; |
||||
boot.extraModulePackages = [ config.boot.kernelPackages.bcc ]; |
||||
environment.systemPackages = [ pkgs.bcc ]; |
||||
boot.extraModulePackages = [ pkgs.bcc ]; |
||||
}; |
||||
} |
||||
|
@ -0,0 +1,25 @@ |
||||
import ./make-test-python.nix ({ pkgs, ... }: { |
||||
name = "bpf"; |
||||
meta.maintainers = with pkgs.lib.maintainers; [ martinetd ]; |
||||
|
||||
machine = { pkgs, ... }: { |
||||
programs.bcc.enable = true; |
||||
environment.systemPackages = with pkgs; [ bpftrace ]; |
||||
}; |
||||
|
||||
testScript = '' |
||||
## bcc |
||||
# syscount -d 1 stops 1s after probe started so is good for that |
||||
print(machine.succeed("syscount -d 1")) |
||||
|
||||
## bpftrace |
||||
# list probes |
||||
machine.succeed("bpftrace -l") |
||||
# simple BEGIN probe (user probe on bpftrace itself) |
||||
print(machine.succeed("bpftrace -e 'BEGIN { print(\"ok\"); exit(); }'")) |
||||
# tracepoint |
||||
print(machine.succeed("bpftrace -e 'tracepoint:syscalls:sys_enter_* { print(probe); exit(); }'")) |
||||
# kprobe |
||||
print(machine.succeed("bpftrace -e 'kprobe:schedule { print(probe); exit() }'")) |
||||
''; |
||||
}) |
@ -0,0 +1,39 @@ |
||||
diff -ur source/src/btf.cpp new/src/btf.cpp
|
||||
--- source/src/btf.cpp 1970-01-01 09:00:01.000000000 +0900
|
||||
+++ new/src/btf.cpp 2021-12-04 21:46:59.337023489 +0900
|
||||
@@ -225,7 +225,7 @@
|
||||
char err_buf[256];
|
||||
int err;
|
||||
|
||||
- dump = btf_dump__new(btf, nullptr, &opts, dump_printf);
|
||||
+ dump = btf_dump__new_deprecated(btf, nullptr, &opts, dump_printf);
|
||||
err = libbpf_get_error(dump);
|
||||
if (err)
|
||||
{
|
||||
@@ -496,7 +496,7 @@
|
||||
char err_buf[256];
|
||||
int err;
|
||||
|
||||
- dump = btf_dump__new(btf, nullptr, &opts, dump_printf);
|
||||
+ dump = btf_dump__new_deprecated(btf, nullptr, &opts, dump_printf);
|
||||
err = libbpf_get_error(dump);
|
||||
if (err)
|
||||
{
|
||||
@@ -554,7 +554,7 @@
|
||||
char err_buf[256];
|
||||
int err;
|
||||
|
||||
- dump = btf_dump__new(btf, nullptr, &opts, dump_printf);
|
||||
+ dump = btf_dump__new_deprecated(btf, nullptr, &opts, dump_printf);
|
||||
err = libbpf_get_error(dump);
|
||||
if (err)
|
||||
{
|
||||
@@ -648,7 +648,7 @@
|
||||
char err_buf[256];
|
||||
int err;
|
||||
|
||||
- dump = btf_dump__new(btf, nullptr, &opts, dump_printf);
|
||||
+ dump = btf_dump__new_deprecated(btf, nullptr, &opts, dump_printf);
|
||||
err = libbpf_get_error(dump);
|
||||
if (err)
|
||||
{
|
@ -1,22 +0,0 @@ |
||||
commit b6172952c0150d84912fa6f09bab782dd0549f1e
|
||||
Author: Austin Seipp <aseipp@pobox.com>
|
||||
Date: Fri May 3 00:47:12 2019 -0500
|
||||
|
||||
src: special case nix build directories for clang
|
||||
|
||||
Signed-off-by: Austin Seipp <aseipp@pobox.com>
|
||||
|
||||
diff --git a/src/clang_parser.cpp b/src/clang_parser.cpp
|
||||
index b1db8ff..0cfb01f 100644
|
||||
--- a/src/utils.cpp
|
||||
+++ b/src/utils.cpp
|
||||
@@ -140,6 +140,9 @@ static bool is_dir(const std::string& path)
|
||||
// Both ksrc and kobj are guaranteed to be != "", if at least some trace of kernel sources was found.
|
||||
std::tuple<std::string, std::string> get_kernel_dirs(const struct utsname& utsname)
|
||||
{
|
||||
+ // NB (aseipp): special case the kernel directory for nix
|
||||
+ return { "@NIX_KERNEL_SRC@/source", "@NIX_KERNEL_SRC@/build" };
|
||||
+
|
||||
#ifdef KERNEL_HEADERS_DIR
|
||||
return {KERNEL_HEADERS_DIR, KERNEL_HEADERS_DIR};
|
||||
#endif
|
Loading…
Reference in new issue