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