aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/host/host.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/host/host.go')
-rw-r--r--pkg/host/host.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/pkg/host/host.go b/pkg/host/host.go
new file mode 100644
index 000000000..f3acd05d9
--- /dev/null
+++ b/pkg/host/host.go
@@ -0,0 +1,27 @@
+// Copyright 2018 syzkaller project authors. All rights reserved.
+// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
+
+package host
+
+import (
+ "github.com/google/syzkaller/prog"
+)
+
+// DetectSupportedSyscalls returns list on supported and unsupported syscalls on the host.
+// For unsupported syscalls it also returns reason as to why it is unsupported.
+func DetectSupportedSyscalls(target *prog.Target, sandbox string) (map[*prog.Syscall]bool, map[*prog.Syscall]string, error) {
+ supported := make(map[*prog.Syscall]bool)
+ unsupported := make(map[*prog.Syscall]string)
+ for _, c := range target.Syscalls {
+ ok, reason := isSupported(c, sandbox)
+ if ok {
+ supported[c] = true
+ } else {
+ if reason == "" {
+ reason = "unknown"
+ }
+ unsupported[c] = reason
+ }
+ }
+ return supported, unsupported, nil
+}