github.com/bored-engineer/go-launchd@v0.0.0-20230905041514-6aff1185c30f/libc.go (about)

     1  //go:build darwin
     2  // +build darwin
     3  
     4  package launchd
     5  
     6  import "unsafe"
     7  
     8  // free is defined in libxpc.dylib
     9  var libc_free_trampoline_addr uintptr
    10  
    11  //go:cgo_import_dynamic libc_free free "/usr/lib/libSystem.B.dylib"
    12  
    13  //go:nosplit
    14  func free(ptr unsafe.Pointer) {
    15  	syscall_syscall(libc_free_trampoline_addr, uintptr(ptr), 0, 0)
    16  }