Debian Codegraph @

libgo/go/syscall/syscall_funcs.go

raw
1 // Copyright 2009 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 darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
6 // +build darwin dragonfly freebsd linux netbsd openbsd solaris
7
8 package syscall
9
10 //extern __go_syscall6
11 func syscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) uintptr
12
13 // Do a system call. We look at the size of uintptr to see how to pass
14 // the arguments, so that we don't pass a 64-bit value when the function
15 // expects a 32-bit one.
16 func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) {
17 Entersyscall()
18 SetErrno(0)
19 r := syscall6(trap, a1, a2, a3, 0, 0, 0)
20 err = GetErrno()
21 Exitsyscall()
22 return r, 0, err
23 }
24
25 func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) {
26 Entersyscall()
27 SetErrno(0)
28 r := syscall6(trap, a1, a2, a3, a4, a5, a6)
29 err = GetErrno()
30 Exitsyscall()
31 return r, 0, err
32 }
33
34 func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) {
35 SetErrno(0)
36 r := syscall6(trap, a1, a2, a3, 0, 0, 0)
37 err = GetErrno()
38 return r, 0, err
39 }
40
41 func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) {
42 SetErrno(0)
43 r := syscall6(trap, a1, a2, a3, a4, a5, a6)
44 err = GetErrno()
45 return r, 0, err
46 }