William Kurkian | ea86948 | 2019-04-09 15:16:11 -0400 | [diff] [blame] | 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 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 5 | //go:build gccgo && !aix |
| 6 | // +build gccgo,!aix |
William Kurkian | ea86948 | 2019-04-09 15:16:11 -0400 | [diff] [blame] | 7 | |
| 8 | package unix |
| 9 | |
| 10 | import "syscall" |
| 11 | |
| 12 | // We can't use the gc-syntax .s files for gccgo. On the plus side |
| 13 | // much of the functionality can be written directly in Go. |
| 14 | |
William Kurkian | ea86948 | 2019-04-09 15:16:11 -0400 | [diff] [blame] | 15 | func realSyscallNoError(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r uintptr) |
| 16 | |
William Kurkian | ea86948 | 2019-04-09 15:16:11 -0400 | [diff] [blame] | 17 | func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr) |
| 18 | |
| 19 | func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) { |
| 20 | syscall.Entersyscall() |
| 21 | r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) |
| 22 | syscall.Exitsyscall() |
| 23 | return r, 0 |
| 24 | } |
| 25 | |
| 26 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { |
| 27 | syscall.Entersyscall() |
| 28 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) |
| 29 | syscall.Exitsyscall() |
| 30 | return r, 0, syscall.Errno(errno) |
| 31 | } |
| 32 | |
| 33 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { |
| 34 | syscall.Entersyscall() |
| 35 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) |
| 36 | syscall.Exitsyscall() |
| 37 | return r, 0, syscall.Errno(errno) |
| 38 | } |
| 39 | |
| 40 | func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) { |
| 41 | syscall.Entersyscall() |
| 42 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9) |
| 43 | syscall.Exitsyscall() |
| 44 | return r, 0, syscall.Errno(errno) |
| 45 | } |
| 46 | |
| 47 | func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) { |
| 48 | r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) |
| 49 | return r, 0 |
| 50 | } |
| 51 | |
| 52 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { |
| 53 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) |
| 54 | return r, 0, syscall.Errno(errno) |
| 55 | } |
| 56 | |
| 57 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { |
| 58 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) |
| 59 | return r, 0, syscall.Errno(errno) |
| 60 | } |