func buildCallList() map[*sys.Call]bool { calls, err := host.DetectSupportedSyscalls() if err != nil { log.Printf("failed to detect host supported syscalls: %v", err) for _, c := range sys.Calls { calls[c] = true } } for _, c := range sys.Calls { if !calls[c] { log.Printf("disabling unsupported syscall: %v", c.Name) } } trans := sys.TransitivelyEnabledCalls(calls) for c := range calls { if !trans[c] { log.Printf("disabling transitively unsupported syscall: %v", c.Name) delete(calls, c) } } return calls }
func buildCallList(enabledCalls string) map[*sys.Call]bool { calls := make(map[*sys.Call]bool) if enabledCalls != "" { for _, id := range strings.Split(enabledCalls, ",") { n, err := strconv.ParseUint(id, 10, 64) if err != nil || n >= uint64(len(sys.Calls)) { panic(fmt.Sprintf("invalid syscall in -calls flag: '%v", id)) } calls[sys.Calls[n]] = true } } else { for _, c := range sys.Calls { calls[c] = true } } if supp, err := host.DetectSupportedSyscalls(); err != nil { logf(0, "failed to detect host supported syscalls: %v", err) } else { for c := range calls { if !supp[c] { logf(1, "disabling unsupported syscall: %v", c.Name) delete(calls, c) } } } trans := sys.TransitivelyEnabledCalls(calls) for c := range calls { if !trans[c] { logf(1, "disabling transitively unsupported syscall: %v", c.Name) delete(calls, c) } } return calls }