blob: cd6f5a6133fe86c796b7458953ebe868edf3070c [file] [log] [blame]
khenaidooac637102019-01-14 15:44:34 -05001// 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
8package unix
9
10import "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
16func realSyscallNoError(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r uintptr)
17
18//extern gccgoRealSyscall
19func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr)
20
21func 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
28func 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
35func 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
42func 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
49func 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
54func 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
59func 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}