gccgo.go 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 gccgoRealSyscallNoError
  10. func realSyscallNoError(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r uintptr)
  11. //extern gccgoRealSyscall
  12. func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr)
  13. func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) {
  14. syscall.Entersyscall()
  15. r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
  16. syscall.Exitsyscall()
  17. return r, 0
  18. }
  19. func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
  20. syscall.Entersyscall()
  21. r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
  22. syscall.Exitsyscall()
  23. return r, 0, syscall.Errno(errno)
  24. }
  25. func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
  26. syscall.Entersyscall()
  27. r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0)
  28. syscall.Exitsyscall()
  29. return r, 0, syscall.Errno(errno)
  30. }
  31. func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) {
  32. syscall.Entersyscall()
  33. r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9)
  34. syscall.Exitsyscall()
  35. return r, 0, syscall.Errno(errno)
  36. }
  37. func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) {
  38. r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
  39. return r, 0
  40. }
  41. func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
  42. r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
  43. return r, 0, syscall.Errno(errno)
  44. }
  45. func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
  46. r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0)
  47. return r, 0, syscall.Errno(errno)
  48. }