示例#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)
		}
	}
}
示例#2
0
func (bpf *BpfModule) Close() {
	Debug.Println("Closing BpfModule")
	C.bpf_module_destroy(bpf.p)
}