Takahiro Suzuki | 241c10e | 2020-12-17 20:17:57 +0900 | [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 | |
| 5 | // +build gccgo |
| 6 | // +build !aix |
| 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 | |
| 15 | //extern gccgoRealSyscallNoError |
| 16 | func realSyscallNoError(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r uintptr) |
| 17 | |
| 18 | //extern gccgoRealSyscall |
| 19 | func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr) |
| 20 | |
| 21 | func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) { |
| 22 | syscall.Entersyscall() |
| 23 | r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) |
| 24 | syscall.Exitsyscall() |
| 25 | return r, 0 |
| 26 | } |
| 27 | |
| 28 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { |
| 29 | syscall.Entersyscall() |
| 30 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) |
| 31 | syscall.Exitsyscall() |
| 32 | return r, 0, syscall.Errno(errno) |
| 33 | } |
| 34 | |
| 35 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { |
| 36 | syscall.Entersyscall() |
| 37 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) |
| 38 | syscall.Exitsyscall() |
| 39 | return r, 0, syscall.Errno(errno) |
| 40 | } |
| 41 | |
| 42 | func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) { |
| 43 | syscall.Entersyscall() |
| 44 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9) |
| 45 | syscall.Exitsyscall() |
| 46 | return r, 0, syscall.Errno(errno) |
| 47 | } |
| 48 | |
| 49 | func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) { |
| 50 | r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) |
| 51 | return r, 0 |
| 52 | } |
| 53 | |
| 54 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { |
| 55 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) |
| 56 | return r, 0, syscall.Errno(errno) |
| 57 | } |
| 58 | |
| 59 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { |
| 60 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) |
| 61 | return r, 0, syscall.Errno(errno) |
| 62 | } |