gccgo.go 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. // +build !aix
  6. package unix
  7. import "syscall"
  8. // We can't use the gc-syntax .s files for gccgo. On the plus side
  9. // much of the functionality can be written directly in Go.
  10. //extern gccgoRealSyscallNoError
  11. func realSyscallNoError(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r uintptr)
  12. //extern gccgoRealSyscall
  13. func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr)
  14. func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) {
  15. syscall.Entersyscall()
  16. r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
  17. syscall.Exitsyscall()
  18. return r, 0
  19. }
  20. func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
  21. syscall.Entersyscall()
  22. r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
  23. syscall.Exitsyscall()
  24. return r, 0, syscall.Errno(errno)
  25. }
  26. func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
  27. syscall.Entersyscall()
  28. r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0)
  29. syscall.Exitsyscall()
  30. return r, 0, syscall.Errno(errno)
  31. }
  32. func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) {
  33. syscall.Entersyscall()
  34. r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9)
  35. syscall.Exitsyscall()
  36. return r, 0, syscall.Errno(errno)
  37. }
  38. func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) {
  39. r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
  40. return r, 0
  41. }
  42. func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
  43. r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
  44. return r, 0, syscall.Errno(errno)
  45. }
  46. func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
  47. r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0)
  48. return r, 0, syscall.Errno(errno)
  49. }