blob: 0dee23222ca803f4327364537458b379eb5ac4ba [file] [log] [blame]
Naveen Sampath04696f72022-06-13 15:19:14 +05301// 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//go:build gccgo && !aix
6// +build gccgo,!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
15func realSyscallNoError(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r uintptr)
16
17func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr)
18
19func 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
26func 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
33func 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
40func 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
47func 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
52func 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
57func 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}