From fb12bbb10b228fddf40ebd0e463d5afcd9299ebb Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Thu, 12 Dec 2024 19:44:53 +0000 Subject: bump ncruces/go-sqlite3 to v0.21.0 (#3621) --- vendor/github.com/ncruces/go-sqlite3/vfs/shm_ofd.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'vendor/github.com/ncruces/go-sqlite3/vfs/shm_ofd.go') diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/shm_ofd.go b/vendor/github.com/ncruces/go-sqlite3/vfs/shm_ofd.go index 75c8fbcfb..d335a85fc 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/shm_ofd.go +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/shm_ofd.go @@ -1,4 +1,4 @@ -//go:build (linux || darwin) && (386 || arm || amd64 || arm64 || riscv64 || ppc64le) && !(sqlite3_flock || sqlite3_dotlk || sqlite3_nosys) +//go:build (linux || darwin) && (386 || arm || amd64 || arm64 || riscv64 || ppc64le) && !(sqlite3_flock || sqlite3_dotlk) package vfs @@ -20,6 +20,7 @@ type vfsShm struct { path string regions []*util.MappedRegion readOnly bool + fileLock bool blocking bool sync.Mutex } @@ -29,10 +30,10 @@ var _ blockingSharedMemory = &vfsShm{} func (s *vfsShm) shmOpen() _ErrorCode { if s.File == nil { f, err := os.OpenFile(s.path, - unix.O_RDWR|unix.O_CREAT|unix.O_NOFOLLOW, 0666) + os.O_RDWR|os.O_CREATE|_O_NOFOLLOW, 0666) if err != nil { f, err = os.OpenFile(s.path, - unix.O_RDONLY|unix.O_CREAT|unix.O_NOFOLLOW, 0666) + os.O_RDONLY|os.O_CREATE|_O_NOFOLLOW, 0666) s.readOnly = true } if err != nil { @@ -40,6 +41,9 @@ func (s *vfsShm) shmOpen() _ErrorCode { } s.File = f } + if s.fileLock { + return _OK + } // Dead man's switch. if lock, rc := osTestLock(s.File, _SHM_DMS, 1); rc != _OK { @@ -64,7 +68,9 @@ func (s *vfsShm) shmOpen() _ErrorCode { return _IOERR_SHMOPEN } } - return osReadLock(s.File, _SHM_DMS, 1, time.Millisecond) + rc := osReadLock(s.File, _SHM_DMS, 1, time.Millisecond) + s.fileLock = rc == _OK + return rc } func (s *vfsShm) shmMap(ctx context.Context, mod api.Module, id, size int32, extend bool) (uint32, _ErrorCode) { -- cgit v1.2.3