diff options
author | 2025-03-09 17:47:56 +0100 | |
---|---|---|
committer | 2025-03-10 01:59:49 +0100 | |
commit | 3ac1ee16f377d31a0fb80c8dae28b6239ac4229e (patch) | |
tree | f61faa581feaaeaba2542b9f2b8234a590684413 /vendor/github.com/ncruces/go-sqlite3/internal/util/mmap_windows.go | |
parent | [chore] update URLs to forked source (diff) | |
download | gotosocial-3ac1ee16f377d31a0fb80c8dae28b6239ac4229e.tar.xz |
[chore] remove vendor
Diffstat (limited to 'vendor/github.com/ncruces/go-sqlite3/internal/util/mmap_windows.go')
-rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/internal/util/mmap_windows.go | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/vendor/github.com/ncruces/go-sqlite3/internal/util/mmap_windows.go b/vendor/github.com/ncruces/go-sqlite3/internal/util/mmap_windows.go deleted file mode 100644 index 913a5f733..000000000 --- a/vendor/github.com/ncruces/go-sqlite3/internal/util/mmap_windows.go +++ /dev/null @@ -1,51 +0,0 @@ -package util - -import ( - "context" - "os" - "reflect" - "unsafe" - - "github.com/tetratelabs/wazero/api" - "golang.org/x/sys/windows" -) - -type MappedRegion struct { - windows.Handle - Data []byte - addr uintptr -} - -func MapRegion(ctx context.Context, mod api.Module, f *os.File, offset int64, size int32) (*MappedRegion, error) { - h, err := windows.CreateFileMapping(windows.Handle(f.Fd()), nil, windows.PAGE_READWRITE, 0, 0, nil) - if h == 0 { - return nil, err - } - - a, err := windows.MapViewOfFile(h, windows.FILE_MAP_WRITE, - uint32(offset>>32), uint32(offset), uintptr(size)) - if a == 0 { - windows.CloseHandle(h) - return nil, err - } - - ret := &MappedRegion{Handle: h, addr: a} - // SliceHeader, although deprecated, avoids a go vet warning. - sh := (*reflect.SliceHeader)(unsafe.Pointer(&ret.Data)) - sh.Len = int(size) - sh.Cap = int(size) - sh.Data = a - return ret, nil -} - -func (r *MappedRegion) Unmap() error { - if r.Data == nil { - return nil - } - err := windows.UnmapViewOfFile(r.addr) - if err != nil { - return err - } - r.Data = nil - return windows.CloseHandle(r.Handle) -} |