Esempio n. 1
0
func (bpf *BpfModule) Close() {
	//Debug.Println("Closing BpfModule")
	C.bpf_module_destroy(bpf.p)
	// close the kprobes opened by this module
	for k, v := range bpf.kprobes {
		C.perf_reader_free(v)
		desc := fmt.Sprintf("-:kprobes/%s", k)
		descCS := C.CString(desc)
		C.bpf_detach_kprobe(descCS)
		C.free(unsafe.Pointer(descCS))
	}
	for _, fd := range bpf.funcs {
		err := syscall.Close(fd)
		if err != nil {
			Error.Printf("Error closing bpf fd: %s", err)
		}
	}
}
Esempio n. 2
0
func (bpf *BpfModule) Close() {
	Debug.Println("Closing BpfModule")
	C.bpf_module_destroy(bpf.p)
}