github.com/go-darwin/sys@v0.0.0-20220510002607-68fd01f054ca/libc.go (about)

     1  // Copyright 2021 The Go Darwin Authors
     2  // SPDX-License-Identifier: BSD-3-Clause
     3  
     4  //go:build darwin
     5  // +build darwin
     6  
     7  package sys
     8  
     9  import (
    10  	_ "syscall" // for go:linkname
    11  	"unsafe"
    12  )
    13  
    14  //go:noescape
    15  //go:nosplit
    16  //go:linkname libcCall runtime.libcCall
    17  func libcCall(fn, arg unsafe.Pointer) int32
    18  
    19  // LibcCall call fn with arg as its argument. Return what fn returns.
    20  // fn is the raw pc value of the entry point of the desired function.
    21  // Switches to the system stack, if not already there.
    22  // Preserves the calling point as the location where a profiler traceback will begin.
    23  //
    24  //go:nosplit
    25  func LibcCall(fn, arg unsafe.Pointer) int32 {
    26  	return libcCall(fn, arg)
    27  }