bump modernc.org/sqlite to v1.35.0-concurrency-workaround (#3797)

This commit is contained in:
kim 2025-02-14 16:54:10 +00:00 committed by GitHub
commit ebbdeee0bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
114 changed files with 891873 additions and 192475 deletions

71
vendor/modernc.org/libc/libc_musl.go generated vendored
View file

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build linux && (amd64 || arm64 || loong64)
//go:build linux && (amd64 || arm64 || loong64 || ppc64le || s390x || riscv64 || 386 || arm)
//go:generate go run generator.go
@ -119,7 +119,7 @@ import (
"strings"
"sync"
"sync/atomic"
"syscall"
"time"
"unsafe"
guuid "github.com/google/uuid"
@ -157,6 +157,7 @@ func init() {
Xprogram_invocation_name = mustCString(nm)
Xprogram_invocation_short_name = mustCString(filepath.Base(nm))
X__libc.Fpage_size = Tsize_t(os.Getpagesize())
}
// RawMem64 represents the biggest uint64 array the runtime can handle.
@ -414,7 +415,7 @@ func (tls *TLS) Free(n int) {
select {
case sig := <-tls.pendingSignals:
signum := int32(sig.(syscall.Signal))
signum := int32(sig.(unix.Signal))
h, ok := tls.sigHandlers[signum]
if !ok {
break
@ -517,7 +518,7 @@ var abort Tsigaction
func Xabort(tls *TLS) {
X__libc_sigaction(tls, SIGABRT, uintptr(unsafe.Pointer(&abort)), 0)
unix.Kill(unix.Getpid(), syscall.Signal(SIGABRT))
unix.Kill(unix.Getpid(), unix.Signal(SIGABRT))
panic(todo("unrechable"))
}
@ -639,16 +640,56 @@ func ___synccall(tls *TLS, fn, ctx uintptr) {
(*(*func(*TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{fn})))(tls, ctx)
}
// func ___randname(tls *TLS, template uintptr) (r1 uintptr) {
// bp := tls.Alloc(16)
// defer tls.Free(16)
// var i int32
// var r uint64
// var _ /* ts at bp+0 */ Ttimespec
// X__clock_gettime(tls, CLOCK_REALTIME, bp)
// goto _2
// _2:
// r = uint64((*(*Ttimespec)(unsafe.Pointer(bp))).Ftv_sec+(*(*Ttimespec)(unsafe.Pointer(bp))).Ftv_nsec) + uint64(tls.ID)*uint64(65537)
// i = 0
// for {
// if !(i < int32(6)) {
// break
// }
// *(*int8)(unsafe.Pointer(template + uintptr(i))) = int8(uint64('A') + r&uint64(15) + r&uint64(16)*uint64(2))
// goto _3
// _3:
// i++
// r >>= uint64(5)
// }
// return template
// }
// #include <time.h>
// #include <stdint.h>
// #include "pthread_impl.h"
//
// /* This assumes that a check for the
//
// template size has already been made */
//
// char *__randname(char *template)
//
// {
// int i;
// struct timespec ts;
// unsigned long r;
//
// __clock_gettime(CLOCK_REALTIME, &ts);
// r = ts.tv_sec + ts.tv_nsec + __pthread_self()->tid * 65537UL;
// for (i=0; i<6; i++, r>>=5)
// template[i] = 'A'+(r&15)+(r&16)*2;
//
// return template;
// }
func ___randname(tls *TLS, template uintptr) (r1 uintptr) {
bp := tls.Alloc(16)
defer tls.Free(16)
var i int32
var r uint64
var _ /* ts at bp+0 */ Ttimespec
X__clock_gettime(tls, CLOCK_REALTIME, bp)
goto _2
_2:
r = uint64((*(*Ttimespec)(unsafe.Pointer(bp))).Ftv_sec+(*(*Ttimespec)(unsafe.Pointer(bp))).Ftv_nsec) + uint64(tls.ID)*uint64(65537)
ts := time.Now().UnixNano()
r := uint64(ts) + uint64(tls.ID)*65537
i = 0
for {
if !(i < int32(6)) {
@ -682,15 +723,15 @@ func Xsignal(tls *TLS, signum int32, handler uintptr) (r uintptr) {
r, tls.sigHandlers[signum] = tls.sigHandlers[signum], handler
switch handler {
case SIG_DFL:
gosignal.Reset(syscall.Signal(signum))
gosignal.Reset(unix.Signal(signum))
case SIG_IGN:
gosignal.Ignore(syscall.Signal(signum))
gosignal.Ignore(unix.Signal(signum))
default:
if tls.pendingSignals == nil {
tls.pendingSignals = make(chan os.Signal, 3)
tls.checkSignals = true
}
gosignal.Notify(tls.pendingSignals, syscall.Signal(signum))
gosignal.Notify(tls.pendingSignals, unix.Signal(signum))
}
return r
}