Source file src/runtime/cgo/cgo_openbsd.go

     1  // Copyright 2026 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 goexperiment.runtimecgopurego && !msan && !tsan && openbsd
     6  
     7  package cgo
     8  
     9  const (
    10  	_SIG_SETMASK             = 3
    11  	_EAGAIN                  = 35
    12  	_PTHREAD_CREATE_DETACHED = 1
    13  )
    14  
    15  //go:cgo_ldflag "-lpthread"
    16  
    17  // Some of these functions are also imported by the runtime under libc_*
    18  // names (see runtime/sys_openbsd.go). The runtime/cgo imports use separate
    19  // _cgo_libc_* symbols to avoid colliding with the runtime's libc_* symbols,
    20  // so the dynamic symbol table may contain two undefined entries for one
    21  // function.
    22  // This is valid ELF, as each relocation names its own entry.
    23  
    24  //go:cgo_import_dynamic _ _ "libc.so"
    25  //go:cgo_import_dynamic _ _ "libpthread.so"
    26  //go:cgo_import_dynamic _cgo_libc_setenv setenv "libc.so"
    27  //go:cgo_import_dynamic _cgo_libc_unsetenv unsetenv "libc.so"
    28  //go:cgo_import_dynamic _cgo_libc_sigfillset sigfillset "libc.so"
    29  //go:cgo_import_dynamic _cgo_libc_pthread_create pthread_create "libpthread.so"
    30  //go:cgo_import_dynamic _cgo_libc_pthread_attr_init pthread_attr_init "libpthread.so"
    31  //go:cgo_import_dynamic _cgo_libc_pthread_attr_setdetachstate pthread_attr_setdetachstate "libpthread.so"
    32  //go:cgo_import_dynamic _cgo_libc_pthread_attr_getstacksize pthread_attr_getstacksize "libpthread.so"
    33  //go:cgo_import_dynamic _cgo_libc_pthread_attr_destroy pthread_attr_destroy "libpthread.so"
    34  //go:cgo_import_dynamic _cgo_libc_pthread_key_create pthread_key_create "libpthread.so"
    35  //go:cgo_import_dynamic _cgo_libc_pthread_setspecific pthread_setspecific "libpthread.so"
    36  //go:cgo_import_dynamic _cgo_libc_pthread_sigmask pthread_sigmask "libpthread.so"
    37  

View as plain text