Black Lives Matter. Support the Equal Justice Initiative.

Source file src/runtime/sys_openbsd.go

Documentation: runtime

     1  // Copyright 2020 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 openbsd && !mips64
     6  // +build openbsd,!mips64
     7  
     8  package runtime
     9  
    10  import "unsafe"
    11  
    12  // The *_trampoline functions convert from the Go calling convention to the C calling convention
    13  // and then call the underlying libc function. These are defined in sys_openbsd_$ARCH.s.
    14  
    15  //go:nosplit
    16  //go:cgo_unsafe_args
    17  func pthread_attr_init(attr *pthreadattr) int32 {
    18  	return libcCall(unsafe.Pointer(funcPC(pthread_attr_init_trampoline)), unsafe.Pointer(&attr))
    19  }
    20  func pthread_attr_init_trampoline()
    21  
    22  //go:nosplit
    23  //go:cgo_unsafe_args
    24  func pthread_attr_destroy(attr *pthreadattr) int32 {
    25  	return libcCall(unsafe.Pointer(funcPC(pthread_attr_destroy_trampoline)), unsafe.Pointer(&attr))
    26  }
    27  func pthread_attr_destroy_trampoline()
    28  
    29  //go:nosplit
    30  //go:cgo_unsafe_args
    31  func pthread_attr_getstacksize(attr *pthreadattr, size *uintptr) int32 {
    32  	return libcCall(unsafe.Pointer(funcPC(pthread_attr_getstacksize_trampoline)), unsafe.Pointer(&attr))
    33  }
    34  func pthread_attr_getstacksize_trampoline()
    35  
    36  //go:nosplit
    37  //go:cgo_unsafe_args
    38  func pthread_attr_setdetachstate(attr *pthreadattr, state int) int32 {
    39  	return libcCall(unsafe.Pointer(funcPC(pthread_attr_setdetachstate_trampoline)), unsafe.Pointer(&attr))
    40  }
    41  func pthread_attr_setdetachstate_trampoline()
    42  
    43  //go:nosplit
    44  //go:cgo_unsafe_args
    45  func pthread_create(attr *pthreadattr, start uintptr, arg unsafe.Pointer) int32 {
    46  	return libcCall(unsafe.Pointer(funcPC(pthread_create_trampoline)), unsafe.Pointer(&attr))
    47  }
    48  func pthread_create_trampoline()
    49  
    50  // Tell the linker that the libc_* functions are to be found
    51  // in a system library, with the libc_ prefix missing.
    52  
    53  //go:cgo_import_dynamic libc_pthread_attr_init pthread_attr_init "libpthread.so"
    54  //go:cgo_import_dynamic libc_pthread_attr_destroy pthread_attr_destroy "libpthread.so"
    55  //go:cgo_import_dynamic libc_pthread_attr_getstacksize pthread_attr_getstacksize "libpthread.so"
    56  //go:cgo_import_dynamic libc_pthread_attr_setdetachstate pthread_attr_setdetachstate "libpthread.so"
    57  //go:cgo_import_dynamic libc_pthread_create pthread_create "libpthread.so"
    58  //go:cgo_import_dynamic libc_pthread_sigmask pthread_sigmask "libpthread.so"
    59  
    60  //go:cgo_import_dynamic _ _ "libpthread.so"
    61  //go:cgo_import_dynamic _ _ "libc.so"
    62  

View as plain text