forked from hybridgroup/gobot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
37 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package sysfs | ||
|
||
import ( | ||
"syscall" | ||
) | ||
|
||
type SystemCaller interface { | ||
Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) | ||
} | ||
|
||
type NativeSyscall struct{} | ||
type MockSyscall struct{} | ||
|
||
var sys SystemCaller = &NativeSyscall{} | ||
|
||
func SetSyscall(s SystemCaller) { | ||
sys = s | ||
} | ||
|
||
func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { | ||
return sys.Syscall(trap, a1, a2, a3) | ||
} | ||
|
||
func (sys *NativeSyscall) Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { | ||
return syscall.Syscall(trap, a1, a2, a3) | ||
} | ||
|
||
func (sys *MockSyscall) Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { | ||
return 0, 0, 0 | ||
} |