mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
syscall: move uses of Syscall to libSystem on darwin
Miscellaneous additional conversions from raw syscalls to using their libc equivalent. Update #17490 Change-Id: If9ab22cc1d676c1f20fb161ebf02b0c28f71585d Reviewed-on: https://go-review.googlesource.com/c/148257 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
5d6e8f3142
commit
c9762b8a7e
14 changed files with 378 additions and 75 deletions
|
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build darwin dragonfly freebsd netbsd openbsd
|
||||
// +build dragonfly freebsd netbsd openbsd
|
||||
|
||||
// Berkeley packet filter for BSD variants
|
||||
|
||||
|
|
|
|||
185
src/syscall/bpf_darwin.go
Normal file
185
src/syscall/bpf_darwin.go
Normal file
|
|
@ -0,0 +1,185 @@
|
|||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Berkeley packet filter for Darwin
|
||||
|
||||
package syscall
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// Deprecated: Use golang.org/x/net/bpf instead.
|
||||
func BpfStmt(code, k int) *BpfInsn {
|
||||
return &BpfInsn{Code: uint16(code), K: uint32(k)}
|
||||
}
|
||||
|
||||
// Deprecated: Use golang.org/x/net/bpf instead.
|
||||
func BpfJump(code, k, jt, jf int) *BpfInsn {
|
||||
return &BpfInsn{Code: uint16(code), Jt: uint8(jt), Jf: uint8(jf), K: uint32(k)}
|
||||
}
|
||||
|
||||
// Deprecated: Use golang.org/x/net/bpf instead.
|
||||
func BpfBuflen(fd int) (int, error) {
|
||||
var l int
|
||||
err := ioctlPtr(fd, BIOCGBLEN, unsafe.Pointer(&l))
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return l, nil
|
||||
}
|
||||
|
||||
// Deprecated: Use golang.org/x/net/bpf instead.
|
||||
func SetBpfBuflen(fd, l int) (int, error) {
|
||||
err := ioctlPtr(fd, BIOCSBLEN, unsafe.Pointer(&l))
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return l, nil
|
||||
}
|
||||
|
||||
// Deprecated: Use golang.org/x/net/bpf instead.
|
||||
func BpfDatalink(fd int) (int, error) {
|
||||
var t int
|
||||
err := ioctlPtr(fd, BIOCGDLT, unsafe.Pointer(&t))
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return t, nil
|
||||
}
|
||||
|
||||
// Deprecated: Use golang.org/x/net/bpf instead.
|
||||
func SetBpfDatalink(fd, t int) (int, error) {
|
||||
err := ioctlPtr(fd, BIOCSDLT, unsafe.Pointer(&t))
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return t, nil
|
||||
}
|
||||
|
||||
// Deprecated: Use golang.org/x/net/bpf instead.
|
||||
func SetBpfPromisc(fd, m int) error {
|
||||
err := ioctlPtr(fd, BIOCPROMISC, unsafe.Pointer(&m))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Deprecated: Use golang.org/x/net/bpf instead.
|
||||
func FlushBpf(fd int) error {
|
||||
err := ioctlPtr(fd, BIOCFLUSH, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ivalue struct {
|
||||
name [IFNAMSIZ]byte
|
||||
value int16
|
||||
}
|
||||
|
||||
// Deprecated: Use golang.org/x/net/bpf instead.
|
||||
func BpfInterface(fd int, name string) (string, error) {
|
||||
var iv ivalue
|
||||
err := ioctlPtr(fd, BIOCGETIF, unsafe.Pointer(&iv))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return name, nil
|
||||
}
|
||||
|
||||
// Deprecated: Use golang.org/x/net/bpf instead.
|
||||
func SetBpfInterface(fd int, name string) error {
|
||||
var iv ivalue
|
||||
copy(iv.name[:], []byte(name))
|
||||
err := ioctlPtr(fd, BIOCSETIF, unsafe.Pointer(&iv))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Deprecated: Use golang.org/x/net/bpf instead.
|
||||
func BpfTimeout(fd int) (*Timeval, error) {
|
||||
var tv Timeval
|
||||
err := ioctlPtr(fd, BIOCGRTIMEOUT, unsafe.Pointer(&tv))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &tv, nil
|
||||
}
|
||||
|
||||
// Deprecated: Use golang.org/x/net/bpf instead.
|
||||
func SetBpfTimeout(fd int, tv *Timeval) error {
|
||||
err := ioctlPtr(fd, BIOCSRTIMEOUT, unsafe.Pointer(tv))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Deprecated: Use golang.org/x/net/bpf instead.
|
||||
func BpfStats(fd int) (*BpfStat, error) {
|
||||
var s BpfStat
|
||||
err := ioctlPtr(fd, BIOCGSTATS, unsafe.Pointer(&s))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &s, nil
|
||||
}
|
||||
|
||||
// Deprecated: Use golang.org/x/net/bpf instead.
|
||||
func SetBpfImmediate(fd, m int) error {
|
||||
err := ioctlPtr(fd, BIOCIMMEDIATE, unsafe.Pointer(&m))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Deprecated: Use golang.org/x/net/bpf instead.
|
||||
func SetBpf(fd int, i []BpfInsn) error {
|
||||
var p BpfProgram
|
||||
p.Len = uint32(len(i))
|
||||
p.Insns = (*BpfInsn)(unsafe.Pointer(&i[0]))
|
||||
err := ioctlPtr(fd, BIOCSETF, unsafe.Pointer(&p))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Deprecated: Use golang.org/x/net/bpf instead.
|
||||
func CheckBpfVersion(fd int) error {
|
||||
var v BpfVersion
|
||||
err := ioctlPtr(fd, BIOCVERSION, unsafe.Pointer(&v))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if v.Major != BPF_MAJOR_VERSION || v.Minor != BPF_MINOR_VERSION {
|
||||
return EINVAL
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Deprecated: Use golang.org/x/net/bpf instead.
|
||||
func BpfHeadercmpl(fd int) (int, error) {
|
||||
var f int
|
||||
err := ioctlPtr(fd, BIOCGHDRCMPLT, unsafe.Pointer(&f))
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return f, nil
|
||||
}
|
||||
|
||||
// Deprecated: Use golang.org/x/net/bpf instead.
|
||||
func SetBpfHeadercmpl(fd, f int) error {
|
||||
err := ioctlPtr(fd, BIOCSHDRCMPLT, unsafe.Pointer(&f))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
@ -248,7 +248,8 @@ func runtime_AfterExec()
|
|||
|
||||
// execveLibc is non-nil on OS using libc syscall, set to execve in exec_libc.go; this
|
||||
// avoids a build dependency for other platforms.
|
||||
var execveLibc func(path uintptr, argv uintptr, envp uintptr) (err Errno)
|
||||
var execveLibc func(path uintptr, argv uintptr, envp uintptr) Errno
|
||||
var execveDarwin func(path *byte, argv **byte, envp **byte) error
|
||||
|
||||
// Exec invokes the execve(2) system call.
|
||||
func Exec(argv0 string, argv []string, envv []string) (err error) {
|
||||
|
|
@ -266,13 +267,16 @@ func Exec(argv0 string, argv []string, envv []string) (err error) {
|
|||
}
|
||||
runtime_BeforeExec()
|
||||
|
||||
var err1 Errno
|
||||
var err1 error
|
||||
if runtime.GOOS == "solaris" || runtime.GOOS == "aix" {
|
||||
// RawSyscall should never be used on Solaris or AIX.
|
||||
err1 = execveLibc(
|
||||
uintptr(unsafe.Pointer(argv0p)),
|
||||
uintptr(unsafe.Pointer(&argvp[0])),
|
||||
uintptr(unsafe.Pointer(&envvp[0])))
|
||||
} else if runtime.GOOS == "darwin" {
|
||||
// Similarly on Darwin.
|
||||
err1 = execveDarwin(argv0p, &argvp[0], &envvp[0])
|
||||
} else {
|
||||
_, _, err1 = RawSyscall(SYS_EXECVE,
|
||||
uintptr(unsafe.Pointer(argv0p)),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// +build linux darwin freebsd openbsd netbsd dragonfly
|
||||
// +build linux freebsd openbsd netbsd dragonfly
|
||||
|
||||
// Copyright 2014 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
|
|
|
|||
13
src/syscall/flock_darwin.go
Normal file
13
src/syscall/flock_darwin.go
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package syscall
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
|
||||
func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
|
||||
_, err := fcntlPtr(int(fd), cmd, unsafe.Pointer(lk))
|
||||
return err
|
||||
}
|
||||
|
|
@ -33,6 +33,8 @@ func main() {
|
|||
}
|
||||
in := string(in1) + string(in2) + string(in3)
|
||||
|
||||
trampolines := map[string]bool{}
|
||||
|
||||
var out bytes.Buffer
|
||||
|
||||
fmt.Fprintf(&out, "// go run mkasm_darwin.go %s\n", strings.Join(os.Args[1:], " "))
|
||||
|
|
@ -43,9 +45,12 @@ func main() {
|
|||
continue
|
||||
}
|
||||
fn := line[5 : len(line)-13]
|
||||
if !trampolines[fn] {
|
||||
trampolines[fn] = true
|
||||
fmt.Fprintf(&out, "TEXT ·%s_trampoline(SB),NOSPLIT,$0-0\n", fn)
|
||||
fmt.Fprintf(&out, "\tJMP\t%s(SB)\n", fn)
|
||||
}
|
||||
}
|
||||
err = ioutil.WriteFile(fmt.Sprintf("zsyscall_darwin_%s.s", arch), out.Bytes(), 0644)
|
||||
if err != nil {
|
||||
log.Fatalf("can't write zsyscall_darwin_%s.s: %s", arch, err)
|
||||
|
|
|
|||
|
|
@ -99,6 +99,9 @@ sub parseparam($) {
|
|||
return ($1, $2);
|
||||
}
|
||||
|
||||
# set of trampolines we've already generated
|
||||
my %trampolines;
|
||||
|
||||
my $text = "";
|
||||
while(<>) {
|
||||
chomp;
|
||||
|
|
@ -338,6 +341,8 @@ while(<>) {
|
|||
$text .= "\treturn\n";
|
||||
$text .= "}\n\n";
|
||||
if($darwin) {
|
||||
if (not exists $trampolines{$funcname}) {
|
||||
$trampolines{$funcname} = 1;
|
||||
# The assembly trampoline that jumps to the libc routine.
|
||||
$text .= "func ${funcname}_trampoline()\n";
|
||||
# Map syscall.funcname to just plain funcname.
|
||||
|
|
@ -347,6 +352,7 @@ while(<>) {
|
|||
my $basename = substr $funcname, 5;
|
||||
$text .= "//go:cgo_import_dynamic $funcname $basename \"/usr/lib/libSystem.B.dylib\"\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
chomp $text;
|
||||
|
|
|
|||
|
|
@ -339,9 +339,15 @@ func Kill(pid int, signum Signal) (err error) { return kill(pid, int(signum), 1)
|
|||
//sys munmap(addr uintptr, length uintptr) (err error)
|
||||
//sysnb fork() (pid int, err error)
|
||||
//sysnb ioctl(fd int, req int, arg int) (err error)
|
||||
//sysnb execve(path *byte, argv *byte, envp *byte) (err error)
|
||||
//sysnb ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) = SYS_ioctl
|
||||
//sysnb execve(path *byte, argv **byte, envp **byte) (err error)
|
||||
//sysnb exit(res int) (err error)
|
||||
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error)
|
||||
//sys fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (val int, err error) = SYS_fcntl
|
||||
|
||||
func init() {
|
||||
execveDarwin = execve
|
||||
}
|
||||
|
||||
func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
|
||||
r0, _, e1 := syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
|
||||
|
|
|
|||
|
|
@ -1738,6 +1738,27 @@ func libc_write_trampoline()
|
|||
//go:cgo_import_dynamic libc_write write "/usr/lib/libSystem.B.dylib"
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func writev(fd int, iovecs []Iovec) (cnt uintptr, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(iovecs) > 0 {
|
||||
_p0 = unsafe.Pointer(&iovecs[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := syscall(funcPC(libc_writev_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(iovecs)))
|
||||
cnt = uintptr(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func libc_writev_trampoline()
|
||||
|
||||
//go:linkname libc_writev libc_writev
|
||||
//go:cgo_import_dynamic libc_writev writev "/usr/lib/libSystem.B.dylib"
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) {
|
||||
r0, _, e1 := syscall9(funcPC(libc_mmap_trampoline), uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0)
|
||||
ret = uintptr(r0)
|
||||
|
|
@ -1796,7 +1817,17 @@ func libc_ioctl_trampoline()
|
|||
//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib"
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func execve(path *byte, argv *byte, envp *byte) (err error) {
|
||||
func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
|
||||
_, _, e1 := rawSyscall(funcPC(libc_ioctl_trampoline), uintptr(fd), uintptr(req), uintptr(arg))
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func execve(path *byte, argv **byte, envp **byte) (err error) {
|
||||
_, _, e1 := rawSyscall(funcPC(libc_execve_trampoline), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(argv)), uintptr(unsafe.Pointer(envp)))
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
|
|
@ -1844,25 +1875,15 @@ func libc_sysctl_trampoline()
|
|||
//go:cgo_import_dynamic libc_sysctl sysctl "/usr/lib/libSystem.B.dylib"
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func writev(fd int, iovecs []Iovec) (cnt uintptr, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(iovecs) > 0 {
|
||||
_p0 = unsafe.Pointer(&iovecs[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := syscall(funcPC(libc_writev_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(iovecs)))
|
||||
cnt = uintptr(r0)
|
||||
func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (val int, err error) {
|
||||
r0, _, e1 := syscall(funcPC(libc_fcntl_trampoline), uintptr(fd), uintptr(cmd), uintptr(arg))
|
||||
val = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func libc_writev_trampoline()
|
||||
|
||||
//go:linkname libc_writev libc_writev
|
||||
//go:cgo_import_dynamic libc_writev writev "/usr/lib/libSystem.B.dylib"
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Gettimeofday(tp *Timeval) (err error) {
|
||||
|
|
|
|||
|
|
@ -223,6 +223,8 @@ TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0
|
|||
JMP libc_unmount(SB)
|
||||
TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_write(SB)
|
||||
TEXT ·libc_writev_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_writev(SB)
|
||||
TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_mmap(SB)
|
||||
TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0
|
||||
|
|
@ -237,7 +239,5 @@ TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0
|
|||
JMP libc_exit(SB)
|
||||
TEXT ·libc_sysctl_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_sysctl(SB)
|
||||
TEXT ·libc_writev_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_writev(SB)
|
||||
TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_gettimeofday(SB)
|
||||
|
|
|
|||
|
|
@ -1738,6 +1738,27 @@ func libc_write_trampoline()
|
|||
//go:cgo_import_dynamic libc_write write "/usr/lib/libSystem.B.dylib"
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func writev(fd int, iovecs []Iovec) (cnt uintptr, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(iovecs) > 0 {
|
||||
_p0 = unsafe.Pointer(&iovecs[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := syscallX(funcPC(libc_writev_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(iovecs)))
|
||||
cnt = uintptr(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func libc_writev_trampoline()
|
||||
|
||||
//go:linkname libc_writev libc_writev
|
||||
//go:cgo_import_dynamic libc_writev writev "/usr/lib/libSystem.B.dylib"
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) {
|
||||
r0, _, e1 := syscall6X(funcPC(libc_mmap_trampoline), uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos))
|
||||
ret = uintptr(r0)
|
||||
|
|
@ -1796,7 +1817,17 @@ func libc_ioctl_trampoline()
|
|||
//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib"
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func execve(path *byte, argv *byte, envp *byte) (err error) {
|
||||
func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
|
||||
_, _, e1 := rawSyscall(funcPC(libc_ioctl_trampoline), uintptr(fd), uintptr(req), uintptr(arg))
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func execve(path *byte, argv **byte, envp **byte) (err error) {
|
||||
_, _, e1 := rawSyscall(funcPC(libc_execve_trampoline), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(argv)), uintptr(unsafe.Pointer(envp)))
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
|
|
@ -1844,25 +1875,15 @@ func libc_sysctl_trampoline()
|
|||
//go:cgo_import_dynamic libc_sysctl sysctl "/usr/lib/libSystem.B.dylib"
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func writev(fd int, iovecs []Iovec) (cnt uintptr, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(iovecs) > 0 {
|
||||
_p0 = unsafe.Pointer(&iovecs[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := syscallX(funcPC(libc_writev_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(iovecs)))
|
||||
cnt = uintptr(r0)
|
||||
func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (val int, err error) {
|
||||
r0, _, e1 := syscall(funcPC(libc_fcntl_trampoline), uintptr(fd), uintptr(cmd), uintptr(arg))
|
||||
val = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func libc_writev_trampoline()
|
||||
|
||||
//go:linkname libc_writev libc_writev
|
||||
//go:cgo_import_dynamic libc_writev writev "/usr/lib/libSystem.B.dylib"
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Gettimeofday(tp *Timeval) (err error) {
|
||||
|
|
|
|||
|
|
@ -223,6 +223,8 @@ TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0
|
|||
JMP libc_unmount(SB)
|
||||
TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_write(SB)
|
||||
TEXT ·libc_writev_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_writev(SB)
|
||||
TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_mmap(SB)
|
||||
TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0
|
||||
|
|
@ -237,7 +239,5 @@ TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0
|
|||
JMP libc_exit(SB)
|
||||
TEXT ·libc_sysctl_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_sysctl(SB)
|
||||
TEXT ·libc_writev_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_writev(SB)
|
||||
TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_gettimeofday(SB)
|
||||
|
|
|
|||
|
|
@ -1738,6 +1738,27 @@ func libc_write_trampoline()
|
|||
//go:cgo_import_dynamic libc_write write "/usr/lib/libSystem.B.dylib"
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func writev(fd int, iovecs []Iovec) (cnt uintptr, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(iovecs) > 0 {
|
||||
_p0 = unsafe.Pointer(&iovecs[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := syscall(funcPC(libc_writev_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(iovecs)))
|
||||
cnt = uintptr(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func libc_writev_trampoline()
|
||||
|
||||
//go:linkname libc_writev libc_writev
|
||||
//go:cgo_import_dynamic libc_writev writev "/usr/lib/libSystem.B.dylib"
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) {
|
||||
r0, _, e1 := syscall9(funcPC(libc_mmap_trampoline), uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0)
|
||||
ret = uintptr(r0)
|
||||
|
|
@ -1796,7 +1817,17 @@ func libc_ioctl_trampoline()
|
|||
//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib"
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func execve(path *byte, argv *byte, envp *byte) (err error) {
|
||||
func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
|
||||
_, _, e1 := rawSyscall(funcPC(libc_ioctl_trampoline), uintptr(fd), uintptr(req), uintptr(arg))
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func execve(path *byte, argv **byte, envp **byte) (err error) {
|
||||
_, _, e1 := rawSyscall(funcPC(libc_execve_trampoline), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(argv)), uintptr(unsafe.Pointer(envp)))
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
|
|
@ -1844,25 +1875,15 @@ func libc_sysctl_trampoline()
|
|||
//go:cgo_import_dynamic libc_sysctl sysctl "/usr/lib/libSystem.B.dylib"
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func writev(fd int, iovecs []Iovec) (cnt uintptr, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(iovecs) > 0 {
|
||||
_p0 = unsafe.Pointer(&iovecs[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := syscall(funcPC(libc_writev_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(iovecs)))
|
||||
cnt = uintptr(r0)
|
||||
func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (val int, err error) {
|
||||
r0, _, e1 := syscall(funcPC(libc_fcntl_trampoline), uintptr(fd), uintptr(cmd), uintptr(arg))
|
||||
val = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func libc_writev_trampoline()
|
||||
|
||||
//go:linkname libc_writev libc_writev
|
||||
//go:cgo_import_dynamic libc_writev writev "/usr/lib/libSystem.B.dylib"
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Gettimeofday(tp *Timeval) (err error) {
|
||||
|
|
|
|||
|
|
@ -1738,6 +1738,27 @@ func libc_write_trampoline()
|
|||
//go:cgo_import_dynamic libc_write write "/usr/lib/libSystem.B.dylib"
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func writev(fd int, iovecs []Iovec) (cnt uintptr, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(iovecs) > 0 {
|
||||
_p0 = unsafe.Pointer(&iovecs[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := syscallX(funcPC(libc_writev_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(iovecs)))
|
||||
cnt = uintptr(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func libc_writev_trampoline()
|
||||
|
||||
//go:linkname libc_writev libc_writev
|
||||
//go:cgo_import_dynamic libc_writev writev "/usr/lib/libSystem.B.dylib"
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) {
|
||||
r0, _, e1 := syscall6X(funcPC(libc_mmap_trampoline), uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos))
|
||||
ret = uintptr(r0)
|
||||
|
|
@ -1796,7 +1817,17 @@ func libc_ioctl_trampoline()
|
|||
//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib"
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func execve(path *byte, argv *byte, envp *byte) (err error) {
|
||||
func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
|
||||
_, _, e1 := rawSyscall(funcPC(libc_ioctl_trampoline), uintptr(fd), uintptr(req), uintptr(arg))
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func execve(path *byte, argv **byte, envp **byte) (err error) {
|
||||
_, _, e1 := rawSyscall(funcPC(libc_execve_trampoline), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(argv)), uintptr(unsafe.Pointer(envp)))
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
|
|
@ -1844,25 +1875,15 @@ func libc_sysctl_trampoline()
|
|||
//go:cgo_import_dynamic libc_sysctl sysctl "/usr/lib/libSystem.B.dylib"
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func writev(fd int, iovecs []Iovec) (cnt uintptr, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(iovecs) > 0 {
|
||||
_p0 = unsafe.Pointer(&iovecs[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := syscallX(funcPC(libc_writev_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(iovecs)))
|
||||
cnt = uintptr(r0)
|
||||
func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (val int, err error) {
|
||||
r0, _, e1 := syscall(funcPC(libc_fcntl_trampoline), uintptr(fd), uintptr(cmd), uintptr(arg))
|
||||
val = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func libc_writev_trampoline()
|
||||
|
||||
//go:linkname libc_writev libc_writev
|
||||
//go:cgo_import_dynamic libc_writev writev "/usr/lib/libSystem.B.dylib"
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Gettimeofday(tp *Timeval) (err error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue