gccgo.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright 2015 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // +build gccgo
  5. package unix
  6. import "syscall"
  7. // We can't use the gc-syntax .s files for gccgo. On the plus side
  8. // much of the functionality can be written directly in Go.
  9. //extern gccgoRealSyscall
  10. func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr)
  11. func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
  12. syscall.Entersyscall()
  13. r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
  14. syscall.Exitsyscall()
  15. return r, 0, syscall.Errno(errno)
  16. }
  17. func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
  18. syscall.Entersyscall()
  19. r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0)
  20. syscall.Exitsyscall()
  21. return r, 0, syscall.Errno(errno)
  22. }
  23. func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) {
  24. syscall.Entersyscall()
  25. r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9)
  26. syscall.Exitsyscall()
  27. return r, 0, syscall.Errno(errno)
  28. }
  29. func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
  30. r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
  31. return r, 0, syscall.Errno(errno)
  32. }
  33. func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
  34. r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0)
  35. return r, 0, syscall.Errno(errno)
  36. }