mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-21 08:45:50 +03:00
update modernc/sqlite to v1.33.1 (with our concurrency workaround) (#3367)
This commit is contained in:
parent
6f3583559f
commit
3f9a1dbfff
70 changed files with 622427 additions and 148036 deletions
4
go.mod
4
go.mod
|
@ -2,7 +2,7 @@ module github.com/superseriousbusiness/gotosocial
|
|||
|
||||
go 1.22.2
|
||||
|
||||
replace modernc.org/sqlite => gitlab.com/NyaaaWhatsUpDoc/sqlite v1.29.9-concurrency-workaround
|
||||
replace modernc.org/sqlite => gitlab.com/NyaaaWhatsUpDoc/sqlite v1.33.1-concurrency-workaround
|
||||
|
||||
require (
|
||||
codeberg.org/gruf/go-bytes v1.0.2
|
||||
|
@ -222,7 +222,7 @@ require (
|
|||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 // indirect
|
||||
modernc.org/libc v1.49.3 // indirect
|
||||
modernc.org/libc v1.55.3 // indirect
|
||||
modernc.org/mathutil v1.6.0 // indirect
|
||||
modernc.org/memory v1.8.0 // indirect
|
||||
modernc.org/strutil v1.2.0 // indirect
|
||||
|
|
16
go.sum
16
go.sum
|
@ -623,8 +623,8 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
|
|||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
github.com/yuin/goldmark v1.7.4 h1:BDXOHExt+A7gwPCJgPIIq7ENvceR7we7rOS9TNoLZeg=
|
||||
github.com/yuin/goldmark v1.7.4/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
|
||||
gitlab.com/NyaaaWhatsUpDoc/sqlite v1.29.9-concurrency-workaround h1:gFAlklid3jyXIuZBy5Vy0dhG+F6YBgosRy4syT5CDsg=
|
||||
gitlab.com/NyaaaWhatsUpDoc/sqlite v1.29.9-concurrency-workaround/go.mod h1:ItX2a1OVGgNsFh6Dv60JQvGfJfTPHPVpV6DF59akYOA=
|
||||
gitlab.com/NyaaaWhatsUpDoc/sqlite v1.33.1-concurrency-workaround h1:pFMJnlc1PuH+jcVz4vz53vcpnoZG+NqFBr3qikDmEB4=
|
||||
gitlab.com/NyaaaWhatsUpDoc/sqlite v1.33.1-concurrency-workaround/go.mod h1:pXV2xHxhzXZsgT/RtTFAPY6JJDEvOTcTdwADQCCWD4k=
|
||||
go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80=
|
||||
go.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
|
@ -977,18 +977,18 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
|
|||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
modernc.org/cc/v4 v4.20.0 h1:45Or8mQfbUqJOG9WaxvlFYOAQO0lQ5RvqBcFCXngjxk=
|
||||
modernc.org/cc/v4 v4.20.0/go.mod h1:HM7VJTZbUCR3rV8EYBi9wxnJ0ZBRiGE5OeGXNA0IsLQ=
|
||||
modernc.org/ccgo/v4 v4.16.0 h1:ofwORa6vx2FMm0916/CkZjpFPSR70VwTjUCe2Eg5BnA=
|
||||
modernc.org/ccgo/v4 v4.16.0/go.mod h1:dkNyWIjFrVIZ68DTo36vHK+6/ShBn4ysU61So6PIqCI=
|
||||
modernc.org/cc/v4 v4.21.4 h1:3Be/Rdo1fpr8GrQ7IVw9OHtplU4gWbb+wNgeoBMmGLQ=
|
||||
modernc.org/cc/v4 v4.21.4/go.mod h1:HM7VJTZbUCR3rV8EYBi9wxnJ0ZBRiGE5OeGXNA0IsLQ=
|
||||
modernc.org/ccgo/v4 v4.19.2 h1:lwQZgvboKD0jBwdaeVCTouxhxAyN6iawF3STraAal8Y=
|
||||
modernc.org/ccgo/v4 v4.19.2/go.mod h1:ysS3mxiMV38XGRTTcgo0DQTeTmAO4oCmJl1nX9VFI3s=
|
||||
modernc.org/fileutil v1.3.0 h1:gQ5SIzK3H9kdfai/5x41oQiKValumqNTDXMvKo62HvE=
|
||||
modernc.org/fileutil v1.3.0/go.mod h1:XatxS8fZi3pS8/hKG2GH/ArUogfxjpEKs3Ku3aK4JyQ=
|
||||
modernc.org/gc/v2 v2.4.1 h1:9cNzOqPyMJBvrUipmynX0ZohMhcxPtMccYgGOJdOiBw=
|
||||
modernc.org/gc/v2 v2.4.1/go.mod h1:wzN5dK1AzVGoH6XOzc3YZ+ey/jPgYHLuVckd62P0GYU=
|
||||
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 h1:5D53IMaUuA5InSeMu9eJtlQXS2NxAhyWQvkKEgXZhHI=
|
||||
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6/go.mod h1:Qz0X07sNOR1jWYCrJMEnbW/X55x206Q7Vt4mz6/wHp4=
|
||||
modernc.org/libc v1.49.3 h1:j2MRCRdwJI2ls/sGbeSk0t2bypOG/uvPZUsGQFDulqg=
|
||||
modernc.org/libc v1.49.3/go.mod h1:yMZuGkn7pXbKfoT/M35gFJOAEdSKdxL0q64sF7KqCDo=
|
||||
modernc.org/libc v1.55.3 h1:AzcW1mhlPNrRtjS5sS+eW2ISCgSOLLNyFzRh/V3Qj/U=
|
||||
modernc.org/libc v1.55.3/go.mod h1:qFXepLhz+JjFThQ4kzwzOjA/y/artDeg+pcYnY+Q83w=
|
||||
modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4=
|
||||
modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo=
|
||||
modernc.org/memory v1.8.0 h1:IqGTL6eFMaDZZhEWwcREgeMXYwmW83LYW8cROZYkg+E=
|
||||
|
|
2
vendor/modernc.org/libc/AUTHORS
generated
vendored
2
vendor/modernc.org/libc/AUTHORS
generated
vendored
|
@ -10,9 +10,11 @@
|
|||
|
||||
Dan Kortschak <dan@kortschak.io>
|
||||
Dan Peterson <danp@danp.net>
|
||||
Fabrice Colliot <f.colliot@gmail.com>
|
||||
Jan Mercl <0xjnml@gmail.com>
|
||||
Jason DeBettencourt <jasond17@gmail.com>
|
||||
Koichi Shiraishi <zchee.io@gmail.com>
|
||||
Marius Orcsik <marius@federated.id>
|
||||
Patricio Whittingslow <graded.sp@gmail.com>
|
||||
Scot C Bontrager <scot@indievisible.org>
|
||||
Steffen Butzer <steffen(dot)butzer@outlook.com>
|
||||
|
|
4
vendor/modernc.org/libc/CONTRIBUTORS
generated
vendored
4
vendor/modernc.org/libc/CONTRIBUTORS
generated
vendored
|
@ -8,11 +8,15 @@
|
|||
|
||||
Dan Kortschak <dan@kortschak.io>
|
||||
Dan Peterson <danp@danp.net>
|
||||
Bjørn Wiegell <bj.wiegell@gmail.com>
|
||||
Fabrice Colliot <f.colliot@gmail.com>
|
||||
Jaap Aarts <jaap.aarts1@gmail.com>
|
||||
Jan Mercl <0xjnml@gmail.com>
|
||||
Jason DeBettencourt <jasond17@gmail.com>
|
||||
Koichi Shiraishi <zchee.io@gmail.com>
|
||||
Marius Orcsik <marius@federated.id>
|
||||
Patricio Whittingslow <graded.sp@gmail.com>
|
||||
Scot C Bontrager <scot@indievisible.org>
|
||||
Steffen Butzer <steffen(dot)butzer@outlook.com>
|
||||
W. Michael Petullo <mike@flyn.org>
|
||||
ZHU Zijia <piggynl@outlook.com>
|
||||
|
|
2
vendor/modernc.org/libc/Makefile
generated
vendored
2
vendor/modernc.org/libc/Makefile
generated
vendored
|
@ -33,7 +33,7 @@ download:
|
|||
|
||||
edit:
|
||||
@touch log
|
||||
@if [ -f "Session.vim" ]; then novim -S & else novim -p Makefile all_musl_test.go generator.go libc.go libc_musl.go & fi
|
||||
@if [ -f "Session.vim" ]; then novim -S & else novim -p Makefile go.mod builder.json & fi
|
||||
|
||||
editor:
|
||||
gofmt -l -s -w *.go 2>&1 | tee log-editor
|
||||
|
|
2
vendor/modernc.org/libc/aliases.go
generated
vendored
2
vendor/modernc.org/libc/aliases.go
generated
vendored
|
@ -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 || loong64)
|
||||
//go:build linux && (amd64 || arm64 || loong64)
|
||||
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
|
|
12
vendor/modernc.org/libc/atomic.go
generated
vendored
12
vendor/modernc.org/libc/atomic.go
generated
vendored
|
@ -2,13 +2,13 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux && (amd64 || loong64)
|
||||
//go:build linux && (amd64 || arm64 || loong64)
|
||||
|
||||
package libc // import "modernc.org/libc/v2"
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
import (
|
||||
"math"
|
||||
"math/bits"
|
||||
mbits "math/bits"
|
||||
"sync/atomic"
|
||||
"unsafe"
|
||||
)
|
||||
|
@ -41,15 +41,15 @@ func a_store_16(addr uintptr, val uint16) {
|
|||
// static inline int a_ctz_l(unsigned long x)
|
||||
func _a_ctz_l(tls *TLS, x ulong) int32 {
|
||||
if unsafe.Sizeof(x) == 8 {
|
||||
return int32(bits.TrailingZeros64(x))
|
||||
return int32(mbits.TrailingZeros64(x))
|
||||
}
|
||||
|
||||
return int32(bits.TrailingZeros32(uint32(x)))
|
||||
return int32(mbits.TrailingZeros32(uint32(x)))
|
||||
}
|
||||
|
||||
// static inline int a_ctz_64(uint64_t x)
|
||||
func _a_ctz_64(tls *TLS, x uint64) int32 {
|
||||
return int32(bits.TrailingZeros64(x))
|
||||
return int32(mbits.TrailingZeros64(x))
|
||||
}
|
||||
|
||||
func AtomicAddFloat32(addr *float32, delta float32) (new float32) {
|
||||
|
|
10
vendor/modernc.org/libc/builder.json
generated
vendored
10
vendor/modernc.org/libc/builder.json
generated
vendored
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"autogen": "linux/(amd64|loong64)",
|
||||
"autoupdate": "",
|
||||
"autotag": "darwin/(amd64|arm64)|freebsd/(amd64|arm64)|linux/(386|amd64|arm|arm64|loong64|ppc64le|riscv64|s390x)|openbsd/(386|amd64|arm64)|windows/(amd64|arm64)",
|
||||
"autogen": "linux/(amd64|arm64|loong64)",
|
||||
"autoupdate": "linux/amd64",
|
||||
"autotag": "darwin/(amd64|arm64)|freebsd/(amd64|arm64)|linux/(386|amd64|arm|arm64|loong64|ppc64le|riscv64|s390x)|openbsd/(386|amd64|arm64)|windows/(amd64|arm64|386)",
|
||||
"download": [
|
||||
{"re": "linux/(amd64|loong64)", "files": ["https://git.musl-libc.org/cgit/musl/snapshot/musl-7ada6dde6f9dc6a2836c3d92c2f762d35fd229e0.tar.gz"]}
|
||||
{"re": "linux/(amd64|arm64|loong64)", "files": ["https://git.musl-libc.org/cgit/musl/snapshot/musl-7ada6dde6f9dc6a2836c3d92c2f762d35fd229e0.tar.gz"]}
|
||||
],
|
||||
"test": "darwin/(amd64|arm64)|freebsd/(amd64|arm64)|linux/(386|amd64|arm|arm64|loong64|ppc64le|riscv64|s390x)|openbsd/(386|amd64|arm64)|windows/(amd64|arm64)"
|
||||
"test": "darwin/(amd64|arm64)|freebsd/(amd64|arm64)|linux/(386|amd64|arm|arm64|loong64|ppc64le|riscv64|s390x)|openbsd/(386|amd64|arm64)|windows/(amd64|arm64|386)"
|
||||
}
|
||||
|
|
6
vendor/modernc.org/libc/builtin.go
generated
vendored
6
vendor/modernc.org/libc/builtin.go
generated
vendored
|
@ -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 || loong64)
|
||||
//go:build linux && (amd64 || arm64 || loong64)
|
||||
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
|
@ -32,6 +32,10 @@ func X__builtin_round(tls *TLS, x float64) (r float64) {
|
|||
return Xround(tls, x)
|
||||
}
|
||||
|
||||
func X__builtin_roundf(tls *TLS, x float32) (r float32) {
|
||||
return Xroundf(tls, x)
|
||||
}
|
||||
|
||||
func X__builtin_expect(t *TLS, exp, c long) long {
|
||||
return exp
|
||||
}
|
||||
|
|
2
vendor/modernc.org/libc/ccgo.go
generated
vendored
2
vendor/modernc.org/libc/ccgo.go
generated
vendored
|
@ -1,6 +1,6 @@
|
|||
// Code generated by 'go generate' - DO NOT EDIT.
|
||||
|
||||
//go:build !(linux && (amd64 || loong64))
|
||||
//go:build !(linux && (amd64 || arm64 || loong64))
|
||||
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
|
|
3680
vendor/modernc.org/libc/ccgo_linux_amd64.go
generated
vendored
3680
vendor/modernc.org/libc/ccgo_linux_amd64.go
generated
vendored
File diff suppressed because one or more lines are too long
154129
vendor/modernc.org/libc/ccgo_linux_arm64.go
generated
vendored
Normal file
154129
vendor/modernc.org/libc/ccgo_linux_arm64.go
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1426
vendor/modernc.org/libc/ccgo_linux_loong64.go
generated
vendored
1426
vendor/modernc.org/libc/ccgo_linux_loong64.go
generated
vendored
File diff suppressed because one or more lines are too long
2
vendor/modernc.org/libc/etc.go
generated
vendored
2
vendor/modernc.org/libc/etc.go
generated
vendored
|
@ -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 || loong64))
|
||||
//go:build !(linux && (amd64 || arm64 || loong64))
|
||||
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
|
|
4
vendor/modernc.org/libc/etc_musl.go
generated
vendored
4
vendor/modernc.org/libc/etc_musl.go
generated
vendored
|
@ -2,9 +2,9 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux && (amd64 || loong64)
|
||||
//go:build linux && (amd64 || arm64 || loong64)
|
||||
|
||||
package libc // import "modernc.org/libc"
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
|
2
vendor/modernc.org/libc/ioutil_linux.go
generated
vendored
2
vendor/modernc.org/libc/ioutil_linux.go
generated
vendored
|
@ -6,7 +6,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 || loong64))
|
||||
//go:build !(linux && (amd64 || arm64 || loong64))
|
||||
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
|
|
295
vendor/modernc.org/libc/libc.go
generated
vendored
295
vendor/modernc.org/libc/libc.go
generated
vendored
|
@ -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 || loong64))
|
||||
//go:build !(linux && (amd64 || arm64 || loong64))
|
||||
|
||||
//go.generate echo package libc > ccgo.go
|
||||
//go:generate go fmt ./...
|
||||
|
@ -1002,6 +1002,13 @@ func Xacos(t *TLS, x float64) float64 {
|
|||
return math.Acos(x)
|
||||
}
|
||||
|
||||
func Xacosf(t *TLS, x float32) float32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
}
|
||||
return float32(math.Acos(float64(x)))
|
||||
}
|
||||
|
||||
func Xacosh(t *TLS, x float64) float64 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
|
@ -1009,6 +1016,13 @@ func Xacosh(t *TLS, x float64) float64 {
|
|||
return math.Acosh(x)
|
||||
}
|
||||
|
||||
func Xacoshf(t *TLS, x float32) float32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
}
|
||||
return float32(math.Acosh(float64(x)))
|
||||
}
|
||||
|
||||
func Xasin(t *TLS, x float64) float64 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
|
@ -1016,6 +1030,13 @@ func Xasin(t *TLS, x float64) float64 {
|
|||
return math.Asin(x)
|
||||
}
|
||||
|
||||
func Xasinf(t *TLS, x float32) float32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
}
|
||||
return float32(math.Asin(float64(x)))
|
||||
}
|
||||
|
||||
func Xasinh(t *TLS, x float64) float64 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
|
@ -1023,6 +1044,13 @@ func Xasinh(t *TLS, x float64) float64 {
|
|||
return math.Asinh(x)
|
||||
}
|
||||
|
||||
func Xasinhf(t *TLS, x float32) float32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
}
|
||||
return float32(math.Asinh(float64(x)))
|
||||
}
|
||||
|
||||
func Xatan(t *TLS, x float64) float64 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
|
@ -1030,6 +1058,13 @@ func Xatan(t *TLS, x float64) float64 {
|
|||
return math.Atan(x)
|
||||
}
|
||||
|
||||
func Xatanf(t *TLS, x float32) float32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
}
|
||||
return float32(math.Atan(float64(x)))
|
||||
}
|
||||
|
||||
func Xatan2(t *TLS, x, y float64) float64 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v y=%v, (%v:)", t, y, origin(2))
|
||||
|
@ -1037,6 +1072,13 @@ func Xatan2(t *TLS, x, y float64) float64 {
|
|||
return math.Atan2(x, y)
|
||||
}
|
||||
|
||||
func Xatan2f(t *TLS, x, y float32) float32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v y=%v, (%v:)", t, y, origin(2))
|
||||
}
|
||||
return float32(math.Atan2(float64(x), float64(y)))
|
||||
}
|
||||
|
||||
func Xatanh(t *TLS, x float64) float64 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
|
@ -1044,6 +1086,13 @@ func Xatanh(t *TLS, x float64) float64 {
|
|||
return math.Atanh(x)
|
||||
}
|
||||
|
||||
func Xatanhf(t *TLS, x float32) float32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
}
|
||||
return float32(math.Atanh(float64(x)))
|
||||
}
|
||||
|
||||
func Xceil(t *TLS, x float64) float64 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
|
@ -1093,6 +1142,13 @@ func Xcosh(t *TLS, x float64) float64 {
|
|||
return math.Cosh(x)
|
||||
}
|
||||
|
||||
func Xcoshf(t *TLS, x float32) float32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
}
|
||||
return float32(math.Cosh(float64(x)))
|
||||
}
|
||||
|
||||
func Xexp(t *TLS, x float64) float64 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
|
@ -1100,6 +1156,13 @@ func Xexp(t *TLS, x float64) float64 {
|
|||
return math.Exp(x)
|
||||
}
|
||||
|
||||
func Xexpf(t *TLS, x float32) float32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
}
|
||||
return float32(math.Exp(float64(x)))
|
||||
}
|
||||
|
||||
func Xfabs(t *TLS, x float64) float64 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
|
@ -1121,6 +1184,13 @@ func Xfloor(t *TLS, x float64) float64 {
|
|||
return math.Floor(x)
|
||||
}
|
||||
|
||||
func Xfloorf(t *TLS, x float32) float32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
}
|
||||
return float32(math.Floor(float64(x)))
|
||||
}
|
||||
|
||||
func Xfmod(t *TLS, x, y float64) float64 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v y=%v, (%v:)", t, y, origin(2))
|
||||
|
@ -1128,6 +1198,17 @@ func Xfmod(t *TLS, x, y float64) float64 {
|
|||
return math.Mod(x, y)
|
||||
}
|
||||
|
||||
func Xfmodf(t *TLS, x, y float32) float32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v y=%v, (%v:)", t, y, origin(2))
|
||||
}
|
||||
return float32(math.Mod(float64(x), float64(y)))
|
||||
}
|
||||
|
||||
func X__builtin_hypot(t *TLS, x float64, y float64) (r float64) {
|
||||
return Xhypot(t, x, y)
|
||||
}
|
||||
|
||||
func Xhypot(t *TLS, x, y float64) float64 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v y=%v, (%v:)", t, y, origin(2))
|
||||
|
@ -1135,6 +1216,13 @@ func Xhypot(t *TLS, x, y float64) float64 {
|
|||
return math.Hypot(x, y)
|
||||
}
|
||||
|
||||
func Xhypotf(t *TLS, x, y float32) float32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v y=%v, (%v:)", t, y, origin(2))
|
||||
}
|
||||
return float32(math.Hypot(float64(x), float64(y)))
|
||||
}
|
||||
|
||||
func Xisnan(t *TLS, x float64) int32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
|
@ -1170,6 +1258,13 @@ func Xlog(t *TLS, x float64) float64 {
|
|||
return math.Log(x)
|
||||
}
|
||||
|
||||
func Xlogf(t *TLS, x float32) float32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
}
|
||||
return float32(math.Log(float64(x)))
|
||||
}
|
||||
|
||||
func Xlog10(t *TLS, x float64) float64 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
|
@ -1177,6 +1272,13 @@ func Xlog10(t *TLS, x float64) float64 {
|
|||
return math.Log10(x)
|
||||
}
|
||||
|
||||
func Xlog10f(t *TLS, x float32) float32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
}
|
||||
return float32(math.Log10(float64(x)))
|
||||
}
|
||||
|
||||
func X__builtin_log2(t *TLS, x float64) float64 {
|
||||
return Xlog2(t, x)
|
||||
}
|
||||
|
@ -1188,6 +1290,13 @@ func Xlog2(t *TLS, x float64) float64 {
|
|||
return math.Log2(x)
|
||||
}
|
||||
|
||||
func Xlog2f(t *TLS, x float32) float32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
}
|
||||
return float32(math.Log2(float64(x)))
|
||||
}
|
||||
|
||||
func Xround(t *TLS, x float64) float64 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
|
@ -1195,6 +1304,13 @@ func Xround(t *TLS, x float64) float64 {
|
|||
return math.Round(x)
|
||||
}
|
||||
|
||||
func Xroundf(t *TLS, x float32) float32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
}
|
||||
return float32(math.Round(float64(x)))
|
||||
}
|
||||
|
||||
func X__builtin_round(t *TLS, x float64) float64 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
|
@ -1202,6 +1318,13 @@ func X__builtin_round(t *TLS, x float64) float64 {
|
|||
return math.Round(x)
|
||||
}
|
||||
|
||||
func X__builtin_roundf(t *TLS, x float32) float32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
}
|
||||
return float32(math.Round(float64(x)))
|
||||
}
|
||||
|
||||
func Xsin(t *TLS, x float64) float64 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
|
@ -1223,6 +1346,13 @@ func Xsinh(t *TLS, x float64) float64 {
|
|||
return math.Sinh(x)
|
||||
}
|
||||
|
||||
func Xsinhf(t *TLS, x float32) float32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
}
|
||||
return float32(math.Sinh(float64(x)))
|
||||
}
|
||||
|
||||
func Xsqrt(t *TLS, x float64) float64 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
|
@ -1230,6 +1360,13 @@ func Xsqrt(t *TLS, x float64) float64 {
|
|||
return math.Sqrt(x)
|
||||
}
|
||||
|
||||
func Xsqrtf(t *TLS, x float32) float32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
}
|
||||
return float32(math.Sqrt(float64(x)))
|
||||
}
|
||||
|
||||
func Xtan(t *TLS, x float64) float64 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
|
@ -1237,6 +1374,13 @@ func Xtan(t *TLS, x float64) float64 {
|
|||
return math.Tan(x)
|
||||
}
|
||||
|
||||
func Xtanf(t *TLS, x float32) float32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
}
|
||||
return float32(math.Tan(float64(x)))
|
||||
}
|
||||
|
||||
func Xtanh(t *TLS, x float64) float64 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
|
@ -1244,6 +1388,13 @@ func Xtanh(t *TLS, x float64) float64 {
|
|||
return math.Tanh(x)
|
||||
}
|
||||
|
||||
func Xtanhf(t *TLS, x float32) float32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
}
|
||||
return float32(math.Tanh(float64(x)))
|
||||
}
|
||||
|
||||
func Xtrunc(t *TLS, x float64) float64 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
|
@ -1251,6 +1402,13 @@ func Xtrunc(t *TLS, x float64) float64 {
|
|||
return math.Trunc(x)
|
||||
}
|
||||
|
||||
func Xtruncf(t *TLS, x float32) float32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v, (%v:)", t, x, origin(2))
|
||||
}
|
||||
return float32(math.Trunc(float64(x)))
|
||||
}
|
||||
|
||||
var nextRand = uint64(1)
|
||||
|
||||
// int rand(void);
|
||||
|
@ -1273,6 +1431,13 @@ func Xpow(t *TLS, x, y float64) float64 {
|
|||
return r
|
||||
}
|
||||
|
||||
func Xpowf(t *TLS, x, y float32) float32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v y=%v, (%v:)", t, y, origin(2))
|
||||
}
|
||||
return float32(math.Pow(float64(x), float64(y)))
|
||||
}
|
||||
|
||||
func Xfrexp(t *TLS, x float64, exp uintptr) float64 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v exp=%v, (%v:)", t, x, exp, origin(2))
|
||||
|
@ -1282,6 +1447,15 @@ func Xfrexp(t *TLS, x float64, exp uintptr) float64 {
|
|||
return f
|
||||
}
|
||||
|
||||
func Xfrexpf(t *TLS, x float32, exp uintptr) float32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v exp=%v, (%v:)", t, x, exp, origin(2))
|
||||
}
|
||||
f, e := math.Frexp(float64(x))
|
||||
*(*int32)(unsafe.Pointer(exp)) = int32(e)
|
||||
return float32(f)
|
||||
}
|
||||
|
||||
func Xmodf(t *TLS, x float64, iptr uintptr) float64 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v iptr=%v, (%v:)", t, x, iptr, origin(2))
|
||||
|
@ -1291,6 +1465,15 @@ func Xmodf(t *TLS, x float64, iptr uintptr) float64 {
|
|||
return f
|
||||
}
|
||||
|
||||
func Xmodff(t *TLS, x float32, iptr uintptr) float32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v x=%v iptr=%v, (%v:)", t, x, iptr, origin(2))
|
||||
}
|
||||
i, f := math.Modf(float64(x))
|
||||
*(*float32)(unsafe.Pointer(iptr)) = float32(i)
|
||||
return float32(f)
|
||||
}
|
||||
|
||||
// char *strncpy(char *dest, const char *src, size_t n)
|
||||
func Xstrncpy(t *TLS, dest, src uintptr, n types.Size_t) (r uintptr) {
|
||||
if __ccgo_strace {
|
||||
|
@ -1465,39 +1648,91 @@ func Xstrrchr(t *TLS, s uintptr, c int32) (r uintptr) {
|
|||
}
|
||||
|
||||
// void *memset(void *s, int c, size_t n)
|
||||
func Xmemset(t *TLS, s uintptr, c int32, n types.Size_t) uintptr {
|
||||
func Xmemset(t *TLS, dest uintptr, c int32, n types.Size_t) uintptr {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v s=%v c=%v n=%v, (%v:)", t, s, c, n, origin(2))
|
||||
trc("t=%v s=%v c=%v n=%v, (%v:)", t, dest, c, n, origin(2))
|
||||
}
|
||||
if n != 0 {
|
||||
c := byte(c & 0xff)
|
||||
var c8 uint8
|
||||
var c32 uint32
|
||||
var c64 uint64
|
||||
var k types.Size_t
|
||||
var s uintptr
|
||||
|
||||
// This will make sure that on platforms where they are not equally aligned we
|
||||
// clear out the first few bytes until allignment
|
||||
bytesBeforeAllignment := s % unsafe.Alignof(uint64(0))
|
||||
if bytesBeforeAllignment > uintptr(n) {
|
||||
bytesBeforeAllignment = uintptr(n)
|
||||
}
|
||||
b := (*RawMem)(unsafe.Pointer(s))[:bytesBeforeAllignment:bytesBeforeAllignment]
|
||||
n -= types.Size_t(bytesBeforeAllignment)
|
||||
for i := range b {
|
||||
b[i] = c
|
||||
}
|
||||
if n >= 8 {
|
||||
i64 := uint64(c) + uint64(c)<<8 + uint64(c)<<16 + uint64(c)<<24 + uint64(c)<<32 + uint64(c)<<40 + uint64(c)<<48 + uint64(c)<<56
|
||||
b8 := (*RawMem64)(unsafe.Pointer(s + bytesBeforeAllignment))[: n/8 : n/8]
|
||||
for i := range b8 {
|
||||
b8[i] = i64
|
||||
}
|
||||
}
|
||||
if n%8 != 0 {
|
||||
b = (*RawMem)(unsafe.Pointer(s + bytesBeforeAllignment + uintptr(n-n%8)))[: n%8 : n%8]
|
||||
for i := range b {
|
||||
b[i] = c
|
||||
}
|
||||
}
|
||||
s = dest
|
||||
/* Fill head and tail with minimal branching. Each
|
||||
* conditional ensures that all the subsequently used
|
||||
* offsets are well-defined and in the dest region. */
|
||||
if n == 0 {
|
||||
return dest
|
||||
}
|
||||
return s
|
||||
c8 = uint8(c)
|
||||
*(*uint8)(unsafe.Pointer(s)) = c8
|
||||
*(*uint8)(unsafe.Pointer(s + uintptr(n-1))) = c8
|
||||
if n <= types.Size_t(2) {
|
||||
return dest
|
||||
}
|
||||
*(*uint8)(unsafe.Pointer(s + 1)) = c8
|
||||
*(*uint8)(unsafe.Pointer(s + 2)) = c8
|
||||
*(*uint8)(unsafe.Pointer(s + uintptr(n-2))) = c8
|
||||
*(*uint8)(unsafe.Pointer(s + uintptr(n-3))) = c8
|
||||
if n <= types.Size_t(6) {
|
||||
return dest
|
||||
}
|
||||
*(*uint8)(unsafe.Pointer(s + 3)) = c8
|
||||
*(*uint8)(unsafe.Pointer(s + uintptr(n-4))) = c8
|
||||
if n <= types.Size_t(8) {
|
||||
return dest
|
||||
}
|
||||
/* Advance pointer to align it at a 4-byte boundary,
|
||||
* and truncate n to a multiple of 4. The previous code
|
||||
* already took care of any head/tail that get cut off
|
||||
* by the alignment. */
|
||||
k = -types.Size_t(s) & types.Size_t(3)
|
||||
s += uintptr(k)
|
||||
n -= k
|
||||
n &= types.Size_t(-Int32FromInt32(4))
|
||||
c32 = uint32(0x01010101) * uint32(c8)
|
||||
/* In preparation to copy 32 bytes at a time, aligned on
|
||||
* an 8-byte bounary, fill head/tail up to 28 bytes each.
|
||||
* As in the initial byte-based head/tail fill, each
|
||||
* conditional below ensures that the subsequent offsets
|
||||
* are valid (e.g. !(n<=24) implies n>=28). */
|
||||
*(*uint32)(unsafe.Pointer(s + uintptr(0))) = c32
|
||||
*(*uint32)(unsafe.Pointer(s + uintptr(n-4))) = c32
|
||||
if n <= types.Size_t(8) {
|
||||
return dest
|
||||
}
|
||||
c64 = uint64(c32) | (uint64(c32) << 32)
|
||||
*(*uint64)(unsafe.Pointer(s + uintptr(4))) = c64
|
||||
*(*uint64)(unsafe.Pointer(s + uintptr(n-12))) = c64
|
||||
if n <= types.Size_t(24) {
|
||||
return dest
|
||||
}
|
||||
*(*uint64)(unsafe.Pointer(s + uintptr(12))) = c64
|
||||
*(*uint64)(unsafe.Pointer(s + uintptr(20))) = c64
|
||||
*(*uint64)(unsafe.Pointer(s + uintptr(n-28))) = c64
|
||||
*(*uint64)(unsafe.Pointer(s + uintptr(n-20))) = c64
|
||||
/* Align to a multiple of 8 so we can fill 64 bits at a time,
|
||||
* and avoid writing the same bytes twice as much as is
|
||||
* practical without introducing additional branching. */
|
||||
k = types.Size_t(24) + types.Size_t(s)&types.Size_t(4)
|
||||
s += uintptr(k)
|
||||
n -= k
|
||||
/* If this loop is reached, 28 tail bytes have already been
|
||||
* filled, so any remainder when n drops below 32 can be
|
||||
* safely ignored. */
|
||||
for {
|
||||
if !(n >= types.Size_t(32)) {
|
||||
break
|
||||
}
|
||||
*(*uint64)(unsafe.Pointer(s + uintptr(0))) = c64
|
||||
*(*uint64)(unsafe.Pointer(s + uintptr(8))) = c64
|
||||
*(*uint64)(unsafe.Pointer(s + uintptr(16))) = c64
|
||||
*(*uint64)(unsafe.Pointer(s + uintptr(24))) = c64
|
||||
n -= types.Size_t(32)
|
||||
s += uintptr(32)
|
||||
}
|
||||
return dest
|
||||
}
|
||||
|
||||
// void *memcpy(void *dest, const void *src, size_t n);
|
||||
|
|
2
vendor/modernc.org/libc/libc64.go
generated
vendored
2
vendor/modernc.org/libc/libc64.go
generated
vendored
|
@ -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 ((amd64 || loong64) && !linux) || arm64 || ppc64le || riscv64 || s390x || mips64le
|
||||
//go:build ((amd64 || arm64 || loong64) && !linux) || ppc64le || riscv64 || s390x || mips64le
|
||||
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
|
|
2
vendor/modernc.org/libc/libc_arm64.go
generated
vendored
2
vendor/modernc.org/libc/libc_arm64.go
generated
vendored
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build !(linux && arm64)
|
||||
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
import (
|
||||
|
|
16
vendor/modernc.org/libc/libc_darwin.go
generated
vendored
16
vendor/modernc.org/libc/libc_darwin.go
generated
vendored
|
@ -55,6 +55,10 @@ type (
|
|||
ulong = types.User_ulong_t
|
||||
)
|
||||
|
||||
type pthreadAttr struct {
|
||||
detachState int32
|
||||
}
|
||||
|
||||
// // Keep these outside of the var block otherwise go generate will miss them.
|
||||
var X__stderrp = Xstdout
|
||||
var X__stdinp = Xstdin
|
||||
|
@ -452,9 +456,11 @@ func Xsysconf(t *TLS, name int32) long {
|
|||
return long(unix.Getpagesize())
|
||||
case unistd.X_SC_NPROCESSORS_ONLN:
|
||||
return long(runtime.NumCPU())
|
||||
case unistd.X_SC_GETPW_R_SIZE_MAX:
|
||||
return 128
|
||||
}
|
||||
|
||||
panic(todo(""))
|
||||
panic(todo("", name))
|
||||
}
|
||||
|
||||
// int close(int fd);
|
||||
|
@ -2158,7 +2164,7 @@ func X__ccgo_pthreadAttrGetDetachState(tls *TLS, a uintptr) int32 {
|
|||
if __ccgo_strace {
|
||||
trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
|
||||
}
|
||||
panic(todo(""))
|
||||
return (*pthreadAttr)(unsafe.Pointer(a)).detachState
|
||||
}
|
||||
|
||||
func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 {
|
||||
|
@ -2498,3 +2504,9 @@ func Xsetrlimit(t *TLS, resource int32, rlim uintptr) int32 {
|
|||
|
||||
return 0
|
||||
}
|
||||
|
||||
func X__fpclassifyd(tls *TLS, x float64) (r int32) {
|
||||
return X__fpclassify(tls, x)
|
||||
}
|
||||
|
||||
var Xin6addr_any = in6_addr{}
|
||||
|
|
2
vendor/modernc.org/libc/libc_linux.go
generated
vendored
2
vendor/modernc.org/libc/libc_linux.go
generated
vendored
|
@ -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 || loong64))
|
||||
//go:build !(linux && (amd64 || arm64 || loong64))
|
||||
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
|
|
729
vendor/modernc.org/libc/libc_linux_arm64.go
generated
vendored
729
vendor/modernc.org/libc/libc_linux_arm64.go
generated
vendored
|
@ -1,729 +0,0 @@
|
|||
// Copyright 2020 The Libc Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
gotime "time"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
"modernc.org/libc/errno"
|
||||
"modernc.org/libc/fcntl"
|
||||
"modernc.org/libc/signal"
|
||||
"modernc.org/libc/stdio"
|
||||
"modernc.org/libc/sys/stat"
|
||||
"modernc.org/libc/sys/types"
|
||||
"modernc.org/libc/time"
|
||||
)
|
||||
|
||||
var (
|
||||
startTime = gotime.Now() // For clock(3)
|
||||
)
|
||||
|
||||
// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
|
||||
func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2))
|
||||
}
|
||||
// musl/src/internal/ksigaction.h
|
||||
//
|
||||
// struct k_sigaction {
|
||||
// void (*handler)(int);
|
||||
// unsigned long flags;
|
||||
// void (*restorer)(void);
|
||||
// unsigned mask[2];
|
||||
// };
|
||||
type k_sigaction struct {
|
||||
handler uintptr
|
||||
flags ulong
|
||||
restorer uintptr
|
||||
mask [2]uint32
|
||||
}
|
||||
|
||||
var kact, koldact uintptr
|
||||
if act != 0 {
|
||||
sz := int(unsafe.Sizeof(k_sigaction{}))
|
||||
kact = t.Alloc(sz)
|
||||
defer t.Free(sz)
|
||||
*(*k_sigaction)(unsafe.Pointer(kact)) = k_sigaction{
|
||||
handler: (*signal.Sigaction)(unsafe.Pointer(act)).F__sigaction_handler.Fsa_handler,
|
||||
flags: ulong((*signal.Sigaction)(unsafe.Pointer(act)).Fsa_flags),
|
||||
restorer: (*signal.Sigaction)(unsafe.Pointer(act)).Fsa_restorer,
|
||||
}
|
||||
Xmemcpy(t, kact+unsafe.Offsetof(k_sigaction{}.mask), act+unsafe.Offsetof(signal.Sigaction{}.Fsa_mask), types.Size_t(unsafe.Sizeof(k_sigaction{}.mask)))
|
||||
}
|
||||
if oldact != 0 {
|
||||
panic(todo(""))
|
||||
}
|
||||
|
||||
if _, _, err := unix.Syscall6(unix.SYS_RT_SIGACTION, uintptr(signum), kact, koldact, unsafe.Sizeof(k_sigaction{}.mask), 0, 0); err != 0 {
|
||||
t.setErrno(err)
|
||||
return -1
|
||||
}
|
||||
|
||||
if oldact != 0 {
|
||||
panic(todo(""))
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
// int lstat(const char *pathname, struct stat *statbuf);
|
||||
func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
|
||||
}
|
||||
if err := unix.Lstat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
|
||||
if dmesgs {
|
||||
dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
|
||||
}
|
||||
t.setErrno(err)
|
||||
return -1
|
||||
}
|
||||
|
||||
if dmesgs {
|
||||
dmesg("%v: %q: ok", origin(1), GoString(pathname))
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// int stat(const char *pathname, struct stat *statbuf);
|
||||
func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
|
||||
}
|
||||
if err := unix.Fstatat(unix.AT_FDCWD, GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf)), 0); err != nil {
|
||||
if dmesgs {
|
||||
dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
|
||||
}
|
||||
t.setErrno(err)
|
||||
return -1
|
||||
}
|
||||
|
||||
if dmesgs {
|
||||
dmesg("%v: %q: ok", origin(1), GoString(pathname))
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// int unlink(const char *pathname);
|
||||
func Xunlink(t *TLS, pathname uintptr) int32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
|
||||
}
|
||||
if err := unix.Unlinkat(unix.AT_FDCWD, GoString(pathname), 0); err != nil {
|
||||
t.setErrno(err)
|
||||
return -1
|
||||
}
|
||||
|
||||
if dmesgs {
|
||||
dmesg("%v: %q: ok", origin(1), GoString(pathname))
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// int access(const char *pathname, int mode);
|
||||
func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
|
||||
}
|
||||
if err := unix.Faccessat(unix.AT_FDCWD, GoString(pathname), uint32(mode), 0); err != nil {
|
||||
if dmesgs {
|
||||
dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
|
||||
}
|
||||
t.setErrno(err)
|
||||
return -1
|
||||
}
|
||||
|
||||
if dmesgs {
|
||||
dmesg("%v: %q %#o: ok", origin(1), GoString(pathname), mode)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// off64_t lseek64(int fd, off64_t offset, int whence);
|
||||
func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
|
||||
}
|
||||
n, _, err := unix.Syscall(unix.SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence))
|
||||
if err != 0 {
|
||||
if dmesgs {
|
||||
dmesg("%v: fd %v, off %#x, whence %v: %v", origin(1), fd, offset, whenceStr(whence), err)
|
||||
}
|
||||
t.setErrno(err)
|
||||
return -1
|
||||
}
|
||||
|
||||
if dmesgs {
|
||||
dmesg("%v: fd %v, off %#x, whence %v: %#x", origin(1), fd, offset, whenceStr(whence), n)
|
||||
}
|
||||
return types.Off_t(n)
|
||||
}
|
||||
|
||||
// int fstat(int fd, struct stat *statbuf);
|
||||
func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
|
||||
}
|
||||
if _, _, err := unix.Syscall(unix.SYS_FSTAT, uintptr(fd), statbuf, 0); err != 0 {
|
||||
if dmesgs {
|
||||
dmesg("%v: fd %d: %v", origin(1), fd, err)
|
||||
}
|
||||
t.setErrno(err)
|
||||
return -1
|
||||
}
|
||||
|
||||
if dmesgs {
|
||||
dmesg("%v: %d size %#x: ok\n%+v", origin(1), fd, (*stat.Stat)(unsafe.Pointer(statbuf)).Fst_size, (*stat.Stat)(unsafe.Pointer(statbuf)))
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// int ftruncate(int fd, off_t length);
|
||||
func Xftruncate64(t *TLS, fd int32, length types.Off_t) int32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v fd=%v length=%v, (%v:)", t, fd, length, origin(2))
|
||||
}
|
||||
if _, _, err := unix.Syscall(unix.SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0); err != 0 {
|
||||
if dmesgs {
|
||||
dmesg("%v: fd %d: %v", origin(1), fd, err)
|
||||
}
|
||||
t.setErrno(err)
|
||||
return -1
|
||||
}
|
||||
|
||||
if dmesgs {
|
||||
dmesg("%v: %d %#x: ok", origin(1), fd, length)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// int fcntl(int fd, int cmd, ... /* arg */ );
|
||||
func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
|
||||
}
|
||||
var arg uintptr
|
||||
if args != 0 {
|
||||
arg = *(*uintptr)(unsafe.Pointer(args))
|
||||
}
|
||||
if cmd == fcntl.F_SETFL {
|
||||
arg |= unix.O_LARGEFILE
|
||||
}
|
||||
n, _, err := unix.Syscall(unix.SYS_FCNTL, uintptr(fd), uintptr(cmd), arg)
|
||||
if err != 0 {
|
||||
if dmesgs {
|
||||
dmesg("%v: fd %v cmd %v", origin(1), fcntlCmdStr(fd), cmd)
|
||||
}
|
||||
t.setErrno(err)
|
||||
return -1
|
||||
}
|
||||
|
||||
if dmesgs {
|
||||
dmesg("%v: %d %s %#x: %d", origin(1), fd, fcntlCmdStr(cmd), arg, n)
|
||||
}
|
||||
return int32(n)
|
||||
}
|
||||
|
||||
// int rmdir(const char *pathname);
|
||||
func Xrmdir(t *TLS, pathname uintptr) int32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
|
||||
}
|
||||
if err := unix.Rmdir(GoString(pathname)); err != nil {
|
||||
t.setErrno(err)
|
||||
return -1
|
||||
}
|
||||
|
||||
if dmesgs {
|
||||
dmesg("%v: %q: ok", origin(1), GoString(pathname))
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// int rename(const char *oldpath, const char *newpath);
|
||||
func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
|
||||
}
|
||||
if err := unix.Rename(GoString(oldpath), GoString(newpath)); err != nil {
|
||||
t.setErrno(err)
|
||||
return -1
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
// int mknod(const char *pathname, mode_t mode, dev_t dev);
|
||||
func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2))
|
||||
}
|
||||
panic(todo(""))
|
||||
}
|
||||
|
||||
// int chown(const char *pathname, uid_t owner, gid_t group);
|
||||
func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v pathname=%v owner=%v group=%v, (%v:)", t, pathname, owner, group, origin(2))
|
||||
}
|
||||
if err := unix.Chown(GoString(pathname), int(owner), int(group)); err != nil {
|
||||
t.setErrno(err)
|
||||
return -1
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
// int link(const char *oldpath, const char *newpath);
|
||||
func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
|
||||
}
|
||||
panic(todo(""))
|
||||
}
|
||||
|
||||
// int pipe(int pipefd[2]);
|
||||
func Xpipe(t *TLS, pipefd uintptr) int32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v pipefd=%v, (%v:)", t, pipefd, origin(2))
|
||||
}
|
||||
if _, _, err := unix.Syscall(unix.SYS_PIPE2, pipefd, 0, 0); err != 0 {
|
||||
t.setErrno(err)
|
||||
return -1
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
// int dup2(int oldfd, int newfd);
|
||||
func Xdup2(t *TLS, oldfd, newfd int32) int32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2))
|
||||
}
|
||||
panic(todo(""))
|
||||
}
|
||||
|
||||
// int getrlimit(int resource, struct rlimit *rlim);
|
||||
func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
|
||||
}
|
||||
if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
|
||||
t.setErrno(err)
|
||||
return -1
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize);
|
||||
func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2))
|
||||
}
|
||||
n, err := unix.Readlink(GoString(path), GoBytes(buf, int(bufsize)))
|
||||
if err != nil {
|
||||
t.setErrno(err)
|
||||
return -1
|
||||
}
|
||||
|
||||
return types.Ssize_t(n)
|
||||
}
|
||||
|
||||
// FILE *fopen64(const char *pathname, const char *mode);
|
||||
func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
|
||||
}
|
||||
m := strings.ReplaceAll(GoString(mode), "b", "")
|
||||
var flags int
|
||||
switch m {
|
||||
case "r":
|
||||
flags = os.O_RDONLY
|
||||
case "r+":
|
||||
flags = os.O_RDWR
|
||||
case "w":
|
||||
flags = os.O_WRONLY | os.O_CREATE | os.O_TRUNC
|
||||
case "w+":
|
||||
flags = os.O_RDWR | os.O_CREATE | os.O_TRUNC
|
||||
case "a":
|
||||
flags = os.O_WRONLY | os.O_CREATE | os.O_APPEND
|
||||
case "a+":
|
||||
flags = os.O_RDWR | os.O_CREATE | os.O_APPEND
|
||||
default:
|
||||
panic(m)
|
||||
}
|
||||
//TODO- flags |= fcntl.O_LARGEFILE
|
||||
fd, err := unix.Openat(unix.AT_FDCWD, GoString(pathname), flags, 0666)
|
||||
if err != nil {
|
||||
t.setErrno(err)
|
||||
return 0
|
||||
}
|
||||
|
||||
if p := newFile(t, int32(fd)); p != 0 {
|
||||
return p
|
||||
}
|
||||
|
||||
Xclose(t, int32(fd))
|
||||
t.setErrno(errno.ENOMEM)
|
||||
return 0
|
||||
}
|
||||
|
||||
// int mkdir(const char *path, mode_t mode);
|
||||
func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2))
|
||||
}
|
||||
if err := unix.Mkdir(GoString(path), uint32(mode)); err != nil {
|
||||
t.setErrno(err)
|
||||
return -1
|
||||
}
|
||||
|
||||
if dmesgs {
|
||||
dmesg("%v: %q: ok", origin(1), GoString(path))
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// void *mremap(void *old_address, size_t old_size, size_t new_size, int flags, ... /* void *new_address */);
|
||||
func Xmremap(t *TLS, old_address uintptr, old_size, new_size types.Size_t, flags int32, args uintptr) uintptr {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v old_address=%v new_size=%v flags=%v args=%v, (%v:)", t, old_address, new_size, flags, args, origin(2))
|
||||
}
|
||||
var arg uintptr
|
||||
if args != 0 {
|
||||
arg = *(*uintptr)(unsafe.Pointer(args))
|
||||
}
|
||||
data, _, err := unix.Syscall6(unix.SYS_MREMAP, old_address, uintptr(old_size), uintptr(new_size), uintptr(flags), arg, 0)
|
||||
if err != 0 {
|
||||
if dmesgs {
|
||||
dmesg("%v: %v", origin(1), err)
|
||||
}
|
||||
t.setErrno(err)
|
||||
return ^uintptr(0) // (void*)-1
|
||||
}
|
||||
|
||||
if dmesgs {
|
||||
dmesg("%v: %#x", origin(1), data)
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
|
||||
}
|
||||
return Xmmap64(t, addr, length, prot, flags, fd, offset)
|
||||
}
|
||||
|
||||
// void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
|
||||
func Xmmap64(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
|
||||
}
|
||||
data, _, err := unix.Syscall6(unix.SYS_MMAP, addr, uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset))
|
||||
if err != 0 {
|
||||
if dmesgs {
|
||||
dmesg("%v: %v", origin(1), err)
|
||||
}
|
||||
t.setErrno(err)
|
||||
return ^uintptr(0) // (void*)-1
|
||||
}
|
||||
|
||||
if dmesgs {
|
||||
dmesg("%v: %#x", origin(1), data)
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
// int symlink(const char *target, const char *linkpath);
|
||||
func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2))
|
||||
}
|
||||
if err := unix.Symlink(GoString(target), GoString(linkpath)); err != nil {
|
||||
t.setErrno(err)
|
||||
return -1
|
||||
}
|
||||
|
||||
if dmesgs {
|
||||
dmesg("%v: %q %q: ok", origin(1), GoString(target), GoString(linkpath))
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// int chmod(const char *pathname, mode_t mode)
|
||||
func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
|
||||
}
|
||||
if err := unix.Chmod(GoString(pathname), uint32(mode)); err != nil {
|
||||
t.setErrno(err)
|
||||
return -1
|
||||
}
|
||||
|
||||
if dmesgs {
|
||||
dmesg("%v: %q %#o: ok", origin(1), GoString(pathname), mode)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// time_t time(time_t *tloc);
|
||||
func Xtime(t *TLS, tloc uintptr) types.Time_t {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2))
|
||||
}
|
||||
n := gotime.Now().UTC().Unix()
|
||||
if tloc != 0 {
|
||||
*(*types.Time_t)(unsafe.Pointer(tloc)) = types.Time_t(n)
|
||||
}
|
||||
return types.Time_t(n)
|
||||
}
|
||||
|
||||
// int utimes(const char *filename, const struct timeval times[2]);
|
||||
func Xutimes(t *TLS, filename, times uintptr) int32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v times=%v, (%v:)", t, times, origin(2))
|
||||
}
|
||||
var tv []unix.Timeval
|
||||
if times != 0 {
|
||||
tv = make([]unix.Timeval, 2)
|
||||
*(*[2]unix.Timeval)(unsafe.Pointer(&tv[0])) = *(*[2]unix.Timeval)(unsafe.Pointer(times))
|
||||
}
|
||||
if err := unix.Utimes(GoString(filename), tv); err != nil {
|
||||
t.setErrno(err)
|
||||
return -1
|
||||
}
|
||||
|
||||
if times != 0 {
|
||||
*(*[2]unix.Timeval)(unsafe.Pointer(times)) = *(*[2]unix.Timeval)(unsafe.Pointer(&tv[0]))
|
||||
}
|
||||
if dmesgs {
|
||||
dmesg("%v: %q: ok", origin(1), GoString(filename))
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// int utime(const char *filename, const struct utimbuf *times);
|
||||
func Xutime(t *TLS, filename, times uintptr) int32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v times=%v, (%v:)", t, times, origin(2))
|
||||
}
|
||||
if times == 0 {
|
||||
return Xutimes(t, filename, 0)
|
||||
}
|
||||
|
||||
if err := unix.Utime(GoString(filename), (*unix.Utimbuf)(unsafe.Pointer(times))); err != nil {
|
||||
t.setErrno(err)
|
||||
return -1
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
// unsigned int alarm(unsigned int seconds);
|
||||
func Xalarm(t *TLS, seconds uint32) uint32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2))
|
||||
}
|
||||
panic(todo(""))
|
||||
}
|
||||
|
||||
// int setrlimit(int resource, const struct rlimit *rlim);
|
||||
func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
|
||||
}
|
||||
if _, _, err := unix.Syscall(unix.SYS_SETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
|
||||
t.setErrno(err)
|
||||
return -1
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
func AtomicLoadNUint8(ptr uintptr, memorder int32) uint8 {
|
||||
return byte(a_load_8(ptr))
|
||||
}
|
||||
|
||||
var _table1 = [384]int32{
|
||||
129: int32(1),
|
||||
130: int32(2),
|
||||
131: int32(3),
|
||||
132: int32(4),
|
||||
133: int32(5),
|
||||
134: int32(6),
|
||||
135: int32(7),
|
||||
136: int32(8),
|
||||
137: int32(9),
|
||||
138: int32(10),
|
||||
139: int32(11),
|
||||
140: int32(12),
|
||||
141: int32(13),
|
||||
142: int32(14),
|
||||
143: int32(15),
|
||||
144: int32(16),
|
||||
145: int32(17),
|
||||
146: int32(18),
|
||||
147: int32(19),
|
||||
148: int32(20),
|
||||
149: int32(21),
|
||||
150: int32(22),
|
||||
151: int32(23),
|
||||
152: int32(24),
|
||||
153: int32(25),
|
||||
154: int32(26),
|
||||
155: int32(27),
|
||||
156: int32(28),
|
||||
157: int32(29),
|
||||
158: int32(30),
|
||||
159: int32(31),
|
||||
160: int32(32),
|
||||
161: int32(33),
|
||||
162: int32(34),
|
||||
163: int32(35),
|
||||
164: int32(36),
|
||||
165: int32(37),
|
||||
166: int32(38),
|
||||
167: int32(39),
|
||||
168: int32(40),
|
||||
169: int32(41),
|
||||
170: int32(42),
|
||||
171: int32(43),
|
||||
172: int32(44),
|
||||
173: int32(45),
|
||||
174: int32(46),
|
||||
175: int32(47),
|
||||
176: int32(48),
|
||||
177: int32(49),
|
||||
178: int32(50),
|
||||
179: int32(51),
|
||||
180: int32(52),
|
||||
181: int32(53),
|
||||
182: int32(54),
|
||||
183: int32(55),
|
||||
184: int32(56),
|
||||
185: int32(57),
|
||||
186: int32(58),
|
||||
187: int32(59),
|
||||
188: int32(60),
|
||||
189: int32(61),
|
||||
190: int32(62),
|
||||
191: int32(63),
|
||||
192: int32(64),
|
||||
193: int32('a'),
|
||||
194: int32('b'),
|
||||
195: int32('c'),
|
||||
196: int32('d'),
|
||||
197: int32('e'),
|
||||
198: int32('f'),
|
||||
199: int32('g'),
|
||||
200: int32('h'),
|
||||
201: int32('i'),
|
||||
202: int32('j'),
|
||||
203: int32('k'),
|
||||
204: int32('l'),
|
||||
205: int32('m'),
|
||||
206: int32('n'),
|
||||
207: int32('o'),
|
||||
208: int32('p'),
|
||||
209: int32('q'),
|
||||
210: int32('r'),
|
||||
211: int32('s'),
|
||||
212: int32('t'),
|
||||
213: int32('u'),
|
||||
214: int32('v'),
|
||||
215: int32('w'),
|
||||
216: int32('x'),
|
||||
217: int32('y'),
|
||||
218: int32('z'),
|
||||
219: int32(91),
|
||||
220: int32(92),
|
||||
221: int32(93),
|
||||
222: int32(94),
|
||||
223: int32(95),
|
||||
224: int32(96),
|
||||
225: int32('a'),
|
||||
226: int32('b'),
|
||||
227: int32('c'),
|
||||
228: int32('d'),
|
||||
229: int32('e'),
|
||||
230: int32('f'),
|
||||
231: int32('g'),
|
||||
232: int32('h'),
|
||||
233: int32('i'),
|
||||
234: int32('j'),
|
||||
235: int32('k'),
|
||||
236: int32('l'),
|
||||
237: int32('m'),
|
||||
238: int32('n'),
|
||||
239: int32('o'),
|
||||
240: int32('p'),
|
||||
241: int32('q'),
|
||||
242: int32('r'),
|
||||
243: int32('s'),
|
||||
244: int32('t'),
|
||||
245: int32('u'),
|
||||
246: int32('v'),
|
||||
247: int32('w'),
|
||||
248: int32('x'),
|
||||
249: int32('y'),
|
||||
250: int32('z'),
|
||||
251: int32(123),
|
||||
252: int32(124),
|
||||
253: int32(125),
|
||||
254: int32(126),
|
||||
255: int32(127),
|
||||
}
|
||||
|
||||
var _ptable1 = uintptr(unsafe.Pointer(&_table1)) + uintptr(128)*4
|
||||
|
||||
func X__ctype_tolower_loc(tls *TLS) (r uintptr) {
|
||||
if __ccgo_strace {
|
||||
trc("tls=%v, (%v:)", tls, origin(2))
|
||||
defer func() { trc("-> %v", r) }()
|
||||
}
|
||||
return uintptr(unsafe.Pointer(&_ptable1))
|
||||
}
|
||||
|
||||
type Tin6_addr = struct {
|
||||
F__in6_union struct {
|
||||
F__s6_addr16 [0][8]uint16
|
||||
F__s6_addr32 [0][4]uint32
|
||||
F__s6_addr [16]uint8
|
||||
}
|
||||
}
|
||||
|
||||
var Xin6addr_any = Tin6_addr{}
|
||||
|
||||
func Xrewinddir(tls *TLS, f uintptr) {
|
||||
if __ccgo_strace {
|
||||
trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
|
||||
}
|
||||
Xfseek(tls, f, 0, stdio.SEEK_SET)
|
||||
}
|
||||
|
||||
// clock_t clock(void);
|
||||
func Xclock(t *TLS) time.Clock_t {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v, (%v:)", t, origin(2))
|
||||
}
|
||||
return time.Clock_t(gotime.Since(startTime) * gotime.Duration(time.CLOCKS_PER_SEC) / gotime.Second)
|
||||
}
|
||||
|
||||
const __NFDBITS = 64
|
||||
|
||||
func X__fdelt_chk(tls *TLS, d int64) (r int64) {
|
||||
if __ccgo_strace {
|
||||
trc("tls=%v d=%v, (%v:)", tls, d, origin(2))
|
||||
defer func() { trc("-> %v", r) }()
|
||||
}
|
||||
|
||||
return d / __NFDBITS
|
||||
}
|
87
vendor/modernc.org/libc/libc_musl.go
generated
vendored
87
vendor/modernc.org/libc/libc_musl.go
generated
vendored
|
@ -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 || loong64)
|
||||
//go:build linux && (amd64 || arm64 || loong64)
|
||||
|
||||
//go:generate go run generator.go
|
||||
|
||||
|
@ -122,7 +122,9 @@ import (
|
|||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
guuid "github.com/google/uuid"
|
||||
"golang.org/x/sys/unix"
|
||||
"modernc.org/libc/uuid/uuid"
|
||||
"modernc.org/memory"
|
||||
)
|
||||
|
||||
|
@ -276,15 +278,18 @@ type TLS struct {
|
|||
allocaStack []int
|
||||
allocas []uintptr
|
||||
jumpBuffers []uintptr
|
||||
pendingSignals chan os.Signal
|
||||
pthread uintptr // *t__pthread
|
||||
pthreadCleanupItems []pthreadCleanupItem
|
||||
pthreadKeyValues map[Tpthread_key_t]uintptr
|
||||
sigHandlers map[int32]uintptr
|
||||
sp int
|
||||
stack []tlsStackSlot
|
||||
|
||||
ID int32
|
||||
|
||||
ownsPthread bool
|
||||
checkSignals bool
|
||||
ownsPthread bool
|
||||
}
|
||||
|
||||
var __ccgo_environOnce sync.Once
|
||||
|
@ -309,6 +314,7 @@ func NewTLS() (r *TLS) {
|
|||
ID: id,
|
||||
ownsPthread: true,
|
||||
pthread: pthread,
|
||||
sigHandlers: map[int32]uintptr{},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -402,6 +408,29 @@ func (tls *TLS) Alloc(n0 int) (r uintptr) {
|
|||
func (tls *TLS) Free(n int) {
|
||||
//TODO shrink stacks if possible. Tcl is currently against.
|
||||
tls.sp--
|
||||
if !tls.checkSignals {
|
||||
return
|
||||
}
|
||||
|
||||
select {
|
||||
case sig := <-tls.pendingSignals:
|
||||
signum := int32(sig.(syscall.Signal))
|
||||
h, ok := tls.sigHandlers[signum]
|
||||
if !ok {
|
||||
break
|
||||
}
|
||||
|
||||
switch h {
|
||||
case SIG_DFL:
|
||||
// nop
|
||||
case SIG_IGN:
|
||||
// nop
|
||||
default:
|
||||
(*(*func(*TLS, int32))(unsafe.Pointer(&struct{ uintptr }{h})))(tls, signum)
|
||||
}
|
||||
default:
|
||||
// nop
|
||||
}
|
||||
}
|
||||
|
||||
func (tls *TLS) alloca(n Tsize_t) (r uintptr) {
|
||||
|
@ -473,6 +502,10 @@ func Xexit(tls *TLS, code int32) {
|
|||
for _, v := range atExit {
|
||||
v()
|
||||
}
|
||||
atExitHandlersMu.Lock()
|
||||
for _, v := range atExitHandlers {
|
||||
(*(*func(*TLS))(unsafe.Pointer(&struct{ uintptr }{v})))(tls)
|
||||
}
|
||||
os.Exit(int(code))
|
||||
}
|
||||
|
||||
|
@ -645,24 +678,33 @@ func Xfork(t *TLS) int32 {
|
|||
const SIG_DFL = 0
|
||||
const SIG_IGN = 1
|
||||
|
||||
var sigHandlers = map[int32]uintptr{}
|
||||
|
||||
func Xsignal(tls *TLS, signum int32, handler uintptr) (r uintptr) {
|
||||
r, sigHandlers[signum] = sigHandlers[signum], handler
|
||||
sigHandlers[signum] = handler
|
||||
r, tls.sigHandlers[signum] = tls.sigHandlers[signum], handler
|
||||
switch handler {
|
||||
case SIG_DFL:
|
||||
gosignal.Reset(syscall.Signal(signum))
|
||||
case SIG_IGN:
|
||||
gosignal.Ignore(syscall.Signal(signum))
|
||||
default:
|
||||
panic(todo(""))
|
||||
if tls.pendingSignals == nil {
|
||||
tls.pendingSignals = make(chan os.Signal, 3)
|
||||
tls.checkSignals = true
|
||||
}
|
||||
gosignal.Notify(tls.pendingSignals, syscall.Signal(signum))
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
var (
|
||||
atExitHandlersMu sync.Mutex
|
||||
atExitHandlers []uintptr
|
||||
)
|
||||
|
||||
func Xatexit(tls *TLS, func_ uintptr) (r int32) {
|
||||
return -1
|
||||
atExitHandlersMu.Lock()
|
||||
atExitHandlers = append(atExitHandlers, func_)
|
||||
atExitHandlersMu.Unlock()
|
||||
return 0
|
||||
}
|
||||
|
||||
var __sync_synchronize_dummy int32
|
||||
|
@ -1012,22 +1054,43 @@ func Xsysctlbyname(t *TLS, name, oldp, oldlenp, newp uintptr, newlen Tsize_t) in
|
|||
|
||||
// void uuid_copy(uuid_t dst, uuid_t src);
|
||||
func Xuuid_copy(t *TLS, dst, src uintptr) {
|
||||
panic(todo(""))
|
||||
if __ccgo_strace {
|
||||
trc("t=%v src=%v, (%v:)", t, src, origin(2))
|
||||
}
|
||||
*(*uuid.Uuid_t)(unsafe.Pointer(dst)) = *(*uuid.Uuid_t)(unsafe.Pointer(src))
|
||||
}
|
||||
|
||||
// int uuid_parse( char *in, uuid_t uu);
|
||||
func Xuuid_parse(t *TLS, in uintptr, uu uintptr) int32 {
|
||||
panic(todo(""))
|
||||
if __ccgo_strace {
|
||||
trc("t=%v in=%v uu=%v, (%v:)", t, in, uu, origin(2))
|
||||
}
|
||||
r, err := guuid.Parse(GoString(in))
|
||||
if err != nil {
|
||||
return -1
|
||||
}
|
||||
|
||||
copy((*RawMem)(unsafe.Pointer(uu))[:unsafe.Sizeof(uuid.Uuid_t{})], r[:])
|
||||
return 0
|
||||
}
|
||||
|
||||
// void uuid_generate_random(uuid_t out);
|
||||
func Xuuid_generate_random(t *TLS, out uintptr) {
|
||||
panic(todo(""))
|
||||
if __ccgo_strace {
|
||||
trc("t=%v out=%v, (%v:)", t, out, origin(2))
|
||||
}
|
||||
x := guuid.New()
|
||||
copy((*RawMem)(unsafe.Pointer(out))[:], x[:])
|
||||
}
|
||||
|
||||
// void uuid_unparse(uuid_t uu, char *out);
|
||||
func Xuuid_unparse(t *TLS, uu, out uintptr) {
|
||||
panic(todo(""))
|
||||
if __ccgo_strace {
|
||||
trc("t=%v out=%v, (%v:)", t, out, origin(2))
|
||||
}
|
||||
s := (*guuid.UUID)(unsafe.Pointer(uu)).String()
|
||||
copy((*RawMem)(unsafe.Pointer(out))[:], s)
|
||||
*(*byte)(unsafe.Pointer(out + uintptr(len(s)))) = 0
|
||||
}
|
||||
|
||||
var Xzero_struct_address Taddress
|
||||
|
|
4
vendor/modernc.org/libc/libc_musl_linux_amd64.go
generated
vendored
4
vendor/modernc.org/libc/libc_musl_linux_amd64.go
generated
vendored
|
@ -2,9 +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
|
||||
|
||||
package libc // import "modernc.org/libc
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
import (
|
||||
"golang.org/x/sys/unix"
|
||||
|
|
29
vendor/modernc.org/libc/libc_musl_linux_arm64.go
generated
vendored
Normal file
29
vendor/modernc.org/libc/libc_musl_linux_arm64.go
generated
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
// Copyright 2023 The Libc Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
import (
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
type long = int64
|
||||
|
||||
type ulong = uint64
|
||||
|
||||
// RawMem represents the biggest byte array the runtime can handle
|
||||
type RawMem [1<<50 - 1]byte
|
||||
|
||||
// int renameat2(int olddirfd, const char *oldpath, int newdirfd, const char *newpath, unsigned int flags);
|
||||
func Xrenameat2(t *TLS, olddirfd int32, oldpath uintptr, newdirfd int32, newpath uintptr, flags int32) int32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v olddirfd=%v oldpath=%v newdirfd=%v newpath=%v flags=%v, (%v:)", t, olddirfd, oldpath, newdirfd, newpath, flags, origin(2))
|
||||
}
|
||||
if _, _, err := unix.Syscall6(unix.SYS_RENAMEAT2, uintptr(olddirfd), oldpath, uintptr(newdirfd), newpath, uintptr(flags), 0); err != 0 {
|
||||
t.setErrno(int32(err))
|
||||
return -1
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
2
vendor/modernc.org/libc/libc_musl_linux_loong64.go
generated
vendored
2
vendor/modernc.org/libc/libc_musl_linux_loong64.go
generated
vendored
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package libc // import "modernc.org/libc
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
import (
|
||||
"golang.org/x/sys/unix"
|
||||
|
|
4
vendor/modernc.org/libc/libc_unix.go
generated
vendored
4
vendor/modernc.org/libc/libc_unix.go
generated
vendored
|
@ -2,9 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build unix && !(linux && (amd64 || loong64))
|
||||
// +build unix
|
||||
// +build !linux !amd64,!loong64
|
||||
//go:build unix && !(linux && (amd64 || arm64 || loong64))
|
||||
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
|
|
2
vendor/modernc.org/libc/libc_unix1.go
generated
vendored
2
vendor/modernc.org/libc/libc_unix1.go
generated
vendored
|
@ -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 unix && !illumos && !(linux && (amd64 || loong64)) && !openbsd
|
||||
//go:build unix && !illumos && !(linux && (amd64 || arm64 || loong64)) && !openbsd
|
||||
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
|
|
305
vendor/modernc.org/libc/libc_windows.go
generated
vendored
305
vendor/modernc.org/libc/libc_windows.go
generated
vendored
|
@ -36,9 +36,9 @@ import (
|
|||
var X__imp__environ = EnvironP()
|
||||
var X__imp__wenviron = uintptr(unsafe.Pointer(&wenviron))
|
||||
var X_imp___environ = EnvironP()
|
||||
var X_imp___wenviron = uintptr(unsafe.Pointer(&wenviron))
|
||||
var X_iob [stdio.X_IOB_ENTRIES]stdio.FILE
|
||||
var Xin6addr_any [16]byte
|
||||
|
||||
var Xtimezone long // extern long timezone;
|
||||
|
||||
var (
|
||||
|
@ -146,6 +146,7 @@ var (
|
|||
procMoveFileW = modkernel32.NewProc("MoveFileW")
|
||||
procMultiByteToWideChar = modkernel32.NewProc("MultiByteToWideChar")
|
||||
procOpenEventA = modkernel32.NewProc("OpenEventA")
|
||||
procOpenProcessToken = modkernel32.NewProc("OpenProcessToken")
|
||||
procPeekConsoleInputW = modkernel32.NewProc("PeekConsoleInputW")
|
||||
procPeekNamedPipe = modkernel32.NewProc("PeekNamedPipe")
|
||||
procQueryPerformanceCounter = modkernel32.NewProc("QueryPerformanceCounter")
|
||||
|
@ -159,6 +160,7 @@ var (
|
|||
procSetConsoleTextAttribute = modkernel32.NewProc("SetConsoleTextAttribute")
|
||||
procSetEvent = modkernel32.NewProc("SetEvent")
|
||||
procSetFilePointer = modkernel32.NewProc("SetFilePointer")
|
||||
procSetFileTime = modkernel32.NewProc("SetFileTime")
|
||||
procSleepEx = modkernel32.NewProc("SleepEx")
|
||||
procSystemTimeToFileTime = modkernel32.NewProc("SystemTimeToFileTime")
|
||||
procTerminateThread = modkernel32.NewProc("TerminateThread")
|
||||
|
@ -178,15 +180,22 @@ var (
|
|||
modadvapi = syscall.NewLazyDLL("advapi32.dll")
|
||||
//--
|
||||
procAccessCheck = modadvapi.NewProc("AccessCheck")
|
||||
procAddAce = modadvapi.NewProc("AddAce")
|
||||
procEqualSid = modadvapi.NewProc("EqualSid")
|
||||
procGetAce = modadvapi.NewProc("GetAce")
|
||||
procGetAclInformation = modadvapi.NewProc("GetAclInformation")
|
||||
procGetFileSecurityA = modadvapi.NewProc("GetFileSecurityA")
|
||||
procGetFileSecurityW = modadvapi.NewProc("GetFileSecurityW")
|
||||
procGetLengthSid = modadvapi.NewProc("GetLengthSid")
|
||||
procGetNamedSecurityInfoW = modadvapi.NewProc("GetNamedSecurityInfoW")
|
||||
procGetSecurityDescriptorDacl = modadvapi.NewProc("GetSecurityDescriptorDacl")
|
||||
procGetSecurityDescriptorOwner = modadvapi.NewProc("GetSecurityDescriptorOwner")
|
||||
procGetSidIdentifierAuthority = modadvapi.NewProc("GetSidIdentifierAuthority")
|
||||
procGetSidLengthRequired = modadvapi.NewProc("GetSidLengthRequired")
|
||||
procGetSidSubAuthority = modadvapi.NewProc("GetSidSubAuthority")
|
||||
procGetTokenInformation = modadvapi.NewProc("GetTokenInformation")
|
||||
procImpersonateSelf = modadvapi.NewProc("ImpersonateSelf")
|
||||
procInitializeAcl = modadvapi.NewProc("InitializeAcl")
|
||||
procInitializeSid = modadvapi.NewProc("InitializeSid")
|
||||
procOpenThreadToken = modadvapi.NewProc("OpenThreadToken")
|
||||
procRevertToSelf = modadvapi.NewProc("RevertToSelf")
|
||||
|
@ -199,6 +208,7 @@ var (
|
|||
|
||||
moduser32 = syscall.NewLazyDLL("user32.dll")
|
||||
//--
|
||||
procCharLowerW = moduser32.NewProc("CharLowerW")
|
||||
procCreateWindowExW = moduser32.NewProc("CreateWindowExW")
|
||||
procMsgWaitForMultipleObjectsEx = moduser32.NewProc("MsgWaitForMultipleObjectsEx")
|
||||
procPeekMessageW = moduser32.NewProc("PeekMessageW")
|
||||
|
@ -214,13 +224,20 @@ var (
|
|||
userenvapi = syscall.NewLazyDLL("userenv.dll")
|
||||
procGetProfilesDirectoryW = userenvapi.NewProc("GetProfilesDirectoryW")
|
||||
|
||||
modcrt = syscall.NewLazyDLL("msvcrt.dll")
|
||||
procAccess = modcrt.NewProc("_access")
|
||||
procGmtime = modcrt.NewProc("gmtime")
|
||||
procGmtime64 = modcrt.NewProc("_gmtime64")
|
||||
procStat64i32 = modcrt.NewProc("_stat64i32")
|
||||
procStrftime = modcrt.NewProc("strftime")
|
||||
procStrtod = modcrt.NewProc("strtod")
|
||||
modcrt = syscall.NewLazyDLL("msvcrt.dll")
|
||||
procAccess = modcrt.NewProc("_access")
|
||||
procChmod = modcrt.NewProc("_chmod")
|
||||
procGmtime = modcrt.NewProc("gmtime")
|
||||
procGmtime32 = modcrt.NewProc("_gmtime32")
|
||||
procGmtime64 = modcrt.NewProc("_gmtime64")
|
||||
procStat64i32 = modcrt.NewProc("_stat64i32")
|
||||
procStati64 = modcrt.NewProc("_stati64")
|
||||
procStrftime = modcrt.NewProc("strftime")
|
||||
procStrtod = modcrt.NewProc("strtod")
|
||||
|
||||
moducrt = syscall.NewLazyDLL("ucrtbase.dll")
|
||||
procFindfirst32 = moducrt.NewProc("_findfirst32")
|
||||
procFindnext32 = moducrt.NewProc("_findnext32")
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -290,6 +307,22 @@ func (f *file) setErr() {
|
|||
f.hadErr = true
|
||||
}
|
||||
|
||||
func (tls *TLS) SetLastError(_dwErrCode uint32) {
|
||||
if tls != nil {
|
||||
tls.lastError = _dwErrCode
|
||||
}
|
||||
}
|
||||
|
||||
// https://github.com/golang/go/issues/41220
|
||||
|
||||
func (tls *TLS) GetLastError() (r uint32) {
|
||||
if tls == nil {
|
||||
return 0
|
||||
}
|
||||
|
||||
return tls.lastError
|
||||
}
|
||||
|
||||
// -----------------------------------
|
||||
// On windows we have to fetch these
|
||||
//
|
||||
|
@ -3062,16 +3095,20 @@ func XGetFullPathNameW(t *TLS, lpFileName uintptr, nBufferLength uint32, lpBuffe
|
|||
return n
|
||||
}
|
||||
|
||||
// LPWSTR CharLowerW(
|
||||
//
|
||||
// LPWSTR lpsz
|
||||
//
|
||||
// );
|
||||
func XCharLowerW(t *TLS, lpsz uintptr) uintptr {
|
||||
// __attribute__((dllimport)) LPWSTR CharLowerW(LPWSTR lpsz);
|
||||
func XCharLowerW(tls *TLS, _lpsz uintptr) (r uintptr) {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v lpsz=%v, (%v:)", t, lpsz, origin(2))
|
||||
trc("lpsz=%+v", _lpsz)
|
||||
defer func() { trc(`XCharLowerW->%+v`, r) }()
|
||||
}
|
||||
panic(todo(""))
|
||||
r0, r1, err := syscall.SyscallN(procCharLowerW.Addr(), _lpsz)
|
||||
if err != 0 {
|
||||
if __ccgo_strace {
|
||||
trc(`r0=%v r1=%v err=%v`, r0, r1, err)
|
||||
}
|
||||
tls.SetLastError(uint32(err))
|
||||
}
|
||||
return r0
|
||||
}
|
||||
|
||||
// BOOL CreateDirectoryW(
|
||||
|
@ -5044,73 +5081,83 @@ func Xwcschr(t *TLS, str uintptr, c wchar_t) uintptr {
|
|||
// const FILETIME *lpLastWriteTime
|
||||
//
|
||||
// );
|
||||
func XSetFileTime(t *TLS, hFile uintptr, lpCreationTime, lpLastAccessTime, lpLastWriteTime uintptr) int32 {
|
||||
func XSetFileTime(t *TLS, _hFile uintptr, _lpCreationTime, _lpLastAccessTime, _lpLastWriteTime uintptr) (r int32) {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v hFile=%v lpLastWriteTime=%v, (%v:)", t, hFile, lpLastWriteTime, origin(2))
|
||||
trc("hFile=%+v lpCreationTime=%+v lpLastAccessTime=%+v lpLastWriteTime=%+v", _hFile, _lpCreationTime, _lpLastAccessTime, _lpLastWriteTime)
|
||||
defer func() { trc(`XSetFileTime->%+v`, r) }()
|
||||
}
|
||||
panic(todo(""))
|
||||
r0, r1, err := syscall.SyscallN(procSetFileTime.Addr(), _hFile, _lpCreationTime, _lpLastAccessTime, _lpLastWriteTime)
|
||||
if err != 0 {
|
||||
if __ccgo_strace {
|
||||
trc(`r0=%v r1=%v err=%v`, r0, r1, err)
|
||||
}
|
||||
t.SetLastError(uint32(err))
|
||||
}
|
||||
return int32(r0)
|
||||
}
|
||||
|
||||
// DWORD GetNamedSecurityInfoW(
|
||||
//
|
||||
// LPCWSTR pObjectName,
|
||||
// SE_OBJECT_TYPE ObjectType,
|
||||
// SECURITY_INFORMATION SecurityInfo,
|
||||
// PSID *ppsidOwner,
|
||||
// PSID *ppsidGroup,
|
||||
// PACL *ppDacl,
|
||||
// PACL *ppSacl,
|
||||
// PSECURITY_DESCRIPTOR *ppSecurityDescriptor
|
||||
//
|
||||
// );
|
||||
func XGetNamedSecurityInfoW(t *TLS, pObjectName uintptr, ObjectType, SecurityInfo uint32, ppsidOwner, ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor uintptr) uint32 {
|
||||
// __attribute__((dllimport)) DWORD GetNamedSecurityInfoW (LPCWSTR pObjectName, SE_OBJECT_TYPE ObjectType, SECURITY_INFORMATION SecurityInfo, PSID *ppsidOwner, PSID *ppsidGroup, PACL *ppDacl, PACL *ppSacl, PSECURITY_DESCRIPTOR *ppSecurityDescriptor);
|
||||
func XGetNamedSecurityInfoW(tls *TLS, _pObjectName uintptr, _ObjectType int32, _SecurityInfo uint32, _ppsidOwner uintptr, _ppsidGroup uintptr, _ppDacl uintptr, _ppSacl uintptr, _ppSecurityDescriptor uintptr) (r uint32) {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v pObjectName=%v SecurityInfo=%v ppSecurityDescriptor=%v, (%v:)", t, pObjectName, SecurityInfo, ppSecurityDescriptor, origin(2))
|
||||
trc("pObjectName=%+v ObjectType=%+v SecurityInfo=%+v ppsidOwner=%+v ppsidGroup=%+v ppDacl=%+v ppSacl=%+v ppSecurityDescriptor=%+v", _pObjectName, _ObjectType, _SecurityInfo, _ppsidOwner, _ppsidGroup, _ppDacl, _ppSacl, _ppSecurityDescriptor)
|
||||
defer func() { trc(`XGetNamedSecurityInfoW->%+v`, r) }()
|
||||
}
|
||||
panic(todo(""))
|
||||
r0, r1, err := syscall.SyscallN(procGetNamedSecurityInfoW.Addr(), _pObjectName, uintptr(_ObjectType), uintptr(_SecurityInfo), _ppsidOwner, _ppsidGroup, _ppDacl, _ppSacl, _ppSecurityDescriptor)
|
||||
if err != 0 {
|
||||
if __ccgo_strace {
|
||||
trc(`r0=%v r1=%v err=%v`, r0, r1, err)
|
||||
}
|
||||
tls.SetLastError(uint32(err))
|
||||
}
|
||||
return uint32(r0)
|
||||
}
|
||||
|
||||
// BOOL OpenProcessToken(
|
||||
//
|
||||
// HANDLE ProcessHandle,
|
||||
// DWORD DesiredAccess,
|
||||
// PHANDLE TokenHandle
|
||||
//
|
||||
// );
|
||||
func XOpenProcessToken(t *TLS, ProcessHandle uintptr, DesiredAccess uint32, TokenHandle uintptr) int32 {
|
||||
// __attribute__((dllimport)) WINBOOL OpenProcessToken (HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle);
|
||||
func XOpenProcessToken(tls *TLS, _ProcessHandle uintptr, _DesiredAccess uint32, _TokenHandle uintptr) (r int32) {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v ProcessHandle=%v DesiredAccess=%v TokenHandle=%v, (%v:)", t, ProcessHandle, DesiredAccess, TokenHandle, origin(2))
|
||||
trc("ProcessHandle=%+v DesiredAccess=%+v TokenHandle=%+v", _ProcessHandle, _DesiredAccess, _TokenHandle)
|
||||
defer func() { trc(`XOpenProcessToken->%+v`, r) }()
|
||||
}
|
||||
panic(todo(""))
|
||||
r0, r1, err := syscall.SyscallN(procOpenProcessToken.Addr(), _ProcessHandle, uintptr(_DesiredAccess), _TokenHandle)
|
||||
if err != 0 {
|
||||
if __ccgo_strace {
|
||||
trc(`r0=%v r1=%v err=%v`, r0, r1, err)
|
||||
}
|
||||
tls.SetLastError(uint32(err))
|
||||
}
|
||||
return int32(r0)
|
||||
}
|
||||
|
||||
// BOOL GetTokenInformation(
|
||||
//
|
||||
// HANDLE TokenHandle,
|
||||
// TOKEN_INFORMATION_CLASS TokenInformationClass,
|
||||
// LPVOID TokenInformation,
|
||||
// DWORD TokenInformationLength,
|
||||
// PDWORD ReturnLength
|
||||
//
|
||||
// );
|
||||
func XGetTokenInformation(t *TLS, TokenHandle uintptr, TokenInformationClass uint32, TokenInformation uintptr, TokenInformationLength uint32, ReturnLength uintptr) int32 {
|
||||
// __attribute__((dllimport)) WINBOOL GetTokenInformation (HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength);
|
||||
func XGetTokenInformation(tls *TLS, _TokenHandle uintptr, _TokenInformationClass int32, _TokenInformation uintptr, _TokenInformationLength uint32, _ReturnLength uintptr) (r int32) {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v TokenHandle=%v TokenInformationClass=%v TokenInformation=%v TokenInformationLength=%v ReturnLength=%v, (%v:)", t, TokenHandle, TokenInformationClass, TokenInformation, TokenInformationLength, ReturnLength, origin(2))
|
||||
trc("TokenHandle=%+v TokenInformationClass=%+v TokenInformation=%+v TokenInformationLength=%+v ReturnLength=%+v", _TokenHandle, _TokenInformationClass, _TokenInformation, _TokenInformationLength, _ReturnLength)
|
||||
defer func() { trc(`XGetTokenInformation->%+v`, r) }()
|
||||
}
|
||||
panic(todo(""))
|
||||
r0, r1, err := syscall.SyscallN(procGetTokenInformation.Addr(), _TokenHandle, uintptr(_TokenInformationClass), _TokenInformation, uintptr(_TokenInformationLength), _ReturnLength)
|
||||
if err != 0 {
|
||||
if __ccgo_strace {
|
||||
trc(`r0=%v r1=%v err=%v`, r0, r1, err)
|
||||
}
|
||||
tls.SetLastError(uint32(err))
|
||||
}
|
||||
return int32(r0)
|
||||
}
|
||||
|
||||
// BOOL EqualSid(
|
||||
//
|
||||
// PSID pSid1,
|
||||
// PSID pSid2
|
||||
//
|
||||
// );
|
||||
func XEqualSid(t *TLS, pSid1, pSid2 uintptr) int32 {
|
||||
// __attribute__((dllimport)) WINBOOL EqualSid (PSID pSid1, PSID pSid2);
|
||||
func XEqualSid(tls *TLS, _pSid1 uintptr, _pSid2 uintptr) (r int32) {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v pSid2=%v, (%v:)", t, pSid2, origin(2))
|
||||
trc("pSid1=%+v pSid2=%+v", _pSid1, _pSid2)
|
||||
defer func() { trc(`XEqualSid->%+v`, r) }()
|
||||
}
|
||||
panic(todo(""))
|
||||
r0, r1, err := syscall.SyscallN(procEqualSid.Addr(), _pSid1, _pSid2)
|
||||
if err != 0 {
|
||||
if __ccgo_strace {
|
||||
trc(`r0=%v r1=%v err=%v`, r0, r1, err)
|
||||
}
|
||||
tls.SetLastError(uint32(err))
|
||||
}
|
||||
return int32(r0)
|
||||
}
|
||||
|
||||
// int WSAStartup(
|
||||
|
@ -6388,34 +6435,36 @@ func XAddAccessDeniedAce(t *TLS, pAcl uintptr, dwAceRevision, AccessMask uint32,
|
|||
panic(todo(""))
|
||||
}
|
||||
|
||||
// BOOL AddAce(
|
||||
//
|
||||
// PACL pAcl,
|
||||
// DWORD dwAceRevision,
|
||||
// DWORD dwStartingAceIndex,
|
||||
// LPVOID pAceList,
|
||||
// DWORD nAceListLength
|
||||
//
|
||||
// );
|
||||
func XAddAce(t *TLS, pAcl uintptr, dwAceRevision, dwStartingAceIndex uint32, pAceList uintptr, nAceListLength uint32) int32 {
|
||||
// __attribute__((dllimport)) WINBOOL AddAce (PACL pAcl, DWORD dwAceRevision, DWORD dwStartingAceIndex, LPVOID pAceList, DWORD nAceListLength);
|
||||
func XAddAce(tls *TLS, _pAcl uintptr, _dwAceRevision uint32, _dwStartingAceIndex uint32, _pAceList uintptr, _nAceListLength uint32) (r uint32) {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v pAcl=%v dwStartingAceIndex=%v pAceList=%v nAceListLength=%v, (%v:)", t, pAcl, dwStartingAceIndex, pAceList, nAceListLength, origin(2))
|
||||
trc("pAcl=%+v dwAceRevision=%+v dwStartingAceIndex=%+v pAceList=%+v nAceListLength=%+v", _pAcl, _dwAceRevision, _dwStartingAceIndex, _pAceList, _nAceListLength)
|
||||
defer func() { trc(`XAddAce->%+v`, r) }()
|
||||
}
|
||||
panic(todo(""))
|
||||
r0, r1, err := syscall.SyscallN(procAddAce.Addr(), _pAcl, uintptr(_dwAceRevision), uintptr(_dwStartingAceIndex), _pAceList, uintptr(_nAceListLength))
|
||||
if err != 0 {
|
||||
if __ccgo_strace {
|
||||
trc(`r0=%v r1=%v err=%v`, r0, r1, err)
|
||||
}
|
||||
tls.SetLastError(uint32(err))
|
||||
}
|
||||
return uint32(r0)
|
||||
}
|
||||
|
||||
// BOOL GetAce(
|
||||
//
|
||||
// PACL pAcl,
|
||||
// DWORD dwAceIndex,
|
||||
// LPVOID *pAce
|
||||
//
|
||||
// );
|
||||
func XGetAce(t *TLS, pAcl uintptr, dwAceIndex uint32, pAce uintptr) int32 {
|
||||
// __attribute__((dllimport)) WINBOOL GetAce (PACL pAcl, DWORD dwAceIndex, LPVOID *pAce);
|
||||
func XGetAce(tls *TLS, _pAcl uintptr, _dwAceIndex uint32, _pAce uintptr) (r int32) {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v pAcl=%v dwAceIndex=%v pAce=%v, (%v:)", t, pAcl, dwAceIndex, pAce, origin(2))
|
||||
trc("pAcl=%+v dwAceIndex=%+v pAce=%+v", _pAcl, _dwAceIndex, _pAce)
|
||||
defer func() { trc(`XGetAce->%+v`, r) }()
|
||||
}
|
||||
panic(todo(""))
|
||||
r0, r1, err := syscall.SyscallN(procGetAce.Addr(), _pAcl, uintptr(_dwAceIndex), _pAce)
|
||||
if err != 0 {
|
||||
if __ccgo_strace {
|
||||
trc(`r0=%v r1=%v err=%v`, r0, r1, err)
|
||||
}
|
||||
tls.SetLastError(uint32(err))
|
||||
}
|
||||
return int32(r0)
|
||||
}
|
||||
|
||||
// BOOL GetAclInformation(
|
||||
|
@ -6471,16 +6520,20 @@ func XGetFileSecurityA(t *TLS, lpFileName uintptr, RequestedInformation uint32,
|
|||
return int32(r0)
|
||||
}
|
||||
|
||||
// DWORD GetLengthSid(
|
||||
//
|
||||
// PSID pSid
|
||||
//
|
||||
// );
|
||||
func XGetLengthSid(t *TLS, pSid uintptr) uint32 {
|
||||
// __attribute__((dllimport)) DWORD GetLengthSid (PSID pSid);
|
||||
func XGetLengthSid(tls *TLS, _pSid uintptr) (r uint32) {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v pSid=%v, (%v:)", t, pSid, origin(2))
|
||||
trc("pSid=%+v", _pSid)
|
||||
defer func() { trc(`XGetLengthSid->%+v`, r) }()
|
||||
}
|
||||
panic(todo(""))
|
||||
r0, r1, err := syscall.SyscallN(procGetLengthSid.Addr(), _pSid)
|
||||
if err != 0 {
|
||||
if __ccgo_strace {
|
||||
trc(`r0=%v r1=%v err=%v`, r0, r1, err)
|
||||
}
|
||||
tls.SetLastError(uint32(err))
|
||||
}
|
||||
return uint32(r0)
|
||||
}
|
||||
|
||||
// BOOL GetSecurityDescriptorDacl(
|
||||
|
@ -6542,18 +6595,20 @@ func XGetSidSubAuthority(t *TLS, pSid uintptr, nSubAuthority uint32) uintptr {
|
|||
return r0
|
||||
}
|
||||
|
||||
// BOOL InitializeAcl(
|
||||
//
|
||||
// PACL pAcl,
|
||||
// DWORD nAclLength,
|
||||
// DWORD dwAclRevision
|
||||
//
|
||||
// );
|
||||
func XInitializeAcl(t *TLS, pAcl uintptr, nAclLength, dwAclRevision uint32) int32 {
|
||||
// __attribute__((dllimport)) WINBOOL InitializeAcl (PACL pAcl, DWORD nAclLength, DWORD dwAclRevision);
|
||||
func XInitializeAcl(tls *TLS, _pAcl uintptr, _nAclLength uint32, _dwAclRevision uint32) (r int32) {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v pAcl=%v dwAclRevision=%v, (%v:)", t, pAcl, dwAclRevision, origin(2))
|
||||
trc("pAcl=%+v nAclLength=%+v dwAclRevision=%+v", _pAcl, _nAclLength, _dwAclRevision)
|
||||
defer func() { trc(`XInitializeAcl->%+v`, r) }()
|
||||
}
|
||||
panic(todo(""))
|
||||
r0, r1, err := syscall.SyscallN(procInitializeAcl.Addr(), _pAcl, uintptr(_nAclLength), uintptr(_dwAclRevision))
|
||||
if err != 0 {
|
||||
if __ccgo_strace {
|
||||
trc(`r0=%v r1=%v err=%v`, r0, r1, err)
|
||||
}
|
||||
tls.SetLastError(uint32(err))
|
||||
}
|
||||
return int32(r0)
|
||||
}
|
||||
|
||||
// BOOL InitializeSid(
|
||||
|
@ -6723,22 +6778,19 @@ func X_commit(t *TLS, fd int32) int32 {
|
|||
// );
|
||||
func X_stati64(t *TLS, path, buffer uintptr) int32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v buffer=%v, (%v:)", t, buffer, origin(2))
|
||||
trc("t=%v path=%v buffer=%v, (%v:)", t, path, buffer, origin(2))
|
||||
}
|
||||
panic(todo(""))
|
||||
r0, _, err := syscall.SyscallN(procStati64.Addr(), uintptr(path), uintptr(buffer))
|
||||
if err != 0 {
|
||||
t.setErrno(err)
|
||||
}
|
||||
return int32(r0)
|
||||
}
|
||||
|
||||
// int _fstati64(
|
||||
//
|
||||
// int fd,
|
||||
// struct _stati64 *buffer
|
||||
//
|
||||
// );
|
||||
|
||||
// int _fstati64(int fd, struct _stati64 *buffer);
|
||||
func X_fstati64(t *TLS, fd int32, buffer uintptr) int32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v fd=%v buffer=%v, (%v:)", t, fd, buffer, origin(2))
|
||||
}
|
||||
panic(todo(""))
|
||||
return X_fstat64(t, fd, buffer)
|
||||
}
|
||||
|
||||
// int _findnext32(
|
||||
|
@ -6751,7 +6803,11 @@ func X_findnext32(t *TLS, handle types.Intptr_t, buffer uintptr) int32 {
|
|||
if __ccgo_strace {
|
||||
trc("t=%v handle=%v buffer=%v, (%v:)", t, handle, buffer, origin(2))
|
||||
}
|
||||
panic(todo(""))
|
||||
r0, _, err := syscall.SyscallN(procFindnext32.Addr(), uintptr(handle), buffer)
|
||||
if err != 0 {
|
||||
t.setErrno(err)
|
||||
}
|
||||
return int32(r0)
|
||||
}
|
||||
|
||||
// intptr_t _findfirst32(
|
||||
|
@ -6764,7 +6820,11 @@ func X_findfirst32(t *TLS, filespec, fileinfo uintptr) types.Intptr_t {
|
|||
if __ccgo_strace {
|
||||
trc("t=%v fileinfo=%v, (%v:)", t, fileinfo, origin(2))
|
||||
}
|
||||
panic(todo(""))
|
||||
r0, _, err := syscall.SyscallN(procFindfirst32.Addr(), filespec, fileinfo)
|
||||
if err != 0 {
|
||||
t.setErrno(err)
|
||||
}
|
||||
return types.Intptr_t(r0)
|
||||
}
|
||||
|
||||
/*-
|
||||
|
@ -7171,10 +7231,11 @@ func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_att
|
|||
}
|
||||
|
||||
func Xchmod(t *TLS, pathname uintptr, mode int32) int32 {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
|
||||
r0, _, err := syscall.SyscallN(procChmod.Addr(), pathname, uintptr(mode))
|
||||
if err != 0 {
|
||||
t.setErrno(err)
|
||||
}
|
||||
panic(todo("%q %#o", GoString(pathname), mode))
|
||||
return int32(r0)
|
||||
}
|
||||
|
||||
// typedef enum _COMPUTER_NAME_FORMAT {
|
||||
|
|
63
vendor/modernc.org/libc/libc_windows_386.go
generated
vendored
63
vendor/modernc.org/libc/libc_windows_386.go
generated
vendored
|
@ -8,11 +8,13 @@ import (
|
|||
"os"
|
||||
"strings"
|
||||
"syscall"
|
||||
gotime "time"
|
||||
"unsafe"
|
||||
|
||||
"modernc.org/libc/errno"
|
||||
"modernc.org/libc/sys/stat"
|
||||
"modernc.org/libc/sys/types"
|
||||
"modernc.org/libc/time"
|
||||
)
|
||||
|
||||
// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
|
||||
|
@ -226,21 +228,26 @@ func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
|
|||
if __ccgo_strace {
|
||||
trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
|
||||
}
|
||||
panic(todo(""))
|
||||
// bp := t.Alloc(int(unsafe.Sizeof(types.X__loff_t(0))))
|
||||
// defer t.Free(int(unsafe.Sizeof(types.X__loff_t(0))))
|
||||
// if _, _, err := unix.Syscall6(unix.SYS__LLSEEK, uintptr(fd), uintptr(offset>>32), uintptr(offset), bp, uintptr(whence), 0); err != 0 {
|
||||
// if dmesgs {
|
||||
// dmesg("%v: fd %v, off %#x, whence %v: %v", origin(1), fd, offset, whenceStr(whence), err)
|
||||
// }
|
||||
// t.setErrno(err)
|
||||
// return -1
|
||||
// }
|
||||
//
|
||||
// if dmesgs {
|
||||
// dmesg("%v: fd %v, off %#x, whence %v: %#x", origin(1), fd, offset, whenceStr(whence), *(*types.Off_t)(unsafe.Pointer(bp)))
|
||||
// }
|
||||
// return *(*types.Off_t)(unsafe.Pointer(bp))
|
||||
|
||||
f, ok := fdToFile(fd)
|
||||
if !ok {
|
||||
t.setErrno(errno.EBADF)
|
||||
return -1
|
||||
}
|
||||
|
||||
n, err := syscall.Seek(f.Handle, offset, int(whence))
|
||||
if err != nil {
|
||||
if dmesgs {
|
||||
dmesg("%v: fd %v, off %#x, whence %v: %v", origin(1), f._fd, offset, whenceStr(whence), n)
|
||||
}
|
||||
t.setErrno(err)
|
||||
return -1
|
||||
}
|
||||
|
||||
if dmesgs {
|
||||
dmesg("%v: fd %v, off %#x, whence %v: ok", origin(1), f._fd, offset, whenceStr(whence))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
// int utime(const char *filename, const struct utimbuf *times);
|
||||
|
@ -590,19 +597,29 @@ func Xaccept(t *TLS, sockfd uint32, addr uintptr, addrlen uintptr) uint32 {
|
|||
}
|
||||
|
||||
// struct tm *_localtime32( const __time32_t *sourceTime );
|
||||
func X_localtime32(t *TLS, sourceTime uintptr) uintptr {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v sourceTime=%v, (%v:)", t, sourceTime, origin(2))
|
||||
}
|
||||
panic(todo(""))
|
||||
func X_localtime32(_ *TLS, sourceTime uintptr) uintptr {
|
||||
loc := getLocalLocation()
|
||||
ut := *(*time.Time_t)(unsafe.Pointer(sourceTime))
|
||||
t := gotime.Unix(int64(ut), 0).In(loc)
|
||||
localtime.Ftm_sec = int32(t.Second())
|
||||
localtime.Ftm_min = int32(t.Minute())
|
||||
localtime.Ftm_hour = int32(t.Hour())
|
||||
localtime.Ftm_mday = int32(t.Day())
|
||||
localtime.Ftm_mon = int32(t.Month() - 1)
|
||||
localtime.Ftm_year = int32(t.Year() - 1900)
|
||||
localtime.Ftm_wday = int32(t.Weekday())
|
||||
localtime.Ftm_yday = int32(t.YearDay())
|
||||
localtime.Ftm_isdst = Bool32(isTimeDST(t))
|
||||
return uintptr(unsafe.Pointer(&localtime))
|
||||
}
|
||||
|
||||
// struct tm *_gmtime32( const __time32_t *sourceTime );
|
||||
func X_gmtime32(t *TLS, sourceTime uintptr) uintptr {
|
||||
if __ccgo_strace {
|
||||
trc("t=%v sourceTime=%v, (%v:)", t, sourceTime, origin(2))
|
||||
r0, _, err := syscall.SyscallN(procGmtime32.Addr(), uintptr(sourceTime))
|
||||
if err != 0 {
|
||||
t.setErrno(err)
|
||||
}
|
||||
panic(todo(""))
|
||||
return uintptr(r0)
|
||||
}
|
||||
|
||||
// LONG SetWindowLongW(
|
||||
|
|
5
vendor/modernc.org/libc/mem.go
generated
vendored
5
vendor/modernc.org/libc/mem.go
generated
vendored
|
@ -2,10 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build !libc.membrk && !libc.memgrind && !(linux && (amd64 || loong64))
|
||||
// +build !libc.membrk
|
||||
// +build !libc.memgrind
|
||||
// +build !linux !amd64,!loong64
|
||||
//go:build !libc.membrk && !libc.memgrind && !(linux && (amd64 || arm64 || loong64))
|
||||
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
|
|
5
vendor/modernc.org/libc/mem_brk.go
generated
vendored
5
vendor/modernc.org/libc/mem_brk.go
generated
vendored
|
@ -2,10 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build libc.membrk && !libc.memgrind && !(linux && (amd64 || loong64))
|
||||
// +build libc.membrk
|
||||
// +build !libc.memgrind
|
||||
// +build !linux !amd64,!loong64
|
||||
//go:build libc.membrk && !libc.memgrind && !(linux && (amd64 || arm64 || loong64))
|
||||
|
||||
// This is a debug-only version of the memory handling functions. When a
|
||||
// program is built with -tags=libc.membrk a simple but safe version of malloc
|
||||
|
|
4
vendor/modernc.org/libc/mem_brk_musl.go
generated
vendored
4
vendor/modernc.org/libc/mem_brk_musl.go
generated
vendored
|
@ -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 libc.membrk && !libc.memgrind && linux && (amd64 || loong64)
|
||||
//go:build libc.membrk && !libc.memgrind && linux && (amd64 || arm64 || loong64)
|
||||
|
||||
// This is a debug-only version of the memory handling functions. When a
|
||||
// program is built with -tags=libc.membrk a simple but safe version of malloc
|
||||
|
@ -12,7 +12,7 @@
|
|||
// The fixed heap is initially filled with random bytes from a full cycle PRNG,
|
||||
// program startup time is substantially prolonged.
|
||||
|
||||
package libc // import "modernc.org/libc/v2"
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
|
8
vendor/modernc.org/libc/mem_musl.go
generated
vendored
8
vendor/modernc.org/libc/mem_musl.go
generated
vendored
|
@ -2,13 +2,13 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build !libc.membrk && !libc.memgrind && linux && (amd64 || loong64)
|
||||
//go:build !libc.membrk && !libc.memgrind && linux && (amd64 || arm64 || loong64)
|
||||
|
||||
package libc // import "modernc.org/libc/v2"
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
import (
|
||||
"math"
|
||||
"math/bits"
|
||||
mbits "math/bits"
|
||||
|
||||
"modernc.org/memory"
|
||||
)
|
||||
|
@ -49,7 +49,7 @@ func Xcalloc(tls *TLS, m Tsize_t, n Tsize_t) (r uintptr) {
|
|||
trc("tls=%v m=%v n=%v, (%v:)", tls, m, n, origin(2))
|
||||
defer func() { trc("-> %v", r) }()
|
||||
}
|
||||
hi, rq := bits.Mul(uint(m), uint(n))
|
||||
hi, rq := mbits.Mul(uint(m), uint(n))
|
||||
if hi != 0 || rq > math.MaxInt {
|
||||
tls.setErrno(ENOMEM)
|
||||
return 0
|
||||
|
|
5
vendor/modernc.org/libc/memgrind.go
generated
vendored
5
vendor/modernc.org/libc/memgrind.go
generated
vendored
|
@ -2,10 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build !libc.membrk && libc.memgrind && !(linux && (amd64 || loong64))
|
||||
// +build !libc.membrk
|
||||
// +build libc.memgrind
|
||||
// +build !linux !amd64,!loong64
|
||||
//go:build !libc.membrk && libc.memgrind && !(linux && (amd64 || arm64 || loong64))
|
||||
|
||||
// This is a debug-only version of the memory handling functions. When a
|
||||
// program is built with -tags=libc.memgrind the functions MemAuditStart and
|
||||
|
|
2
vendor/modernc.org/libc/memgrind_musl.go
generated
vendored
2
vendor/modernc.org/libc/memgrind_musl.go
generated
vendored
|
@ -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 !libc.membrk && libc.memgrind && linux && (amd64 || loong64)
|
||||
//go:build !libc.membrk && libc.memgrind && linux && (amd64 || arm64 || loong64)
|
||||
|
||||
// This is a debug-only version of the memory handling functions. When a
|
||||
// program is built with -tags=libc.memgrind the functions MemAuditStart and
|
||||
|
|
7289
vendor/modernc.org/libc/musl_linux_arm64.go
generated
vendored
7289
vendor/modernc.org/libc/musl_linux_arm64.go
generated
vendored
File diff suppressed because it is too large
Load diff
4
vendor/modernc.org/libc/printf.go
generated
vendored
4
vendor/modernc.org/libc/printf.go
generated
vendored
|
@ -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 || loong64))
|
||||
//go:build !(linux && (amd64 || arm64 || loong64))
|
||||
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
|
@ -346,6 +346,8 @@ more:
|
|||
arg = uint64(uint8(VaInt32(args)))
|
||||
case mod32:
|
||||
arg = uint64(VaInt32(args))
|
||||
case modZ:
|
||||
arg = uint64(VaInt64(args))
|
||||
default:
|
||||
panic(todo("", mod))
|
||||
}
|
||||
|
|
3
vendor/modernc.org/libc/pthread.go
generated
vendored
3
vendor/modernc.org/libc/pthread.go
generated
vendored
|
@ -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 || loong64))
|
||||
//go:build !(linux && (amd64 || arm64 || loong64))
|
||||
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
|
@ -40,6 +40,7 @@ type TLS struct {
|
|||
allocaStack [][]uintptr
|
||||
allocas []uintptr
|
||||
jumpBuffers []uintptr
|
||||
lastError uint32
|
||||
pthreadData
|
||||
stack stackHeader
|
||||
|
||||
|
|
16
vendor/modernc.org/libc/pthread_all.go
generated
vendored
16
vendor/modernc.org/libc/pthread_all.go
generated
vendored
|
@ -2,10 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build !freebsd && !openbsd && !(linux && (amd64 || loong64))
|
||||
// +build !freebsd
|
||||
// +build !openbsd
|
||||
// +build !linux !amd64,!loong64
|
||||
//go:build !freebsd && !openbsd && !(linux && (amd64 || arm64 || loong64))
|
||||
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
|
@ -50,3 +47,14 @@ func Xpthread_mutex_init(t *TLS, pMutex, pAttr uintptr) int32 {
|
|||
mutexes[pMutex] = newMutex(typ)
|
||||
return 0
|
||||
}
|
||||
|
||||
func Xpthread_atfork(tls *TLS, prepare, parent, child uintptr) int32 {
|
||||
// fork(2) not supported.
|
||||
return 0
|
||||
}
|
||||
|
||||
// int pthread_sigmask(int how, const sigset_t *restrict set, sigset_t *restrict old)
|
||||
func Xpthread_sigmask(tls *TLS, now int32, set, old uintptr) int32 {
|
||||
// ignored
|
||||
return 0
|
||||
}
|
||||
|
|
5
vendor/modernc.org/libc/pthread_musl.go
generated
vendored
5
vendor/modernc.org/libc/pthread_musl.go
generated
vendored
|
@ -2,13 +2,12 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux && (amd64 || loong64)
|
||||
//go:build linux && (amd64 || arm64 || loong64)
|
||||
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"slices"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
@ -399,7 +398,7 @@ func Xpthread_cond_timedwait(tls *TLS, c, m, ts uintptr) (r int32) {
|
|||
waiters = conds.conds[c]
|
||||
for i, v := range waiters {
|
||||
if v == ch {
|
||||
conds.conds[c] = slices.Delete(waiters, i, i+1)
|
||||
conds.conds[c] = append(waiters[:i], waiters[i+1:]...)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
4
vendor/modernc.org/libc/rtl.go
generated
vendored
4
vendor/modernc.org/libc/rtl.go
generated
vendored
|
@ -2,9 +2,9 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux && (amd64 || loong64)
|
||||
//go:build linux && (amd64 || arm64 || loong64)
|
||||
|
||||
package libc // import "modernc.org/libc/v2"
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
import (
|
||||
"math"
|
||||
|
|
237
vendor/modernc.org/libc/scanf.go
generated
vendored
237
vendor/modernc.org/libc/scanf.go
generated
vendored
|
@ -2,13 +2,14 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build !(linux && (amd64 || loong64))
|
||||
//go:build !(linux && (amd64 || arm64 || loong64))
|
||||
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
import (
|
||||
"io"
|
||||
"strconv"
|
||||
"strings"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
|
@ -86,6 +87,7 @@ func scanfConversion(r io.ByteScanner, format uintptr, args *uintptr) (_ uintptr
|
|||
|
||||
mod := 0
|
||||
width := -1
|
||||
discard := false
|
||||
flags:
|
||||
for {
|
||||
switch c := *(*byte)(unsafe.Pointer(format)); c {
|
||||
|
@ -95,7 +97,7 @@ flags:
|
|||
// corresponding pointer argument is re‐ quired, and this specification is not
|
||||
// included in the count of successful assignments returned by scanf().
|
||||
format++
|
||||
panic(todo(""))
|
||||
discard = true
|
||||
case '\'':
|
||||
// For decimal conversions, an optional quote character ('). This specifies
|
||||
// that the input number may include thousands' separators as defined by the
|
||||
|
@ -143,7 +145,18 @@ flags:
|
|||
// input '%' character. No conversion is done (but initial white space
|
||||
// characters are discarded), and assign‐ ment does not occur.
|
||||
format++
|
||||
panic(todo(""))
|
||||
skipReaderWhiteSpace(r)
|
||||
c, err := r.ReadByte()
|
||||
if err != nil {
|
||||
return format, -1, false
|
||||
}
|
||||
|
||||
if c == '%' {
|
||||
return format, 1, true
|
||||
}
|
||||
|
||||
r.UnreadByte()
|
||||
return format, 0, false
|
||||
case 'd':
|
||||
// Matches an optionally signed decimal integer; the next pointer must be a
|
||||
// pointer to int.
|
||||
|
@ -193,22 +206,26 @@ flags:
|
|||
break
|
||||
}
|
||||
|
||||
arg := VaUintptr(args)
|
||||
v := int64(n)
|
||||
if neg {
|
||||
v = -v
|
||||
}
|
||||
switch mod {
|
||||
case modNone:
|
||||
*(*int32)(unsafe.Pointer(arg)) = int32(v)
|
||||
case modH:
|
||||
*(*int16)(unsafe.Pointer(arg)) = int16(v)
|
||||
case modHH:
|
||||
*(*int8)(unsafe.Pointer(arg)) = int8(v)
|
||||
case modL:
|
||||
*(*long)(unsafe.Pointer(arg)) = long(n)
|
||||
default:
|
||||
panic(todo(""))
|
||||
if !discard {
|
||||
arg := VaUintptr(args)
|
||||
v := int64(n)
|
||||
if neg {
|
||||
v = -v
|
||||
}
|
||||
switch mod {
|
||||
case modNone:
|
||||
*(*int32)(unsafe.Pointer(arg)) = int32(v)
|
||||
case modH:
|
||||
*(*int16)(unsafe.Pointer(arg)) = int16(v)
|
||||
case modHH:
|
||||
*(*int8)(unsafe.Pointer(arg)) = int8(v)
|
||||
case modL:
|
||||
*(*long)(unsafe.Pointer(arg)) = long(v)
|
||||
case modLL:
|
||||
*(*int64)(unsafe.Pointer(arg)) = int64(v)
|
||||
default:
|
||||
panic(todo("", mod))
|
||||
}
|
||||
}
|
||||
nvalues = 1
|
||||
case 'D':
|
||||
|
@ -246,7 +263,7 @@ flags:
|
|||
for ; width != 0; width-- {
|
||||
c, err := r.ReadByte()
|
||||
if err != nil {
|
||||
if match {
|
||||
if match || err == io.EOF {
|
||||
break hex
|
||||
}
|
||||
|
||||
|
@ -286,18 +303,20 @@ flags:
|
|||
break
|
||||
}
|
||||
|
||||
arg := VaUintptr(args)
|
||||
switch mod {
|
||||
case modNone:
|
||||
*(*uint32)(unsafe.Pointer(arg)) = uint32(n)
|
||||
case modH:
|
||||
*(*uint16)(unsafe.Pointer(arg)) = uint16(n)
|
||||
case modHH:
|
||||
*(*byte)(unsafe.Pointer(arg)) = byte(n)
|
||||
case modL:
|
||||
*(*ulong)(unsafe.Pointer(arg)) = ulong(n)
|
||||
default:
|
||||
panic(todo(""))
|
||||
if !discard {
|
||||
arg := VaUintptr(args)
|
||||
switch mod {
|
||||
case modNone:
|
||||
*(*uint32)(unsafe.Pointer(arg)) = uint32(n)
|
||||
case modH:
|
||||
*(*uint16)(unsafe.Pointer(arg)) = uint16(n)
|
||||
case modHH:
|
||||
*(*byte)(unsafe.Pointer(arg)) = byte(n)
|
||||
case modL:
|
||||
*(*ulong)(unsafe.Pointer(arg)) = ulong(n)
|
||||
default:
|
||||
panic(todo(""))
|
||||
}
|
||||
}
|
||||
nvalues = 1
|
||||
case 'f', 'e', 'g', 'E', 'a':
|
||||
|
@ -323,17 +342,19 @@ flags:
|
|||
panic(todo("", err))
|
||||
}
|
||||
|
||||
arg := VaUintptr(args)
|
||||
if neg {
|
||||
n = -n
|
||||
}
|
||||
switch mod {
|
||||
case modNone:
|
||||
*(*float32)(unsafe.Pointer(arg)) = float32(n)
|
||||
case modL:
|
||||
*(*float64)(unsafe.Pointer(arg)) = n
|
||||
default:
|
||||
panic(todo("", mod, neg, n))
|
||||
if !discard {
|
||||
arg := VaUintptr(args)
|
||||
if neg {
|
||||
n = -n
|
||||
}
|
||||
switch mod {
|
||||
case modNone:
|
||||
*(*float32)(unsafe.Pointer(arg)) = float32(n)
|
||||
case modL:
|
||||
*(*float64)(unsafe.Pointer(arg)) = n
|
||||
default:
|
||||
panic(todo("", mod, neg, n))
|
||||
}
|
||||
}
|
||||
return format, 1, true
|
||||
case 's':
|
||||
|
@ -342,8 +363,44 @@ flags:
|
|||
// hold the input sequence and the terminating null byte ('\0'), which is added
|
||||
// automatically. The input string stops at white space or at the maximum
|
||||
// field width, whichever occurs first.
|
||||
format++
|
||||
panic(todo(""))
|
||||
var c byte
|
||||
var err error
|
||||
var arg uintptr
|
||||
if !discard {
|
||||
arg = VaUintptr(args)
|
||||
}
|
||||
scans:
|
||||
for ; width != 0; width-- {
|
||||
if c, err = r.ReadByte(); err != nil {
|
||||
if err != io.EOF {
|
||||
nvalues = -1
|
||||
}
|
||||
break scans
|
||||
}
|
||||
|
||||
switch c {
|
||||
case ' ', '\t', '\n', '\r', '\v', '\f':
|
||||
break scans
|
||||
}
|
||||
|
||||
nvalues = 1
|
||||
match = true
|
||||
if !discard {
|
||||
*(*byte)(unsafe.Pointer(arg)) = c
|
||||
arg++
|
||||
}
|
||||
}
|
||||
if match {
|
||||
switch {
|
||||
case width == 0:
|
||||
r.UnreadByte()
|
||||
fallthrough
|
||||
default:
|
||||
if !discard {
|
||||
*(*byte)(unsafe.Pointer(arg)) = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
case 'c':
|
||||
// Matches a sequence of characters whose length is specified by the maximum
|
||||
// field width (default 1); the next pointer must be a pointer to char, and
|
||||
|
@ -370,7 +427,69 @@ flags:
|
|||
// hyphen". The string ends with the appearance of a character not in the
|
||||
// (or, with a circumflex, in) set or when the field width runs out.
|
||||
format++
|
||||
panic(todo(""))
|
||||
var re0 []byte
|
||||
bracket:
|
||||
for i := 0; ; i++ {
|
||||
c := *(*byte)(unsafe.Pointer(format))
|
||||
format++
|
||||
if c == ']' && i != 0 {
|
||||
break bracket
|
||||
}
|
||||
|
||||
re0 = append(re0, c)
|
||||
}
|
||||
set := map[byte]struct{}{}
|
||||
re := string(re0)
|
||||
neg := strings.HasPrefix(re, "^")
|
||||
if neg {
|
||||
re = re[1:]
|
||||
}
|
||||
for len(re) != 0 {
|
||||
switch {
|
||||
case len(re) >= 3 && re[1] == '-':
|
||||
for c := re[0]; c <= re[2]; c++ {
|
||||
set[c] = struct{}{}
|
||||
}
|
||||
re = re[3:]
|
||||
default:
|
||||
set[c] = struct{}{}
|
||||
re = re[1:]
|
||||
}
|
||||
}
|
||||
var arg uintptr
|
||||
if !discard {
|
||||
arg = VaUintptr(args)
|
||||
}
|
||||
for ; width != 0; width-- {
|
||||
c, err := r.ReadByte()
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
return format, nvalues, match
|
||||
}
|
||||
|
||||
return format, -1, match
|
||||
}
|
||||
|
||||
if _, ok := set[c]; ok == !neg {
|
||||
match = true
|
||||
nvalues = 1
|
||||
if !discard {
|
||||
*(*byte)(unsafe.Pointer(arg)) = c
|
||||
arg++
|
||||
}
|
||||
}
|
||||
}
|
||||
if match {
|
||||
switch {
|
||||
case width == 0:
|
||||
r.UnreadByte()
|
||||
fallthrough
|
||||
default:
|
||||
if !discard {
|
||||
*(*byte)(unsafe.Pointer(arg)) = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
case 'p':
|
||||
// Matches a pointer value (as printed by %p in printf(3); the next pointer
|
||||
// must be a pointer to a pointer to void.
|
||||
|
@ -378,21 +497,17 @@ flags:
|
|||
skipReaderWhiteSpace(r)
|
||||
c, err := r.ReadByte()
|
||||
if err != nil {
|
||||
panic(todo(""))
|
||||
panic(todo("", err))
|
||||
}
|
||||
|
||||
if c != '0' {
|
||||
r.UnreadByte()
|
||||
panic(todo(""))
|
||||
}
|
||||
if c == '0' {
|
||||
if c, err = r.ReadByte(); err != nil {
|
||||
panic(todo("", err))
|
||||
}
|
||||
|
||||
if c, err = r.ReadByte(); err != nil {
|
||||
panic(todo(""))
|
||||
}
|
||||
|
||||
if c != 'x' && c != 'X' {
|
||||
r.UnreadByte()
|
||||
panic(todo(""))
|
||||
if c != 'x' && c != 'X' {
|
||||
r.UnreadByte()
|
||||
}
|
||||
}
|
||||
|
||||
var digit, n uint64
|
||||
|
@ -429,8 +544,10 @@ flags:
|
|||
break
|
||||
}
|
||||
|
||||
arg := VaUintptr(args)
|
||||
*(*uintptr)(unsafe.Pointer(arg)) = uintptr(n)
|
||||
if !discard {
|
||||
arg := VaUintptr(args)
|
||||
*(*uintptr)(unsafe.Pointer(arg)) = uintptr(n)
|
||||
}
|
||||
nvalues = 1
|
||||
case 'n':
|
||||
// Nothing is expected; instead, the number of characters consumed thus far
|
||||
|
|
710
vendor/modernc.org/libc/stdatomic.go
generated
vendored
Normal file
710
vendor/modernc.org/libc/stdatomic.go
generated
vendored
Normal file
|
@ -0,0 +1,710 @@
|
|||
// Copyright 2024 The Libc Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
var (
|
||||
int8Mu sync.Mutex
|
||||
int16Mu sync.Mutex
|
||||
int32Mu sync.Mutex
|
||||
int64Mu sync.Mutex
|
||||
)
|
||||
|
||||
// type __atomic_fetch_add(type *ptr, type val, int memorder)
|
||||
//
|
||||
// { tmp = *ptr; *ptr op= val; return tmp; }
|
||||
// { tmp = *ptr; *ptr = ~(*ptr & val); return tmp; } // nand
|
||||
|
||||
func X__atomic_fetch_addInt8(t *TLS, ptr uintptr, val int8, _ int32) (r int8) {
|
||||
int8Mu.Lock()
|
||||
|
||||
defer int8Mu.Unlock()
|
||||
|
||||
r = *(*int8)(unsafe.Pointer(ptr))
|
||||
*(*int8)(unsafe.Pointer(ptr)) += val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_addUint8(t *TLS, ptr uintptr, val uint8, _ int32) (r uint8) {
|
||||
int8Mu.Lock()
|
||||
|
||||
defer int8Mu.Unlock()
|
||||
|
||||
r = *(*uint8)(unsafe.Pointer(ptr))
|
||||
*(*uint8)(unsafe.Pointer(ptr)) += val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_addInt16(t *TLS, ptr uintptr, val int16, _ int32) (r int16) {
|
||||
int16Mu.Lock()
|
||||
|
||||
defer int16Mu.Unlock()
|
||||
|
||||
r = *(*int16)(unsafe.Pointer(ptr))
|
||||
*(*int16)(unsafe.Pointer(ptr)) += val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_addUint16(t *TLS, ptr uintptr, val uint16, _ int32) (r uint16) {
|
||||
int16Mu.Lock()
|
||||
|
||||
defer int16Mu.Unlock()
|
||||
|
||||
r = *(*uint16)(unsafe.Pointer(ptr))
|
||||
*(*uint16)(unsafe.Pointer(ptr)) += val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_addInt32(t *TLS, ptr uintptr, val int32, _ int32) (r int32) {
|
||||
int32Mu.Lock()
|
||||
|
||||
defer int32Mu.Unlock()
|
||||
|
||||
r = *(*int32)(unsafe.Pointer(ptr))
|
||||
*(*int32)(unsafe.Pointer(ptr)) += val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_addUint32(t *TLS, ptr uintptr, val uint32, _ int32) (r uint32) {
|
||||
int32Mu.Lock()
|
||||
|
||||
defer int32Mu.Unlock()
|
||||
|
||||
r = *(*uint32)(unsafe.Pointer(ptr))
|
||||
*(*uint32)(unsafe.Pointer(ptr)) += val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_addInt64(t *TLS, ptr uintptr, val int64, _ int32) (r int64) {
|
||||
int64Mu.Lock()
|
||||
|
||||
defer int64Mu.Unlock()
|
||||
|
||||
r = *(*int64)(unsafe.Pointer(ptr))
|
||||
*(*int64)(unsafe.Pointer(ptr)) += val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_addUint64(t *TLS, ptr uintptr, val uint64, _ int32) (r uint64) {
|
||||
int64Mu.Lock()
|
||||
|
||||
defer int64Mu.Unlock()
|
||||
|
||||
r = *(*uint64)(unsafe.Pointer(ptr))
|
||||
*(*uint64)(unsafe.Pointer(ptr)) += val
|
||||
return r
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
func X__atomic_fetch_andInt8(t *TLS, ptr uintptr, val int8, _ int32) (r int8) {
|
||||
int8Mu.Lock()
|
||||
|
||||
defer int8Mu.Unlock()
|
||||
|
||||
r = *(*int8)(unsafe.Pointer(ptr))
|
||||
*(*int8)(unsafe.Pointer(ptr)) &= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_andUint8(t *TLS, ptr uintptr, val uint8, _ int32) (r uint8) {
|
||||
int8Mu.Lock()
|
||||
|
||||
defer int8Mu.Unlock()
|
||||
|
||||
r = *(*uint8)(unsafe.Pointer(ptr))
|
||||
*(*uint8)(unsafe.Pointer(ptr)) &= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_andInt16(t *TLS, ptr uintptr, val int16, _ int32) (r int16) {
|
||||
int16Mu.Lock()
|
||||
|
||||
defer int16Mu.Unlock()
|
||||
|
||||
r = *(*int16)(unsafe.Pointer(ptr))
|
||||
*(*int16)(unsafe.Pointer(ptr)) &= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_andUint16(t *TLS, ptr uintptr, val uint16, _ int32) (r uint16) {
|
||||
int16Mu.Lock()
|
||||
|
||||
defer int16Mu.Unlock()
|
||||
|
||||
r = *(*uint16)(unsafe.Pointer(ptr))
|
||||
*(*uint16)(unsafe.Pointer(ptr)) &= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_andInt32(t *TLS, ptr uintptr, val int32, _ int32) (r int32) {
|
||||
int32Mu.Lock()
|
||||
|
||||
defer int32Mu.Unlock()
|
||||
|
||||
r = *(*int32)(unsafe.Pointer(ptr))
|
||||
*(*int32)(unsafe.Pointer(ptr)) &= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_andUint32(t *TLS, ptr uintptr, val uint32, _ int32) (r uint32) {
|
||||
int32Mu.Lock()
|
||||
|
||||
defer int32Mu.Unlock()
|
||||
|
||||
r = *(*uint32)(unsafe.Pointer(ptr))
|
||||
*(*uint32)(unsafe.Pointer(ptr)) &= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_andInt64(t *TLS, ptr uintptr, val int64, _ int32) (r int64) {
|
||||
int64Mu.Lock()
|
||||
|
||||
defer int64Mu.Unlock()
|
||||
|
||||
r = *(*int64)(unsafe.Pointer(ptr))
|
||||
*(*int64)(unsafe.Pointer(ptr)) &= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_andUint64(t *TLS, ptr uintptr, val uint64, _ int32) (r uint64) {
|
||||
int64Mu.Lock()
|
||||
|
||||
defer int64Mu.Unlock()
|
||||
|
||||
r = *(*uint64)(unsafe.Pointer(ptr))
|
||||
*(*uint64)(unsafe.Pointer(ptr)) &= val
|
||||
return r
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
func X__atomic_fetch_orInt8(t *TLS, ptr uintptr, val int8, _ int32) (r int8) {
|
||||
int8Mu.Lock()
|
||||
|
||||
defer int8Mu.Unlock()
|
||||
|
||||
r = *(*int8)(unsafe.Pointer(ptr))
|
||||
*(*int8)(unsafe.Pointer(ptr)) |= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_orUint8(t *TLS, ptr uintptr, val uint8, _ int32) (r uint8) {
|
||||
int8Mu.Lock()
|
||||
|
||||
defer int8Mu.Unlock()
|
||||
|
||||
r = *(*uint8)(unsafe.Pointer(ptr))
|
||||
*(*uint8)(unsafe.Pointer(ptr)) |= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_orInt16(t *TLS, ptr uintptr, val int16, _ int32) (r int16) {
|
||||
int16Mu.Lock()
|
||||
|
||||
defer int16Mu.Unlock()
|
||||
|
||||
r = *(*int16)(unsafe.Pointer(ptr))
|
||||
*(*int16)(unsafe.Pointer(ptr)) |= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_orUint16(t *TLS, ptr uintptr, val uint16, _ int32) (r uint16) {
|
||||
int16Mu.Lock()
|
||||
|
||||
defer int16Mu.Unlock()
|
||||
|
||||
r = *(*uint16)(unsafe.Pointer(ptr))
|
||||
*(*uint16)(unsafe.Pointer(ptr)) |= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_orInt32(t *TLS, ptr uintptr, val int32, _ int32) (r int32) {
|
||||
int32Mu.Lock()
|
||||
|
||||
defer int32Mu.Unlock()
|
||||
|
||||
r = *(*int32)(unsafe.Pointer(ptr))
|
||||
*(*int32)(unsafe.Pointer(ptr)) |= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_orUint32(t *TLS, ptr uintptr, val uint32, _ int32) (r uint32) {
|
||||
int32Mu.Lock()
|
||||
|
||||
defer int32Mu.Unlock()
|
||||
|
||||
r = *(*uint32)(unsafe.Pointer(ptr))
|
||||
*(*uint32)(unsafe.Pointer(ptr)) |= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_orInt64(t *TLS, ptr uintptr, val int64, _ int32) (r int64) {
|
||||
int64Mu.Lock()
|
||||
|
||||
defer int64Mu.Unlock()
|
||||
|
||||
r = *(*int64)(unsafe.Pointer(ptr))
|
||||
*(*int64)(unsafe.Pointer(ptr)) |= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_orUint64(t *TLS, ptr uintptr, val uint64, _ int32) (r uint64) {
|
||||
int64Mu.Lock()
|
||||
|
||||
defer int64Mu.Unlock()
|
||||
|
||||
r = *(*uint64)(unsafe.Pointer(ptr))
|
||||
*(*uint64)(unsafe.Pointer(ptr)) |= val
|
||||
return r
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
func X__atomic_fetch_subInt8(t *TLS, ptr uintptr, val int8, _ int32) (r int8) {
|
||||
int8Mu.Lock()
|
||||
|
||||
defer int8Mu.Unlock()
|
||||
|
||||
r = *(*int8)(unsafe.Pointer(ptr))
|
||||
*(*int8)(unsafe.Pointer(ptr)) -= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_subUint8(t *TLS, ptr uintptr, val uint8, _ int32) (r uint8) {
|
||||
int8Mu.Lock()
|
||||
|
||||
defer int8Mu.Unlock()
|
||||
|
||||
r = *(*uint8)(unsafe.Pointer(ptr))
|
||||
*(*uint8)(unsafe.Pointer(ptr)) -= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_subInt16(t *TLS, ptr uintptr, val int16, _ int32) (r int16) {
|
||||
int16Mu.Lock()
|
||||
|
||||
defer int16Mu.Unlock()
|
||||
|
||||
r = *(*int16)(unsafe.Pointer(ptr))
|
||||
*(*int16)(unsafe.Pointer(ptr)) -= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_subUint16(t *TLS, ptr uintptr, val uint16, _ int32) (r uint16) {
|
||||
int16Mu.Lock()
|
||||
|
||||
defer int16Mu.Unlock()
|
||||
|
||||
r = *(*uint16)(unsafe.Pointer(ptr))
|
||||
*(*uint16)(unsafe.Pointer(ptr)) -= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_subInt32(t *TLS, ptr uintptr, val int32, _ int32) (r int32) {
|
||||
int32Mu.Lock()
|
||||
|
||||
defer int32Mu.Unlock()
|
||||
|
||||
r = *(*int32)(unsafe.Pointer(ptr))
|
||||
*(*int32)(unsafe.Pointer(ptr)) -= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_subUint32(t *TLS, ptr uintptr, val uint32, _ int32) (r uint32) {
|
||||
int32Mu.Lock()
|
||||
|
||||
defer int32Mu.Unlock()
|
||||
|
||||
r = *(*uint32)(unsafe.Pointer(ptr))
|
||||
*(*uint32)(unsafe.Pointer(ptr)) -= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_subInt64(t *TLS, ptr uintptr, val int64, _ int32) (r int64) {
|
||||
int64Mu.Lock()
|
||||
|
||||
defer int64Mu.Unlock()
|
||||
|
||||
r = *(*int64)(unsafe.Pointer(ptr))
|
||||
*(*int64)(unsafe.Pointer(ptr)) -= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_subUint64(t *TLS, ptr uintptr, val uint64, _ int32) (r uint64) {
|
||||
int64Mu.Lock()
|
||||
|
||||
defer int64Mu.Unlock()
|
||||
|
||||
r = *(*uint64)(unsafe.Pointer(ptr))
|
||||
*(*uint64)(unsafe.Pointer(ptr)) -= val
|
||||
return r
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
func X__atomic_fetch_xorInt8(t *TLS, ptr uintptr, val int8, _ int32) (r int8) {
|
||||
int8Mu.Lock()
|
||||
|
||||
defer int8Mu.Unlock()
|
||||
|
||||
r = *(*int8)(unsafe.Pointer(ptr))
|
||||
*(*int8)(unsafe.Pointer(ptr)) ^= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_xorUint8(t *TLS, ptr uintptr, val uint8, _ int32) (r uint8) {
|
||||
int8Mu.Lock()
|
||||
|
||||
defer int8Mu.Unlock()
|
||||
|
||||
r = *(*uint8)(unsafe.Pointer(ptr))
|
||||
*(*uint8)(unsafe.Pointer(ptr)) ^= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_xorInt16(t *TLS, ptr uintptr, val int16, _ int32) (r int16) {
|
||||
int16Mu.Lock()
|
||||
|
||||
defer int16Mu.Unlock()
|
||||
|
||||
r = *(*int16)(unsafe.Pointer(ptr))
|
||||
*(*int16)(unsafe.Pointer(ptr)) ^= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_xorUint16(t *TLS, ptr uintptr, val uint16, _ int32) (r uint16) {
|
||||
int16Mu.Lock()
|
||||
|
||||
defer int16Mu.Unlock()
|
||||
|
||||
r = *(*uint16)(unsafe.Pointer(ptr))
|
||||
*(*uint16)(unsafe.Pointer(ptr)) ^= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_xorInt32(t *TLS, ptr uintptr, val int32, _ int32) (r int32) {
|
||||
int32Mu.Lock()
|
||||
|
||||
defer int32Mu.Unlock()
|
||||
|
||||
r = *(*int32)(unsafe.Pointer(ptr))
|
||||
*(*int32)(unsafe.Pointer(ptr)) ^= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_xorUint32(t *TLS, ptr uintptr, val uint32, _ int32) (r uint32) {
|
||||
int32Mu.Lock()
|
||||
|
||||
defer int32Mu.Unlock()
|
||||
|
||||
r = *(*uint32)(unsafe.Pointer(ptr))
|
||||
*(*uint32)(unsafe.Pointer(ptr)) ^= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_xorInt64(t *TLS, ptr uintptr, val int64, _ int32) (r int64) {
|
||||
int64Mu.Lock()
|
||||
|
||||
defer int64Mu.Unlock()
|
||||
|
||||
r = *(*int64)(unsafe.Pointer(ptr))
|
||||
*(*int64)(unsafe.Pointer(ptr)) ^= val
|
||||
return r
|
||||
}
|
||||
|
||||
func X__atomic_fetch_xorUint64(t *TLS, ptr uintptr, val uint64, _ int32) (r uint64) {
|
||||
int64Mu.Lock()
|
||||
|
||||
defer int64Mu.Unlock()
|
||||
|
||||
r = *(*uint64)(unsafe.Pointer(ptr))
|
||||
*(*uint64)(unsafe.Pointer(ptr)) ^= val
|
||||
return r
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
// void __atomic_exchange (type *ptr, type *val, type *ret, int memorder)
|
||||
|
||||
func X__atomic_exchangeInt8(t *TLS, ptr, val, ret uintptr, _ int32) {
|
||||
int8Mu.Lock()
|
||||
|
||||
defer int8Mu.Unlock()
|
||||
|
||||
*(*int8)(unsafe.Pointer(ret)) = *(*int8)(unsafe.Pointer(ptr))
|
||||
*(*int8)(unsafe.Pointer(ptr)) = *(*int8)(unsafe.Pointer(val))
|
||||
}
|
||||
|
||||
func X__atomic_exchangeUint8(t *TLS, ptr, val, ret uintptr, _ int32) {
|
||||
int8Mu.Lock()
|
||||
|
||||
defer int8Mu.Unlock()
|
||||
|
||||
*(*uint8)(unsafe.Pointer(ret)) = *(*uint8)(unsafe.Pointer(ptr))
|
||||
*(*uint8)(unsafe.Pointer(ptr)) = *(*uint8)(unsafe.Pointer(val))
|
||||
}
|
||||
|
||||
func X__atomic_exchangeInt16(t *TLS, ptr, val, ret uintptr, _ int32) {
|
||||
int16Mu.Lock()
|
||||
|
||||
defer int16Mu.Unlock()
|
||||
|
||||
*(*int16)(unsafe.Pointer(ret)) = *(*int16)(unsafe.Pointer(ptr))
|
||||
*(*int16)(unsafe.Pointer(ptr)) = *(*int16)(unsafe.Pointer(val))
|
||||
}
|
||||
|
||||
func X__atomic_exchangeUint16(t *TLS, ptr, val, ret uintptr, _ int32) {
|
||||
int16Mu.Lock()
|
||||
|
||||
defer int16Mu.Unlock()
|
||||
|
||||
*(*uint16)(unsafe.Pointer(ret)) = *(*uint16)(unsafe.Pointer(ptr))
|
||||
*(*uint16)(unsafe.Pointer(ptr)) = *(*uint16)(unsafe.Pointer(val))
|
||||
}
|
||||
|
||||
func X__atomic_exchangeInt32(t *TLS, ptr, val, ret uintptr, _ int32) {
|
||||
int32Mu.Lock()
|
||||
|
||||
defer int32Mu.Unlock()
|
||||
|
||||
*(*int32)(unsafe.Pointer(ret)) = *(*int32)(unsafe.Pointer(ptr))
|
||||
*(*int32)(unsafe.Pointer(ptr)) = *(*int32)(unsafe.Pointer(val))
|
||||
}
|
||||
|
||||
func X__atomic_exchangeUint32(t *TLS, ptr, val, ret uintptr, _ int32) {
|
||||
int32Mu.Lock()
|
||||
|
||||
defer int32Mu.Unlock()
|
||||
|
||||
*(*uint32)(unsafe.Pointer(ret)) = *(*uint32)(unsafe.Pointer(ptr))
|
||||
*(*uint32)(unsafe.Pointer(ptr)) = *(*uint32)(unsafe.Pointer(val))
|
||||
}
|
||||
|
||||
func X__atomic_exchangeInt64(t *TLS, ptr, val, ret uintptr, _ int32) {
|
||||
int64Mu.Lock()
|
||||
|
||||
defer int64Mu.Unlock()
|
||||
|
||||
*(*int64)(unsafe.Pointer(ret)) = *(*int64)(unsafe.Pointer(ptr))
|
||||
*(*int64)(unsafe.Pointer(ptr)) = *(*int64)(unsafe.Pointer(val))
|
||||
}
|
||||
|
||||
func X__atomic_exchangeUint64(t *TLS, ptr, val, ret uintptr, _ int32) {
|
||||
int64Mu.Lock()
|
||||
|
||||
defer int64Mu.Unlock()
|
||||
|
||||
*(*uint64)(unsafe.Pointer(ret)) = *(*uint64)(unsafe.Pointer(ptr))
|
||||
*(*uint64)(unsafe.Pointer(ptr)) = *(*uint64)(unsafe.Pointer(val))
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
// bool __atomic_compare_exchange (type *ptr, type *expected, type *desired, bool weak, int success_memorder, int failure_memorder)
|
||||
|
||||
// https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html
|
||||
//
|
||||
// This built-in function implements an atomic compare and exchange operation.
|
||||
// This compares the contents of *ptr with the contents of *expected. If equal,
|
||||
// the operation is a read-modify-write operation that writes desired into
|
||||
// *ptr. If they are not equal, the operation is a read and the current
|
||||
// contents of *ptr are written into *expected. weak is true for weak
|
||||
// compare_exchange, which may fail spuriously, and false for the strong
|
||||
// variation, which never fails spuriously. Many targets only offer the strong
|
||||
// variation and ignore the parameter. When in doubt, use the strong variation.
|
||||
//
|
||||
// If desired is written into *ptr then true is returned and memory is affected
|
||||
// according to the memory order specified by success_memorder. There are no
|
||||
// restrictions on what memory order can be used here.
|
||||
//
|
||||
// Otherwise, false is returned and memory is affected according to
|
||||
// failure_memorder. This memory order cannot be __ATOMIC_RELEASE nor
|
||||
// __ATOMIC_ACQ_REL. It also cannot be a stronger order than that specified by
|
||||
// success_memorder.
|
||||
|
||||
func X__atomic_compare_exchangeInt8(t *TLS, ptr, expected, desired uintptr, weak, success, failure int32) int32 {
|
||||
int8Mu.Lock()
|
||||
|
||||
defer int8Mu.Unlock()
|
||||
|
||||
have := *(*int8)(unsafe.Pointer(ptr))
|
||||
if have == *(*int8)(unsafe.Pointer(expected)) {
|
||||
*(*int8)(unsafe.Pointer(ptr)) = *(*int8)(unsafe.Pointer(desired))
|
||||
return 1
|
||||
}
|
||||
|
||||
*(*int8)(unsafe.Pointer(expected)) = have
|
||||
return 0
|
||||
}
|
||||
|
||||
func X__atomic_compare_exchangeUint8(t *TLS, ptr, expected, desired uintptr, weak, success, failure int32) int32 {
|
||||
return X__atomic_compare_exchangeInt8(t, ptr, expected, desired, weak, success, failure)
|
||||
}
|
||||
|
||||
func X__atomic_compare_exchangeInt16(t *TLS, ptr, expected, desired uintptr, weak, success, failure int32) int32 {
|
||||
int16Mu.Lock()
|
||||
|
||||
defer int16Mu.Unlock()
|
||||
|
||||
have := *(*int16)(unsafe.Pointer(ptr))
|
||||
if have == *(*int16)(unsafe.Pointer(expected)) {
|
||||
*(*int16)(unsafe.Pointer(ptr)) = *(*int16)(unsafe.Pointer(desired))
|
||||
return 1
|
||||
}
|
||||
|
||||
*(*int16)(unsafe.Pointer(expected)) = have
|
||||
return 0
|
||||
}
|
||||
|
||||
func X__atomic_compare_exchangeUint16(t *TLS, ptr, expected, desired uintptr, weak, success, failure int32) int32 {
|
||||
return X__atomic_compare_exchangeInt16(t, ptr, expected, desired, weak, success, failure)
|
||||
}
|
||||
|
||||
func X__atomic_compare_exchangeInt32(t *TLS, ptr, expected, desired uintptr, weak, success, failure int32) int32 {
|
||||
int32Mu.Lock()
|
||||
|
||||
defer int32Mu.Unlock()
|
||||
|
||||
have := *(*int32)(unsafe.Pointer(ptr))
|
||||
if have == *(*int32)(unsafe.Pointer(expected)) {
|
||||
*(*int32)(unsafe.Pointer(ptr)) = *(*int32)(unsafe.Pointer(desired))
|
||||
return 1
|
||||
}
|
||||
|
||||
*(*int32)(unsafe.Pointer(expected)) = have
|
||||
return 0
|
||||
}
|
||||
|
||||
func X__atomic_compare_exchangeUint32(t *TLS, ptr, expected, desired uintptr, weak, success, failure int32) int32 {
|
||||
return X__atomic_compare_exchangeInt32(t, ptr, expected, desired, weak, success, failure)
|
||||
}
|
||||
|
||||
func X__atomic_compare_exchangeInt64(t *TLS, ptr, expected, desired uintptr, weak, success, failure int32) int32 {
|
||||
int64Mu.Lock()
|
||||
|
||||
defer int64Mu.Unlock()
|
||||
|
||||
have := *(*int64)(unsafe.Pointer(ptr))
|
||||
if have == *(*int64)(unsafe.Pointer(expected)) {
|
||||
*(*int64)(unsafe.Pointer(ptr)) = *(*int64)(unsafe.Pointer(desired))
|
||||
return 1
|
||||
}
|
||||
|
||||
*(*int64)(unsafe.Pointer(expected)) = have
|
||||
return 0
|
||||
}
|
||||
|
||||
func X__atomic_compare_exchangeUint64(t *TLS, ptr, expected, desired uintptr, weak, success, failure int32) int32 {
|
||||
return X__atomic_compare_exchangeInt64(t, ptr, expected, desired, weak, success, failure)
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
// void __atomic_load (type *ptr, type *ret, int memorder)
|
||||
|
||||
func X__atomic_loadInt8(t *TLS, ptr, ret uintptr, memorder int32) {
|
||||
int8Mu.Lock()
|
||||
|
||||
defer int8Mu.Unlock()
|
||||
|
||||
*(*int8)(unsafe.Pointer(ret)) = *(*int8)(unsafe.Pointer(ptr))
|
||||
}
|
||||
|
||||
func X__atomic_loadUint8(t *TLS, ptr, ret uintptr, memorder int32) {
|
||||
X__atomic_loadInt8(t, ptr, ret, memorder)
|
||||
}
|
||||
|
||||
func X__atomic_loadInt16(t *TLS, ptr, ret uintptr, memorder int32) {
|
||||
int16Mu.Lock()
|
||||
|
||||
defer int16Mu.Unlock()
|
||||
|
||||
*(*int16)(unsafe.Pointer(ret)) = *(*int16)(unsafe.Pointer(ptr))
|
||||
}
|
||||
|
||||
func X__atomic_loadUint16(t *TLS, ptr, ret uintptr, memorder int32) {
|
||||
X__atomic_loadInt16(t, ptr, ret, memorder)
|
||||
}
|
||||
|
||||
func X__atomic_loadInt32(t *TLS, ptr, ret uintptr, memorder int32) {
|
||||
int32Mu.Lock()
|
||||
|
||||
defer int32Mu.Unlock()
|
||||
|
||||
*(*int32)(unsafe.Pointer(ret)) = *(*int32)(unsafe.Pointer(ptr))
|
||||
}
|
||||
|
||||
func X__atomic_loadUint32(t *TLS, ptr, ret uintptr, memorder int32) {
|
||||
X__atomic_loadInt32(t, ptr, ret, memorder)
|
||||
}
|
||||
|
||||
func X__atomic_loadInt64(t *TLS, ptr, ret uintptr, memorder int32) {
|
||||
int64Mu.Lock()
|
||||
|
||||
defer int64Mu.Unlock()
|
||||
|
||||
*(*int64)(unsafe.Pointer(ret)) = *(*int64)(unsafe.Pointer(ptr))
|
||||
}
|
||||
|
||||
func X__atomic_loadUint64(t *TLS, ptr, ret uintptr, memorder int32) {
|
||||
X__atomic_loadInt64(t, ptr, ret, memorder)
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
// void __atomic_store (type *ptr, type *val, int memorder)
|
||||
|
||||
func X__atomic_storeInt8(t *TLS, ptr, val uintptr, memorder int32) {
|
||||
int8Mu.Lock()
|
||||
|
||||
defer int8Mu.Unlock()
|
||||
|
||||
*(*int8)(unsafe.Pointer(ptr)) = *(*int8)(unsafe.Pointer(val))
|
||||
}
|
||||
|
||||
func X__atomic_storeUint8(t *TLS, ptr, val uintptr, memorder int32) {
|
||||
X__atomic_storeInt8(t, ptr, val, memorder)
|
||||
}
|
||||
|
||||
func X__atomic_storeInt16(t *TLS, ptr, val uintptr, memorder int32) {
|
||||
int16Mu.Lock()
|
||||
|
||||
defer int16Mu.Unlock()
|
||||
|
||||
*(*int16)(unsafe.Pointer(ptr)) = *(*int16)(unsafe.Pointer(val))
|
||||
}
|
||||
|
||||
func X__atomic_storeUint16(t *TLS, ptr, val uintptr, memorder int32) {
|
||||
X__atomic_storeInt16(t, ptr, val, memorder)
|
||||
}
|
||||
|
||||
func X__atomic_storeInt32(t *TLS, ptr, val uintptr, memorder int32) {
|
||||
int32Mu.Lock()
|
||||
|
||||
defer int32Mu.Unlock()
|
||||
|
||||
*(*int32)(unsafe.Pointer(ptr)) = *(*int32)(unsafe.Pointer(val))
|
||||
}
|
||||
|
||||
func X__atomic_storeUint32(t *TLS, ptr, val uintptr, memorder int32) {
|
||||
X__atomic_storeInt32(t, ptr, val, memorder)
|
||||
}
|
||||
|
||||
func X__atomic_storeInt64(t *TLS, ptr, val uintptr, memorder int32) {
|
||||
int64Mu.Lock()
|
||||
|
||||
defer int64Mu.Unlock()
|
||||
|
||||
*(*int64)(unsafe.Pointer(ptr)) = *(*int64)(unsafe.Pointer(val))
|
||||
}
|
||||
|
||||
func X__atomic_storeUint64(t *TLS, ptr, val uintptr, memorder int32) {
|
||||
X__atomic_storeInt64(t, ptr, val, memorder)
|
||||
}
|
2
vendor/modernc.org/libc/sync.go
generated
vendored
2
vendor/modernc.org/libc/sync.go
generated
vendored
|
@ -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 || loong64))
|
||||
//go:build !(linux && (amd64 || arm64 || loong64))
|
||||
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
|
|
2
vendor/modernc.org/libc/syscall_musl.go
generated
vendored
2
vendor/modernc.org/libc/syscall_musl.go
generated
vendored
|
@ -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 || loong64)
|
||||
//go:build linux && (amd64 || arm64 || loong64)
|
||||
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
|
|
1
vendor/modernc.org/sqlite/AUTHORS
generated
vendored
1
vendor/modernc.org/sqlite/AUTHORS
generated
vendored
|
@ -26,4 +26,5 @@ Morgan Bazalgette <morgan@howl.moe>
|
|||
Ross Light <ross@zombiezen.com>
|
||||
Saed SayedAhmed <saadmtsa@gmail.com>
|
||||
Steffen Butzer <steffen(dot)butzer@outlook.com>
|
||||
Toni Spets <toni.spets@beeper.com>
|
||||
W. Michael Petullo <mike@flyn.org>
|
||||
|
|
1
vendor/modernc.org/sqlite/CONTRIBUTORS
generated
vendored
1
vendor/modernc.org/sqlite/CONTRIBUTORS
generated
vendored
|
@ -34,5 +34,6 @@ Ross Light <ross@zombiezen.com>
|
|||
Saed SayedAhmed <saadmtsa@gmail.com>
|
||||
Sean McGivern <sean@mcgivern.me.uk>
|
||||
Steffen Butzer <steffen(dot)butzer@outlook.com>
|
||||
Toni Spets <toni.spets@beeper.com>
|
||||
W. Michael Petullo <mike@flyn.org>
|
||||
Yaacov Akiba Slama <ya@slamail.org>
|
||||
|
|
6
vendor/modernc.org/sqlite/Makefile
generated
vendored
6
vendor/modernc.org/sqlite/Makefile
generated
vendored
|
@ -43,8 +43,8 @@ build_all_targets:
|
|||
GOOS=openbsd GOARCH=amd64 go build -v ./...
|
||||
GOOS=openbsd GOARCH=arm64 go test -c -o /dev/null
|
||||
GOOS=openbsd GOARCH=arm64 go build -v ./...
|
||||
# GOOS=windows GOARCH=386 go test -c -o /dev/null
|
||||
# GOOS=windows GOARCH=386 go build -v ./...
|
||||
GOOS=windows GOARCH=386 go test -c -o /dev/null
|
||||
GOOS=windows GOARCH=386 go build -v ./...
|
||||
GOOS=windows GOARCH=amd64 go test -c -o /dev/null
|
||||
GOOS=windows GOARCH=amd64 go build -v ./...
|
||||
GOOS=windows GOARCH=arm64 go test -c -o /dev/null
|
||||
|
@ -66,7 +66,7 @@ editor:
|
|||
go build -o /dev/null vendor_libsqlite3.go
|
||||
|
||||
test:
|
||||
go test -v -timeout 24h . ./functest 2>&1 | tee log-test
|
||||
go test -v -timeout 24h 2>&1 | tee log-test
|
||||
|
||||
vendor:
|
||||
go run vendor_libsqlite3.go && make build_all_targets
|
||||
|
|
2
vendor/modernc.org/sqlite/bind_blob.go
generated
vendored
2
vendor/modernc.org/sqlite/bind_blob.go
generated
vendored
|
@ -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 || loong64))
|
||||
//go:build !(linux && (amd64 || arm64 || loong64))
|
||||
|
||||
package sqlite // import "modernc.org/sqlite"
|
||||
|
||||
|
|
2
vendor/modernc.org/sqlite/bind_blob_musl.go
generated
vendored
2
vendor/modernc.org/sqlite/bind_blob_musl.go
generated
vendored
|
@ -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 || loong64)
|
||||
//go:build linux && (amd64 || arm64 || loong64)
|
||||
|
||||
package sqlite // import "modernc.org/sqlite"
|
||||
|
||||
|
|
4
vendor/modernc.org/sqlite/builder.json
generated
vendored
4
vendor/modernc.org/sqlite/builder.json
generated
vendored
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"autogen": "<none>",
|
||||
"autotag": "darwin/(amd64|arm64)|freebsd/(amd64|arm64)|linux/(386|amd64|arm|arm64|loong64|ppc64le|riscv64|s390x)|windows/(amd64|arm64)",
|
||||
"autotag": "<none>",
|
||||
"autoupdate": "<none>",
|
||||
"test": "darwin/(amd64|arm64)|freebsd/(amd64|arm64)|linux/(386|amd64|arm|arm64|loong64|ppc64le|riscv64|s390x)|windows/(amd64|arm64)"
|
||||
"test": "darwin/(amd64|arm64)|freebsd/(amd64|arm64)|linux/(386|amd64|arm|arm64|loong64|ppc64le|riscv64|s390x)|windows/(amd64|arm64|386)"
|
||||
}
|
||||
|
|
37
vendor/modernc.org/sqlite/doc.go
generated
vendored
37
vendor/modernc.org/sqlite/doc.go
generated
vendored
|
@ -19,20 +19,21 @@
|
|||
//
|
||||
// OS Arch SQLite version
|
||||
// ------------------------------
|
||||
// darwin amd64 3.45.3
|
||||
// darwin arm64 3.45.3
|
||||
// freebsd amd64 3.45.3
|
||||
// freebsd arm64 3.45.3
|
||||
// linux 386 3.45.3
|
||||
// linux amd64 3.45.3
|
||||
// linux arm 3.45.3
|
||||
// linux arm64 3.45.3
|
||||
// linux loong64 3.45.3
|
||||
// linux ppc64le 3.45.3
|
||||
// linux riscv64 3.45.3
|
||||
// linux s390x 3.45.3
|
||||
// windows amd64 3.45.3
|
||||
// windows arm64 3.45.3
|
||||
// darwin amd64 3.46.0
|
||||
// darwin arm64 3.46.0
|
||||
// freebsd amd64 3.46.0
|
||||
// freebsd arm64 3.46.0
|
||||
// linux 386 3.46.0
|
||||
// linux amd64 3.46.0
|
||||
// linux arm 3.46.0
|
||||
// linux arm64 3.46.0
|
||||
// linux loong64 3.46.0
|
||||
// linux ppc64le 3.46.0
|
||||
// linux riscv64 3.46.0
|
||||
// linux s390x 3.46.0
|
||||
// windows 386 3.46.0
|
||||
// windows amd64 3.46.0
|
||||
// windows arm64 3.46.0
|
||||
//
|
||||
// # Builders
|
||||
//
|
||||
|
@ -50,6 +51,14 @@
|
|||
//
|
||||
// # Changelog
|
||||
//
|
||||
// 2024-07-22: v1.31.0
|
||||
//
|
||||
// Support windows/386.
|
||||
//
|
||||
// 2024-06-04: v1.30.0
|
||||
//
|
||||
// Upgrade to SQLite 3.46.0, release notes at https://sqlite.org/releaselog/3_46_0.html.
|
||||
//
|
||||
// 2024-02-13: v1.29.0
|
||||
//
|
||||
// Upgrade to SQLite 3.45.1, release notes at https://sqlite.org/releaselog/3_45_1.html.
|
||||
|
|
47
vendor/modernc.org/sqlite/fcntl.go
generated
vendored
Normal file
47
vendor/modernc.org/sqlite/fcntl.go
generated
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
// Copyright 2024 The Sqlite Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package sqlite // import "modernc.org/sqlite"
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"unsafe"
|
||||
|
||||
"modernc.org/libc"
|
||||
sqlite3 "modernc.org/sqlite/lib"
|
||||
)
|
||||
|
||||
// Access to sqlite3_file_control
|
||||
type FileControl interface {
|
||||
// Set or query SQLITE_FCNTL_PERSIST_WAL, returns set mode or query result
|
||||
FileControlPersistWAL(dbName string, mode int) (int, error)
|
||||
}
|
||||
|
||||
var _ FileControl = (*conn)(nil)
|
||||
|
||||
func (c *conn) FileControlPersistWAL(dbName string, mode int) (int, error) {
|
||||
i32 := int32(mode)
|
||||
pi32 := &i32
|
||||
|
||||
var p runtime.Pinner
|
||||
p.Pin(pi32)
|
||||
defer p.Unpin()
|
||||
|
||||
err := c.fileControl(dbName, sqlite3.SQLITE_FCNTL_PERSIST_WAL, (uintptr)(unsafe.Pointer(pi32)))
|
||||
return int(i32), err
|
||||
}
|
||||
|
||||
func (c *conn) fileControl(dbName string, op int, pArg uintptr) error {
|
||||
zDbName, err := libc.CString(dbName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer c.free(zDbName)
|
||||
|
||||
if rc := sqlite3.Xsqlite3_file_control(c.tls, c.db, zDbName, int32(op), pArg); rc != sqlite3.SQLITE_OK {
|
||||
return c.errstr(rc)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
23107
vendor/modernc.org/sqlite/lib/sqlite_darwin_amd64.go
generated
vendored
23107
vendor/modernc.org/sqlite/lib/sqlite_darwin_amd64.go
generated
vendored
File diff suppressed because one or more lines are too long
23107
vendor/modernc.org/sqlite/lib/sqlite_darwin_arm64.go
generated
vendored
23107
vendor/modernc.org/sqlite/lib/sqlite_darwin_arm64.go
generated
vendored
File diff suppressed because one or more lines are too long
23014
vendor/modernc.org/sqlite/lib/sqlite_freebsd_amd64.go
generated
vendored
23014
vendor/modernc.org/sqlite/lib/sqlite_freebsd_amd64.go
generated
vendored
File diff suppressed because one or more lines are too long
23014
vendor/modernc.org/sqlite/lib/sqlite_freebsd_arm64.go
generated
vendored
23014
vendor/modernc.org/sqlite/lib/sqlite_freebsd_arm64.go
generated
vendored
File diff suppressed because one or more lines are too long
23120
vendor/modernc.org/sqlite/lib/sqlite_linux_386.go
generated
vendored
23120
vendor/modernc.org/sqlite/lib/sqlite_linux_386.go
generated
vendored
File diff suppressed because one or more lines are too long
23018
vendor/modernc.org/sqlite/lib/sqlite_linux_amd64.go
generated
vendored
23018
vendor/modernc.org/sqlite/lib/sqlite_linux_amd64.go
generated
vendored
File diff suppressed because one or more lines are too long
23140
vendor/modernc.org/sqlite/lib/sqlite_linux_arm.go
generated
vendored
23140
vendor/modernc.org/sqlite/lib/sqlite_linux_arm.go
generated
vendored
File diff suppressed because one or more lines are too long
23120
vendor/modernc.org/sqlite/lib/sqlite_linux_arm64.go
generated
vendored
23120
vendor/modernc.org/sqlite/lib/sqlite_linux_arm64.go
generated
vendored
File diff suppressed because one or more lines are too long
23019
vendor/modernc.org/sqlite/lib/sqlite_linux_loong64.go
generated
vendored
23019
vendor/modernc.org/sqlite/lib/sqlite_linux_loong64.go
generated
vendored
File diff suppressed because one or more lines are too long
23120
vendor/modernc.org/sqlite/lib/sqlite_linux_ppc64le.go
generated
vendored
23120
vendor/modernc.org/sqlite/lib/sqlite_linux_ppc64le.go
generated
vendored
File diff suppressed because one or more lines are too long
23120
vendor/modernc.org/sqlite/lib/sqlite_linux_riscv64.go
generated
vendored
23120
vendor/modernc.org/sqlite/lib/sqlite_linux_riscv64.go
generated
vendored
File diff suppressed because one or more lines are too long
23120
vendor/modernc.org/sqlite/lib/sqlite_linux_s390x.go
generated
vendored
23120
vendor/modernc.org/sqlite/lib/sqlite_linux_s390x.go
generated
vendored
File diff suppressed because one or more lines are too long
23167
vendor/modernc.org/sqlite/lib/sqlite_windows.go
generated
vendored
23167
vendor/modernc.org/sqlite/lib/sqlite_windows.go
generated
vendored
File diff suppressed because one or more lines are too long
301020
vendor/modernc.org/sqlite/lib/sqlite_windows_386.go
generated
vendored
Normal file
301020
vendor/modernc.org/sqlite/lib/sqlite_windows_386.go
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
5
vendor/modernc.org/sqlite/vendor_libsqlite3.go
generated
vendored
5
vendor/modernc.org/sqlite/vendor_libsqlite3.go
generated
vendored
|
@ -39,14 +39,15 @@ func main() {
|
|||
{"linux", "ppc64le"},
|
||||
{"linux", "riscv64"},
|
||||
{"linux", "s390x"},
|
||||
{"windows", "386"},
|
||||
{"windows", "amd64"},
|
||||
} {
|
||||
fmt.Printf("%s/%s\n", v.goos, v.goarch)
|
||||
base := fmt.Sprintf("ccgo_%s_%s.go", v.goos, v.goarch)
|
||||
if v.goos == "windows" {
|
||||
if v.goos == "windows" && v.goarch == "amd64" {
|
||||
base = "ccgo_windows.go"
|
||||
}
|
||||
ifn := filepath.Join("..", "libsqlite3", base)
|
||||
fmt.Printf("%s/%s\t%s\n", v.goos, v.goarch, ifn)
|
||||
in, err := os.ReadFile(ifn)
|
||||
if err != nil {
|
||||
fail(1, "%s\n", err)
|
||||
|
|
6
vendor/modules.txt
vendored
6
vendor/modules.txt
vendored
|
@ -1297,7 +1297,7 @@ gopkg.in/yaml.v3
|
|||
# modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6
|
||||
## explicit; go 1.20
|
||||
modernc.org/gc/v3
|
||||
# modernc.org/libc v1.49.3
|
||||
# modernc.org/libc v1.55.3
|
||||
## explicit; go 1.20
|
||||
modernc.org/libc
|
||||
modernc.org/libc/errno
|
||||
|
@ -1331,7 +1331,7 @@ modernc.org/mathutil
|
|||
# modernc.org/memory v1.8.0
|
||||
## explicit; go 1.18
|
||||
modernc.org/memory
|
||||
# modernc.org/sqlite v0.0.0-00010101000000-000000000000 => gitlab.com/NyaaaWhatsUpDoc/sqlite v1.29.9-concurrency-workaround
|
||||
# modernc.org/sqlite v0.0.0-00010101000000-000000000000 => gitlab.com/NyaaaWhatsUpDoc/sqlite v1.33.1-concurrency-workaround
|
||||
## explicit; go 1.20
|
||||
modernc.org/sqlite
|
||||
modernc.org/sqlite/lib
|
||||
|
@ -1344,4 +1344,4 @@ modernc.org/token
|
|||
# mvdan.cc/xurls/v2 v2.5.0
|
||||
## explicit; go 1.19
|
||||
mvdan.cc/xurls/v2
|
||||
# modernc.org/sqlite => gitlab.com/NyaaaWhatsUpDoc/sqlite v1.29.9-concurrency-workaround
|
||||
# modernc.org/sqlite => gitlab.com/NyaaaWhatsUpDoc/sqlite v1.33.1-concurrency-workaround
|
||||
|
|
Loading…
Reference in a new issue