Skip to content

Commit

Permalink
[EBPF] Replace generated pointers to structs with uintptr (#29221)
Browse files Browse the repository at this point in the history
  • Loading branch information
gjulianm authored and grantseltzer committed Oct 2, 2024
1 parent 4cb5ad8 commit b224e2e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions pkg/ebpf/cgo/genpost.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ func main() {
convertInt8ArrayToByteArrayRegex := regexp.MustCompile(`(` + strings.Join(int8variableNames, "|") + `)(\s+)\[(\d+)\]u?int8`)
b = convertInt8ArrayToByteArrayRegex.ReplaceAll(b, []byte("$1$2[$3]byte"))

// Convert generated pointers to CGo structs to uintptr
convertPointerToUint64Regex := regexp.MustCompile(`\*_Ctype_struct_(\w+)`)
b = convertPointerToUint64Regex.ReplaceAll(b, []byte("uintptr"))

b, err = format.Source(b)
if err != nil {
log.Fatal(err)
Expand Down
8 changes: 4 additions & 4 deletions pkg/network/ebpf/kprobe_types_linux.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tasks/system_probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ def ninja_cgo_type_files(nw: NinjaWriter):
inputs=[f],
outputs=[os.path.join(in_dir, out_file)],
rule="godefs",
implicit=headers,
implicit=headers + [script_path],
variables={
"in_dir": in_dir,
"in_file": in_file,
Expand Down

0 comments on commit b224e2e

Please sign in to comment.