Skip to content

Commit

Permalink
fix: remove error message
Browse files Browse the repository at this point in the history
Signed-off-by: Alessio Greggi <[email protected]>
  • Loading branch information
alegrey91 committed Apr 22, 2024
1 parent d3c7e86 commit f501905
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ebpf/ebpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ int trace_syscall(struct trace_event_raw_sys_enter* args) {

tc = bpf_map_lookup_elem(&tracing_status, &key_map_trace);
if (!tc) {
bpf_printk("error getting tracing status");
//bpf_printk("error getting tracing status");
return 1;
}
if (tc->status != 1) {
Expand Down
11 changes: 6 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ var tracepointCategory = "raw_syscalls"
var tracepointName = "sys_enter"

func main() {

functionName := flag.String("fn", "", "Name of the function to trace (mandatory)")
outputFile := flag.String("o", "", "Output file to store the result")
commandOutput := flag.Bool("co", false, "Print command output")
Expand Down Expand Up @@ -163,9 +162,10 @@ func main() {
os.Exit(-1)
}

// init perf buffer
eventsChannel := make(chan []byte)
lostChannel := make(chan uint64)
rb, err := bpfModule.InitPerfBuf("events", eventsChannel, lostChannel, 1024)
rb, err := bpfModule.InitPerfBuf("events", eventsChannel, lostChannel, 1)
if err != nil {
fmt.Println("error initializing PerfBuffer: %v\n", err)
os.Exit(-1)
Expand All @@ -192,13 +192,14 @@ func main() {
select {
case data := <-eventsChannel:
var e event
if err := binary.Read(bytes.NewBuffer(data), binary.LittleEndian, &e); err != nil {
fmt.Fprintf(os.Stderr, "failed to decode received data %q: %s\n", data, err)
err := binary.Read(bytes.NewBuffer(data), binary.LittleEndian, &e)
if err != nil {
return
}
syscalls = append(syscalls, e.SyscallID)
case lost := <-lostChannel:
fmt.Fprintf(os.Stderr, "lost %d data", lost)
fmt.Fprintf(os.Stderr, "lost %d data\n", lost)
return
}
}
}()
Expand Down

0 comments on commit f501905

Please sign in to comment.