Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in_ebpf: Handle debian like systems' signal probes #9596

Merged
merged 2 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion plugins/in_ebpf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,37 @@ include_directories(
add_library(gadget INTERFACE)
target_include_directories(gadget INTERFACE ${CMAKE_SOURCE_DIR}/plugins/in_ebpf/traces/includes/external/gadget)

set(LIBC_PATH "/lib64/libc.so.6")

find_program(LSB_RELEASE_EXEC lsb_release)
if (LSB_RELEASE_EXEC)
execute_process(COMMAND ${LSB_RELEASE_EXEC} -i
OUTPUT_VARIABLE LSB_RELEASE_ID_SHORT
OUTPUT_STRIP_TRAILING_WHITESPACE
)

message(STATUS "##### lsb_release -i -- ${LSB_RELEASE_ID_SHORT}")

if (LSB_RELEASE_ID_SHORT MATCHES "Ubuntu" OR
LSB_RELEASE_ID_SHORT MATCHES "Debian" OR
LSB_RELEASE_ID_SHORT MATCHES "LinuxMint")
# Just added for the future enhancement
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)")
set(LIBC_PATH "/usr/lib/aarch64-linux-gnu/libc.so.6")
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(LIBC_PATH "/usr/lib/x86_64-linux-gnu/libc.so.6")
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
set(LIBC_PATH "/usr/lib/i386-linux-gnu/libc.so.6")
endif()
endif()
endif()

# Generate the malloc trace from the template
configure_file(
"${CMAKE_SOURCE_DIR}/plugins/in_ebpf/traces/malloc/bpf.c.in"
"${CMAKE_SOURCE_DIR}/plugins/in_ebpf/traces/malloc/bpf.c"
)

# Find all bpf.c files in the traces directory
file(GLOB_RECURSE TRACE_C_FILES ${CMAKE_SOURCE_DIR}/plugins/in_ebpf/traces/*/bpf.c)

Expand Down Expand Up @@ -90,7 +121,7 @@ add_custom_target(compile_ebpf ALL DEPENDS ${TRACE_OBJ_FILES} ${TRACE_SKEL_HEADE
add_dependencies(compile_ebpf gadget)

# Include generated skeleton headers in the main plugin
include_directories(${CMAKE_BINARY_DIR}/plugins/in_ebpf/traces/includes/generated)
include_directories(${CMAKE_BINARY_DIR}/plugins/in_ebpf/traces/includes/)

# Declare the Fluent Bit plugin (using the default compiler for the main plugin)
FLB_PLUGIN(in_ebpf "${src}" "")
Expand Down
Loading
Loading