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