Source file src/runtime/sys_darwin.go

     1  // Copyright 2018 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  package runtime
     6  
     7  import (
     8  	"internal/abi"
     9  	"runtime/internal/atomic"
    10  	"unsafe"
    11  )
    12  
    13  // The X versions of syscall expect the libc call to return a 64-bit result.
    14  // Otherwise (the non-X version) expects a 32-bit result.
    15  // This distinction is required because an error is indicated by returning -1,
    16  // and we need to know whether to check 32 or 64 bits of the result.
    17  // (Some libc functions that return 32 bits put junk in the upper 32 bits of AX.)
    18  
    19  //go:linkname syscall_syscall syscall.syscall
    20  //go:nosplit
    21  func syscall_syscall(fn, a1, a2, a3 uintptr) (r1, r2, err uintptr) {
    22  	args := struct{ fn, a1, a2, a3, r1, r2, err uintptr }{fn, a1, a2, a3, r1, r2, err}
    23  	entersyscall()
    24  	libcCall(unsafe.Pointer(abi.FuncPCABI0(syscall)), unsafe.Pointer(&args))
    25  	exitsyscall()
    26  	return args.r1, args.r2, args.err
    27  }
    28  func syscall()
    29  
    30  //go:linkname syscall_syscallX syscall.syscallX
    31  //go:nosplit
    32  func syscall_syscallX(fn, a1, a2, a3 uintptr) (r1, r2, err uintptr) {
    33  	args := struct{ fn, a1, a2, a3, r1, r2, err uintptr }{fn, a1, a2, a3, r1, r2, err}
    34  	entersyscall()
    35  	libcCall(unsafe.Pointer(abi.FuncPCABI0(syscallX)), unsafe.Pointer(&args))
    36  	exitsyscall()
    37  	return args.r1, args.r2, args.err
    38  }
    39  func syscallX()
    40  
    41  //go:linkname syscall_syscall6 syscall.syscall6
    42  //go:nosplit
    43  func syscall_syscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) {
    44  	args := struct{ fn, a1, a2, a3, a4, a5, a6, r1, r2, err uintptr }{fn, a1, a2, a3, a4, a5, a6, r1, r2, err}
    45  	entersyscall()
    46  	libcCall(unsafe.Pointer(abi.FuncPCABI0(syscall6)), unsafe.Pointer(&args))
    47  	exitsyscall()
    48  	return args.r1, args.r2, args.err
    49  }
    50  func syscall6()
    51  
    52  //go:linkname syscall_syscall6X syscall.syscall6X
    53  //go:nosplit
    54  func syscall_syscall6X(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) {
    55  	args := struct{ fn, a1, a2, a3, a4, a5, a6, r1, r2, err uintptr }{fn, a1, a2, a3, a4, a5, a6, r1, r2, err}
    56  	entersyscall()
    57  	libcCall(unsafe.Pointer(abi.FuncPCABI0(syscall6X)), unsafe.Pointer(&args))
    58  	exitsyscall()
    59  	return args.r1, args.r2, args.err
    60  }
    61  func syscall6X()
    62  
    63  //go:linkname syscall_syscallPtr syscall.syscallPtr
    64  //go:nosplit
    65  func syscall_syscallPtr(fn, a1, a2, a3 uintptr) (r1, r2, err uintptr) {
    66  	args := struct{ fn, a1, a2, a3, r1, r2, err uintptr }{fn, a1, a2, a3, r1, r2, err}
    67  	entersyscall()
    68  	libcCall(unsafe.Pointer(abi.FuncPCABI0(syscallPtr)), unsafe.Pointer(&args))
    69  	exitsyscall()
    70  	return args.r1, args.r2, args.err
    71  }
    72  func syscallPtr()
    73  
    74  //go:linkname syscall_rawSyscall syscall.rawSyscall
    75  //go:nosplit
    76  func syscall_rawSyscall(fn, a1, a2, a3 uintptr) (r1, r2, err uintptr) {
    77  	args := struct{ fn, a1, a2, a3, r1, r2, err uintptr }{fn, a1, a2, a3, r1, r2, err}
    78  	libcCall(unsafe.Pointer(abi.FuncPCABI0(syscall)), unsafe.Pointer(&args))
    79  	return args.r1, args.r2, args.err
    80  }
    81  
    82  //go:linkname syscall_rawSyscall6 syscall.rawSyscall6
    83  //go:nosplit
    84  func syscall_rawSyscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) {
    85  	args := struct{ fn, a1, a2, a3, a4, a5, a6, r1, r2, err uintptr }{fn, a1, a2, a3, a4, a5, a6, r1, r2, err}
    86  	libcCall(unsafe.Pointer(abi.FuncPCABI0(syscall6)), unsafe.Pointer(&args))
    87  	return args.r1, args.r2, args.err
    88  }
    89  
    90  // syscallNoErr is used in crypto/x509 to call into Security.framework and CF.
    91  
    92  //go:linkname crypto_x509_syscall crypto/x509/internal/macos.syscall
    93  //go:nosplit
    94  func crypto_x509_syscall(fn, a1, a2, a3, a4, a5 uintptr, f1 float64) (r1 uintptr) {
    95  	args := struct {
    96  		fn, a1, a2, a3, a4, a5 uintptr
    97  		f1                     float64
    98  		r1                     uintptr
    99  	}{fn, a1, a2, a3, a4, a5, f1, r1}
   100  	entersyscall()
   101  	libcCall(unsafe.Pointer(abi.FuncPCABI0(syscall_x509)), unsafe.Pointer(&args))
   102  	exitsyscall()
   103  	return args.r1
   104  }
   105  func syscall_x509()
   106  
   107  // The *_trampoline functions convert from the Go calling convention to the C calling convention
   108  // and then call the underlying libc function.  They are defined in sys_darwin_$ARCH.s.
   109  
   110  //go:nosplit
   111  //go:cgo_unsafe_args
   112  func pthread_attr_init(attr *pthreadattr) int32 {
   113  	ret := libcCall(unsafe.Pointer(abi.FuncPCABI0(pthread_attr_init_trampoline)), unsafe.Pointer(&attr))
   114  	KeepAlive(attr)
   115  	return ret
   116  }
   117  func pthread_attr_init_trampoline()
   118  
   119  //go:nosplit
   120  //go:cgo_unsafe_args
   121  func pthread_attr_getstacksize(attr *pthreadattr, size *uintptr) int32 {
   122  	ret := libcCall(unsafe.Pointer(abi.FuncPCABI0(pthread_attr_getstacksize_trampoline)), unsafe.Pointer(&attr))
   123  	KeepAlive(attr)
   124  	KeepAlive(size)
   125  	return ret
   126  }
   127  func pthread_attr_getstacksize_trampoline()
   128  
   129  //go:nosplit
   130  //go:cgo_unsafe_args
   131  func pthread_attr_setdetachstate(attr *pthreadattr, state int) int32 {
   132  	ret := libcCall(unsafe.Pointer(abi.FuncPCABI0(pthread_attr_setdetachstate_trampoline)), unsafe.Pointer(&attr))
   133  	KeepAlive(attr)
   134  	return ret
   135  }
   136  func pthread_attr_setdetachstate_trampoline()
   137  
   138  //go:nosplit
   139  //go:cgo_unsafe_args
   140  func pthread_create(attr *pthreadattr, start uintptr, arg unsafe.Pointer) int32 {
   141  	ret := libcCall(unsafe.Pointer(abi.FuncPCABI0(pthread_create_trampoline)), unsafe.Pointer(&attr))
   142  	KeepAlive(attr)
   143  	KeepAlive(arg) // Just for consistency. Arg of course needs to be kept alive for the start function.
   144  	return ret
   145  }
   146  func pthread_create_trampoline()
   147  
   148  //go:nosplit
   149  //go:cgo_unsafe_args
   150  func raise(sig uint32) {
   151  	libcCall(unsafe.Pointer(abi.FuncPCABI0(raise_trampoline)), unsafe.Pointer(&sig))
   152  }
   153  func raise_trampoline()
   154  
   155  //go:nosplit
   156  //go:cgo_unsafe_args
   157  func pthread_self() (t pthread) {
   158  	libcCall(unsafe.Pointer(abi.FuncPCABI0(pthread_self_trampoline)), unsafe.Pointer(&t))
   159  	return
   160  }
   161  func pthread_self_trampoline()
   162  
   163  //go:nosplit
   164  //go:cgo_unsafe_args
   165  func pthread_kill(t pthread, sig uint32) {
   166  	libcCall(unsafe.Pointer(abi.FuncPCABI0(pthread_kill_trampoline)), unsafe.Pointer(&t))
   167  	return
   168  }
   169  func pthread_kill_trampoline()
   170  
   171  // mmap is used to do low-level memory allocation via mmap. Don't allow stack
   172  // splits, since this function (used by sysAlloc) is called in a lot of low-level
   173  // parts of the runtime and callers often assume it won't acquire any locks.
   174  //
   175  //go:nosplit
   176  func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uint32) (unsafe.Pointer, int) {
   177  	args := struct {
   178  		addr            unsafe.Pointer
   179  		n               uintptr
   180  		prot, flags, fd int32
   181  		off             uint32
   182  		ret1            unsafe.Pointer
   183  		ret2            int
   184  	}{addr, n, prot, flags, fd, off, nil, 0}
   185  	libcCall(unsafe.Pointer(abi.FuncPCABI0(mmap_trampoline)), unsafe.Pointer(&args))
   186  	return args.ret1, args.ret2
   187  }
   188  func mmap_trampoline()
   189  
   190  //go:nosplit
   191  //go:cgo_unsafe_args
   192  func munmap(addr unsafe.Pointer, n uintptr) {
   193  	libcCall(unsafe.Pointer(abi.FuncPCABI0(munmap_trampoline)), unsafe.Pointer(&addr))
   194  	KeepAlive(addr) // Just for consistency. Hopefully addr is not a Go address.
   195  }
   196  func munmap_trampoline()
   197  
   198  //go:nosplit
   199  //go:cgo_unsafe_args
   200  func madvise(addr unsafe.Pointer, n uintptr, flags int32) {
   201  	libcCall(unsafe.Pointer(abi.FuncPCABI0(madvise_trampoline)), unsafe.Pointer(&addr))
   202  	KeepAlive(addr) // Just for consistency. Hopefully addr is not a Go address.
   203  }
   204  func madvise_trampoline()
   205  
   206  //go:nosplit
   207  //go:cgo_unsafe_args
   208  func mlock(addr unsafe.Pointer, n uintptr) {
   209  	libcCall(unsafe.Pointer(abi.FuncPCABI0(mlock_trampoline)), unsafe.Pointer(&addr))
   210  	KeepAlive(addr) // Just for consistency. Hopefully addr is not a Go address.
   211  }
   212  func mlock_trampoline()
   213  
   214  //go:nosplit
   215  //go:cgo_unsafe_args
   216  func read(fd int32, p unsafe.Pointer, n int32) int32 {
   217  	ret := libcCall(unsafe.Pointer(abi.FuncPCABI0(read_trampoline)), unsafe.Pointer(&fd))
   218  	KeepAlive(p)
   219  	return ret
   220  }
   221  func read_trampoline()
   222  
   223  func pipe() (r, w int32, errno int32) {
   224  	var p [2]int32
   225  	errno = libcCall(unsafe.Pointer(abi.FuncPCABI0(pipe_trampoline)), noescape(unsafe.Pointer(&p)))
   226  	return p[0], p[1], errno
   227  }
   228  func pipe_trampoline()
   229  
   230  //go:nosplit
   231  //go:cgo_unsafe_args
   232  func closefd(fd int32) int32 {
   233  	return libcCall(unsafe.Pointer(abi.FuncPCABI0(close_trampoline)), unsafe.Pointer(&fd))
   234  }
   235  func close_trampoline()
   236  
   237  // This is exported via linkname to assembly in runtime/cgo.
   238  //
   239  //go:nosplit
   240  //go:cgo_unsafe_args
   241  //go:linkname exit
   242  func exit(code int32) {
   243  	libcCall(unsafe.Pointer(abi.FuncPCABI0(exit_trampoline)), unsafe.Pointer(&code))
   244  }
   245  func exit_trampoline()
   246  
   247  //go:nosplit
   248  //go:cgo_unsafe_args
   249  func usleep(usec uint32) {
   250  	libcCall(unsafe.Pointer(abi.FuncPCABI0(usleep_trampoline)), unsafe.Pointer(&usec))
   251  }
   252  func usleep_trampoline()
   253  
   254  //go:nosplit
   255  //go:cgo_unsafe_args
   256  func usleep_no_g(usec uint32) {
   257  	asmcgocall_no_g(unsafe.Pointer(abi.FuncPCABI0(usleep_trampoline)), unsafe.Pointer(&usec))
   258  }
   259  
   260  //go:nosplit
   261  //go:cgo_unsafe_args
   262  func write1(fd uintptr, p unsafe.Pointer, n int32) int32 {
   263  	ret := libcCall(unsafe.Pointer(abi.FuncPCABI0(write_trampoline)), unsafe.Pointer(&fd))
   264  	KeepAlive(p)
   265  	return ret
   266  }
   267  func write_trampoline()
   268  
   269  //go:nosplit
   270  //go:cgo_unsafe_args
   271  func open(name *byte, mode, perm int32) (ret int32) {
   272  	ret = libcCall(unsafe.Pointer(abi.FuncPCABI0(open_trampoline)), unsafe.Pointer(&name))
   273  	KeepAlive(name)
   274  	return
   275  }
   276  func open_trampoline()
   277  
   278  //go:nosplit
   279  //go:cgo_unsafe_args
   280  func nanotime1() int64 {
   281  	var r struct {
   282  		t            int64  // raw timer
   283  		numer, denom uint32 // conversion factors. nanoseconds = t * numer / denom.
   284  	}
   285  	libcCall(unsafe.Pointer(abi.FuncPCABI0(nanotime_trampoline)), unsafe.Pointer(&r))
   286  	// Note: Apple seems unconcerned about overflow here. See
   287  	// https://developer.apple.com/library/content/qa/qa1398/_index.html
   288  	// Note also, numer == denom == 1 is common.
   289  	t := r.t
   290  	if r.numer != 1 {
   291  		t *= int64(r.numer)
   292  	}
   293  	if r.denom != 1 {
   294  		t /= int64(r.denom)
   295  	}
   296  	return t
   297  }
   298  func nanotime_trampoline()
   299  
   300  //go:nosplit
   301  //go:cgo_unsafe_args
   302  func walltime() (int64, int32) {
   303  	var t timespec
   304  	libcCall(unsafe.Pointer(abi.FuncPCABI0(walltime_trampoline)), unsafe.Pointer(&t))
   305  	return t.tv_sec, int32(t.tv_nsec)
   306  }
   307  func walltime_trampoline()
   308  
   309  //go:nosplit
   310  //go:cgo_unsafe_args
   311  func sigaction(sig uint32, new *usigactiont, old *usigactiont) {
   312  	libcCall(unsafe.Pointer(abi.FuncPCABI0(sigaction_trampoline)), unsafe.Pointer(&sig))
   313  	KeepAlive(new)
   314  	KeepAlive(old)
   315  }
   316  func sigaction_trampoline()
   317  
   318  //go:nosplit
   319  //go:cgo_unsafe_args
   320  func sigprocmask(how uint32, new *sigset, old *sigset) {
   321  	libcCall(unsafe.Pointer(abi.FuncPCABI0(sigprocmask_trampoline)), unsafe.Pointer(&how))
   322  	KeepAlive(new)
   323  	KeepAlive(old)
   324  }
   325  func sigprocmask_trampoline()
   326  
   327  //go:nosplit
   328  //go:cgo_unsafe_args
   329  func sigaltstack(new *stackt, old *stackt) {
   330  	if new != nil && new.ss_flags&_SS_DISABLE != 0 && new.ss_size == 0 {
   331  		// Despite the fact that Darwin's sigaltstack man page says it ignores the size
   332  		// when SS_DISABLE is set, it doesn't. sigaltstack returns ENOMEM
   333  		// if we don't give it a reasonable size.
   334  		// ref: http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20140421/214296.html
   335  		new.ss_size = 32768
   336  	}
   337  	libcCall(unsafe.Pointer(abi.FuncPCABI0(sigaltstack_trampoline)), unsafe.Pointer(&new))
   338  	KeepAlive(new)
   339  	KeepAlive(old)
   340  }
   341  func sigaltstack_trampoline()
   342  
   343  //go:nosplit
   344  //go:cgo_unsafe_args
   345  func raiseproc(sig uint32) {
   346  	libcCall(unsafe.Pointer(abi.FuncPCABI0(raiseproc_trampoline)), unsafe.Pointer(&sig))
   347  }
   348  func raiseproc_trampoline()
   349  
   350  //go:nosplit
   351  //go:cgo_unsafe_args
   352  func setitimer(mode int32, new, old *itimerval) {
   353  	libcCall(unsafe.Pointer(abi.FuncPCABI0(setitimer_trampoline)), unsafe.Pointer(&mode))
   354  	KeepAlive(new)
   355  	KeepAlive(old)
   356  }
   357  func setitimer_trampoline()
   358  
   359  //go:nosplit
   360  //go:cgo_unsafe_args
   361  func sysctl(mib *uint32, miblen uint32, oldp *byte, oldlenp *uintptr, newp *byte, newlen uintptr) int32 {
   362  	ret := libcCall(unsafe.Pointer(abi.FuncPCABI0(sysctl_trampoline)), unsafe.Pointer(&mib))
   363  	KeepAlive(mib)
   364  	KeepAlive(oldp)
   365  	KeepAlive(oldlenp)
   366  	KeepAlive(newp)
   367  	return ret
   368  }
   369  func sysctl_trampoline()
   370  
   371  //go:nosplit
   372  //go:cgo_unsafe_args
   373  func sysctlbyname(name *byte, oldp *byte, oldlenp *uintptr, newp *byte, newlen uintptr) int32 {
   374  	ret := libcCall(unsafe.Pointer(abi.FuncPCABI0(sysctlbyname_trampoline)), unsafe.Pointer(&name))
   375  	KeepAlive(name)
   376  	KeepAlive(oldp)
   377  	KeepAlive(oldlenp)
   378  	KeepAlive(newp)
   379  	return ret
   380  }
   381  func sysctlbyname_trampoline()
   382  
   383  //go:nosplit
   384  //go:cgo_unsafe_args
   385  func fcntl(fd, cmd, arg int32) int32 {
   386  	return libcCall(unsafe.Pointer(abi.FuncPCABI0(fcntl_trampoline)), unsafe.Pointer(&fd))
   387  }
   388  func fcntl_trampoline()
   389  
   390  //go:nosplit
   391  //go:cgo_unsafe_args
   392  func kqueue() int32 {
   393  	v := libcCall(unsafe.Pointer(abi.FuncPCABI0(kqueue_trampoline)), nil)
   394  	return v
   395  }
   396  func kqueue_trampoline()
   397  
   398  //go:nosplit
   399  //go:cgo_unsafe_args
   400  func kevent(kq int32, ch *keventt, nch int32, ev *keventt, nev int32, ts *timespec) int32 {
   401  	ret := libcCall(unsafe.Pointer(abi.FuncPCABI0(kevent_trampoline)), unsafe.Pointer(&kq))
   402  	KeepAlive(ch)
   403  	KeepAlive(ev)
   404  	KeepAlive(ts)
   405  	return ret
   406  }
   407  func kevent_trampoline()
   408  
   409  //go:nosplit
   410  //go:cgo_unsafe_args
   411  func pthread_mutex_init(m *pthreadmutex, attr *pthreadmutexattr) int32 {
   412  	ret := libcCall(unsafe.Pointer(abi.FuncPCABI0(pthread_mutex_init_trampoline)), unsafe.Pointer(&m))
   413  	KeepAlive(m)
   414  	KeepAlive(attr)
   415  	return ret
   416  }
   417  func pthread_mutex_init_trampoline()
   418  
   419  //go:nosplit
   420  //go:cgo_unsafe_args
   421  func pthread_mutex_lock(m *pthreadmutex) int32 {
   422  	ret := libcCall(unsafe.Pointer(abi.FuncPCABI0(pthread_mutex_lock_trampoline)), unsafe.Pointer(&m))
   423  	KeepAlive(m)
   424  	return ret
   425  }
   426  func pthread_mutex_lock_trampoline()
   427  
   428  //go:nosplit
   429  //go:cgo_unsafe_args
   430  func pthread_mutex_unlock(m *pthreadmutex) int32 {
   431  	ret := libcCall(unsafe.Pointer(abi.FuncPCABI0(pthread_mutex_unlock_trampoline)), unsafe.Pointer(&m))
   432  	KeepAlive(m)
   433  	return ret
   434  }
   435  func pthread_mutex_unlock_trampoline()
   436  
   437  //go:nosplit
   438  //go:cgo_unsafe_args
   439  func pthread_cond_init(c *pthreadcond, attr *pthreadcondattr) int32 {
   440  	ret := libcCall(unsafe.Pointer(abi.FuncPCABI0(pthread_cond_init_trampoline)), unsafe.Pointer(&c))
   441  	KeepAlive(c)
   442  	KeepAlive(attr)
   443  	return ret
   444  }
   445  func pthread_cond_init_trampoline()
   446  
   447  //go:nosplit
   448  //go:cgo_unsafe_args
   449  func pthread_cond_wait(c *pthreadcond, m *pthreadmutex) int32 {
   450  	ret := libcCall(unsafe.Pointer(abi.FuncPCABI0(pthread_cond_wait_trampoline)), unsafe.Pointer(&c))
   451  	KeepAlive(c)
   452  	KeepAlive(m)
   453  	return ret
   454  }
   455  func pthread_cond_wait_trampoline()
   456  
   457  //go:nosplit
   458  //go:cgo_unsafe_args
   459  func pthread_cond_timedwait_relative_np(c *pthreadcond, m *pthreadmutex, t *timespec) int32 {
   460  	ret := libcCall(unsafe.Pointer(abi.FuncPCABI0(pthread_cond_timedwait_relative_np_trampoline)), unsafe.Pointer(&c))
   461  	KeepAlive(c)
   462  	KeepAlive(m)
   463  	KeepAlive(t)
   464  	return ret
   465  }
   466  func pthread_cond_timedwait_relative_np_trampoline()
   467  
   468  //go:nosplit
   469  //go:cgo_unsafe_args
   470  func pthread_cond_signal(c *pthreadcond) int32 {
   471  	ret := libcCall(unsafe.Pointer(abi.FuncPCABI0(pthread_cond_signal_trampoline)), unsafe.Pointer(&c))
   472  	KeepAlive(c)
   473  	return ret
   474  }
   475  func pthread_cond_signal_trampoline()
   476  
   477  // Not used on Darwin, but must be defined.
   478  func exitThread(wait *atomic.Uint32) {
   479  }
   480  
   481  //go:nosplit
   482  func closeonexec(fd int32) {
   483  	fcntl(fd, _F_SETFD, _FD_CLOEXEC)
   484  }
   485  
   486  //go:nosplit
   487  func setNonblock(fd int32) {
   488  	flags := fcntl(fd, _F_GETFL, 0)
   489  	fcntl(fd, _F_SETFL, flags|_O_NONBLOCK)
   490  }
   491  
   492  // Tell the linker that the libc_* functions are to be found
   493  // in a system library, with the libc_ prefix missing.
   494  
   495  //go:cgo_import_dynamic libc_pthread_attr_init pthread_attr_init "/usr/lib/libSystem.B.dylib"
   496  //go:cgo_import_dynamic libc_pthread_attr_getstacksize pthread_attr_getstacksize "/usr/lib/libSystem.B.dylib"
   497  //go:cgo_import_dynamic libc_pthread_attr_setdetachstate pthread_attr_setdetachstate "/usr/lib/libSystem.B.dylib"
   498  //go:cgo_import_dynamic libc_pthread_create pthread_create "/usr/lib/libSystem.B.dylib"
   499  //go:cgo_import_dynamic libc_pthread_self pthread_self "/usr/lib/libSystem.B.dylib"
   500  //go:cgo_import_dynamic libc_pthread_kill pthread_kill "/usr/lib/libSystem.B.dylib"
   501  //go:cgo_import_dynamic libc_exit _exit "/usr/lib/libSystem.B.dylib"
   502  //go:cgo_import_dynamic libc_raise raise "/usr/lib/libSystem.B.dylib"
   503  
   504  //go:cgo_import_dynamic libc_open open "/usr/lib/libSystem.B.dylib"
   505  //go:cgo_import_dynamic libc_close close "/usr/lib/libSystem.B.dylib"
   506  //go:cgo_import_dynamic libc_read read "/usr/lib/libSystem.B.dylib"
   507  //go:cgo_import_dynamic libc_write write "/usr/lib/libSystem.B.dylib"
   508  //go:cgo_import_dynamic libc_pipe pipe "/usr/lib/libSystem.B.dylib"
   509  
   510  //go:cgo_import_dynamic libc_mmap mmap "/usr/lib/libSystem.B.dylib"
   511  //go:cgo_import_dynamic libc_munmap munmap "/usr/lib/libSystem.B.dylib"
   512  //go:cgo_import_dynamic libc_madvise madvise "/usr/lib/libSystem.B.dylib"
   513  //go:cgo_import_dynamic libc_mlock mlock "/usr/lib/libSystem.B.dylib"
   514  //go:cgo_import_dynamic libc_error __error "/usr/lib/libSystem.B.dylib"
   515  //go:cgo_import_dynamic libc_usleep usleep "/usr/lib/libSystem.B.dylib"
   516  
   517  //go:cgo_import_dynamic libc_mach_timebase_info mach_timebase_info "/usr/lib/libSystem.B.dylib"
   518  //go:cgo_import_dynamic libc_mach_absolute_time mach_absolute_time "/usr/lib/libSystem.B.dylib"
   519  //go:cgo_import_dynamic libc_clock_gettime clock_gettime "/usr/lib/libSystem.B.dylib"
   520  //go:cgo_import_dynamic libc_sigaction sigaction "/usr/lib/libSystem.B.dylib"
   521  //go:cgo_import_dynamic libc_pthread_sigmask pthread_sigmask "/usr/lib/libSystem.B.dylib"
   522  //go:cgo_import_dynamic libc_sigaltstack sigaltstack "/usr/lib/libSystem.B.dylib"
   523  //go:cgo_import_dynamic libc_getpid getpid "/usr/lib/libSystem.B.dylib"
   524  //go:cgo_import_dynamic libc_kill kill "/usr/lib/libSystem.B.dylib"
   525  //go:cgo_import_dynamic libc_setitimer setitimer "/usr/lib/libSystem.B.dylib"
   526  //go:cgo_import_dynamic libc_sysctl sysctl "/usr/lib/libSystem.B.dylib"
   527  //go:cgo_import_dynamic libc_sysctlbyname sysctlbyname "/usr/lib/libSystem.B.dylib"
   528  //go:cgo_import_dynamic libc_fcntl fcntl "/usr/lib/libSystem.B.dylib"
   529  //go:cgo_import_dynamic libc_kqueue kqueue "/usr/lib/libSystem.B.dylib"
   530  //go:cgo_import_dynamic libc_kevent kevent "/usr/lib/libSystem.B.dylib"
   531  
   532  //go:cgo_import_dynamic libc_pthread_mutex_init pthread_mutex_init "/usr/lib/libSystem.B.dylib"
   533  //go:cgo_import_dynamic libc_pthread_mutex_lock pthread_mutex_lock "/usr/lib/libSystem.B.dylib"
   534  //go:cgo_import_dynamic libc_pthread_mutex_unlock pthread_mutex_unlock "/usr/lib/libSystem.B.dylib"
   535  //go:cgo_import_dynamic libc_pthread_cond_init pthread_cond_init "/usr/lib/libSystem.B.dylib"
   536  //go:cgo_import_dynamic libc_pthread_cond_wait pthread_cond_wait "/usr/lib/libSystem.B.dylib"
   537  //go:cgo_import_dynamic libc_pthread_cond_timedwait_relative_np pthread_cond_timedwait_relative_np "/usr/lib/libSystem.B.dylib"
   538  //go:cgo_import_dynamic libc_pthread_cond_signal pthread_cond_signal "/usr/lib/libSystem.B.dylib"
   539  

View as plain text