diff options
author | 2024-07-05 12:06:03 +0200 | |
---|---|---|
committer | 2024-07-05 12:06:03 +0200 | |
commit | 49009fbd8f3c48d5f1a234a0c9914c128fcd14b4 (patch) | |
tree | 7dd35632592599c51b372e97504ceb270b3daf90 /vendor/github.com/ncruces/go-sqlite3/internal/util/mmap.go | |
parent | [bugfix] Handle ErrHideStatus when preparing timeline statuses (#3071) (diff) | |
download | gotosocial-49009fbd8f3c48d5f1a234a0c9914c128fcd14b4.tar.xz |
[chore] Update ncruces/go-sqlite3 to 0.17 (#3072)
This fixes some linkname shenanigans previous versions of the library
were using. It's now safe to upgrade to Go 1.23 and beyond once they
become available.
Diffstat (limited to 'vendor/github.com/ncruces/go-sqlite3/internal/util/mmap.go')
-rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/internal/util/mmap.go | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/vendor/github.com/ncruces/go-sqlite3/internal/util/mmap.go b/vendor/github.com/ncruces/go-sqlite3/internal/util/mmap.go index a4fa2a25a..434cc12ad 100644 --- a/vendor/github.com/ncruces/go-sqlite3/internal/util/mmap.go +++ b/vendor/github.com/ncruces/go-sqlite3/internal/util/mmap.go @@ -46,7 +46,7 @@ func (s *mmapState) new(ctx context.Context, mod api.Module, size int32) *Mapped // Save the newly allocated region. ptr := uint32(stack[0]) buf := View(mod, ptr, uint64(size)) - addr := uintptr(unsafe.Pointer(&buf[0])) + addr := unsafe.Pointer(&buf[0]) s.regions = append(s.regions, &MappedRegion{ Ptr: ptr, addr: addr, @@ -56,7 +56,7 @@ func (s *mmapState) new(ctx context.Context, mod api.Module, size int32) *Mapped } type MappedRegion struct { - addr uintptr + addr unsafe.Pointer Ptr uint32 size int32 used bool @@ -76,23 +76,15 @@ func (r *MappedRegion) Unmap() error { // We can't munmap the region, otherwise it could be remaped. // Instead, convert it to a protected, private, anonymous mapping. // If successful, it can be reused for a subsequent mmap. - _, err := mmap(r.addr, uintptr(r.size), - unix.PROT_NONE, unix.MAP_PRIVATE|unix.MAP_ANON|unix.MAP_FIXED, - -1, 0) + _, err := unix.MmapPtr(-1, 0, r.addr, uintptr(r.size), + unix.PROT_NONE, unix.MAP_PRIVATE|unix.MAP_FIXED|unix.MAP_ANON) r.used = err != nil return err } func (r *MappedRegion) mmap(f *os.File, offset int64, prot int) error { - _, err := mmap(r.addr, uintptr(r.size), - prot, unix.MAP_SHARED|unix.MAP_FIXED, - int(f.Fd()), offset) + _, err := unix.MmapPtr(int(f.Fd()), offset, r.addr, uintptr(r.size), + prot, unix.MAP_SHARED|unix.MAP_FIXED) r.used = err == nil return err } - -// We need the low level mmap for MAP_FIXED to work. -// Bind the syscall version hoping that it is more stable. - -//go:linkname mmap syscall.mmap -func mmap(addr, length uintptr, prot, flag, fd int, pos int64) (*byte, error) |