diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2017-09-05 10:38:22 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-09-05 10:38:22 +0200 |
| commit | 5db39ab95395b60c5629a84812086f720adc9ccf (patch) | |
| tree | 75fac9b668196f734366d219ca35613576596bd6 /pkg | |
| parent | c34180fca06cc29d2a29f3c1eec3131c6a0caf16 (diff) | |
sys: rename Call to Syscall
In preparation for moving sys types to prog
to avoid confusion between sys.Call and prog.Call.
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/compiler/compiler.go | 2 | ||||
| -rw-r--r-- | pkg/compiler/gen.go | 10 | ||||
| -rw-r--r-- | pkg/csource/csource.go | 2 | ||||
| -rw-r--r-- | pkg/host/host.go | 16 | ||||
| -rw-r--r-- | pkg/host/host_test.go | 6 |
5 files changed, 18 insertions, 18 deletions
diff --git a/pkg/compiler/compiler.go b/pkg/compiler/compiler.go index fe9f286ad..8cccf53c4 100644 --- a/pkg/compiler/compiler.go +++ b/pkg/compiler/compiler.go @@ -34,7 +34,7 @@ import ( // Prog is description compilation result. type Prog struct { Resources []*sys.ResourceDesc - Syscalls []*sys.Call + Syscalls []*sys.Syscall StructDescs []*sys.KeyedStruct // Set of unsupported syscalls/flags. Unsupported map[string]bool diff --git a/pkg/compiler/gen.go b/pkg/compiler/gen.go index 9f705cf74..e3b7ffd66 100644 --- a/pkg/compiler/gen.go +++ b/pkg/compiler/gen.go @@ -44,8 +44,8 @@ func (comp *compiler) genResource(n *ast.Resource) *sys.ResourceDesc { return res } -func (comp *compiler) genSyscalls() []*sys.Call { - var calls []*sys.Call +func (comp *compiler) genSyscalls() []*sys.Syscall { + var calls []*sys.Syscall for _, decl := range comp.desc.Nodes { if n, ok := decl.(*ast.Call); ok { calls = append(calls, comp.genSyscall(n)) @@ -60,12 +60,12 @@ func (comp *compiler) genSyscalls() []*sys.Call { return calls } -func (comp *compiler) genSyscall(n *ast.Call) *sys.Call { +func (comp *compiler) genSyscall(n *ast.Call) *sys.Syscall { var ret sys.Type if n.Ret != nil { ret = comp.genType(n.Ret, "ret", sys.DirOut, true) } - return &sys.Call{ + return &sys.Syscall{ Name: n.Name.Name, CallName: n.CallName, NR: n.NR, @@ -74,7 +74,7 @@ func (comp *compiler) genSyscall(n *ast.Call) *sys.Call { } } -func (comp *compiler) genStructDescs(syscalls []*sys.Call) []*sys.KeyedStruct { +func (comp *compiler) genStructDescs(syscalls []*sys.Syscall) []*sys.KeyedStruct { // Calculate struct/union/array sizes, add padding to structs and detach // StructDesc's from StructType's. StructType's can be recursive so it's // not possible to write them out inline as other types. To break the diff --git a/pkg/csource/csource.go b/pkg/csource/csource.go index 5c4b2f848..b46fda351 100644 --- a/pkg/csource/csource.go +++ b/pkg/csource/csource.go @@ -367,7 +367,7 @@ loop: fmt.Fprintf(w, "\twrite_file(\"/sys/kernel/debug/fail_futex/ignore-private\", \"N\");\n") fmt.Fprintf(w, "\tinject_fault(%v);\n", opts.FaultNth) } - meta := sys.Calls[instr] + meta := sys.Syscalls[instr] emitCall := true if meta.CallName == "syz_test" { emitCall = false diff --git a/pkg/host/host.go b/pkg/host/host.go index af89ac5aa..9aafbce6e 100644 --- a/pkg/host/host.go +++ b/pkg/host/host.go @@ -16,7 +16,7 @@ import ( ) // DetectSupportedSyscalls returns list on supported syscalls on host. -func DetectSupportedSyscalls() (map[*sys.Call]bool, error) { +func DetectSupportedSyscalls() (map[*sys.Syscall]bool, error) { // There are 3 possible strategies: // 1. Executes all syscalls with presumably invalid arguments and check for ENOSYS. // But not all syscalls are safe to execute. For example, pause will hang, @@ -28,8 +28,8 @@ func DetectSupportedSyscalls() (map[*sys.Call]bool, error) { // Requires CONFIG_KALLSYMS. Seems to be the most reliable. That's what we use here. kallsyms, _ := ioutil.ReadFile("/proc/kallsyms") - supported := make(map[*sys.Call]bool) - for _, c := range sys.Calls { + supported := make(map[*sys.Syscall]bool) + for _, c := range sys.Syscalls { if isSupported(kallsyms, c) { supported[c] = true } @@ -37,7 +37,7 @@ func DetectSupportedSyscalls() (map[*sys.Call]bool, error) { return supported, nil } -func isSupported(kallsyms []byte, c *sys.Call) bool { +func isSupported(kallsyms []byte, c *sys.Syscall) bool { if c.NR == ^uint64(0) { return false // don't even have a syscall number } @@ -59,7 +59,7 @@ func isSupported(kallsyms []byte, c *sys.Call) bool { return bytes.Index(kallsyms, []byte(" T sys_"+c.CallName+"\n")) != -1 } -func isSupportedSyzkall(c *sys.Call) bool { +func isSupportedSyzkall(c *sys.Syscall) bool { switch c.CallName { case "syz_test": return false @@ -112,7 +112,7 @@ func isSupportedSyzkall(c *sys.Call) bool { panic("unknown syzkall: " + c.Name) } -func isSupportedSocket(c *sys.Call) bool { +func isSupportedSocket(c *sys.Syscall) bool { af, ok := c.Args[0].(*sys.ConstType) if !ok { println(c.Name) @@ -125,7 +125,7 @@ func isSupportedSocket(c *sys.Call) bool { return err != syscall.ENOSYS && err != syscall.EAFNOSUPPORT } -func isSupportedOpen(c *sys.Call) bool { +func isSupportedOpen(c *sys.Syscall) bool { fname, ok := extractStringConst(c.Args[0]) if !ok { return true @@ -137,7 +137,7 @@ func isSupportedOpen(c *sys.Call) bool { return err == nil } -func isSupportedOpenAt(c *sys.Call) bool { +func isSupportedOpenAt(c *sys.Syscall) bool { fname, ok := extractStringConst(c.Args[1]) if !ok { return true diff --git a/pkg/host/host_test.go b/pkg/host/host_test.go index 9b44d8e36..1eea00fe6 100644 --- a/pkg/host/host_test.go +++ b/pkg/host/host_test.go @@ -18,7 +18,7 @@ func TestLog(t *testing.T) { t.Skipf("skipping: %v", err) } t.Logf("unsupported:") - for _, c := range sys.Calls { + for _, c := range sys.Syscalls { s, ok := supp[c] if ok && !s { t.Fatalf("map contains false value") @@ -29,7 +29,7 @@ func TestLog(t *testing.T) { } trans := sys.TransitivelyEnabledCalls(supp) t.Logf("transitively unsupported:") - for _, c := range sys.Calls { + for _, c := range sys.Syscalls { s, ok := trans[c] if ok && !s { t.Fatalf("map contains false value") @@ -58,7 +58,7 @@ func TestSupportedSyscalls(t *testing.T) { "stat", } for _, name := range safe { - c := sys.CallMap[name] + c := sys.SyscallMap[name] if c == nil { t.Fatalf("can't find syscall '%v'", name) } |
