summaryrefslogtreecommitdiff
path: root/vendor/github.com/ncruces/go-sqlite3/vfs/os_unix.go
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2024-09-30 12:46:23 +0200
committerLibravatar GitHub <noreply@github.com>2024-09-30 12:46:23 +0200
commit188d28f054dbc9d8897a99d2213d8895922fc330 (patch)
tree2691665ad2e129ed7a07ea468024cc7db5005a54 /vendor/github.com/ncruces/go-sqlite3/vfs/os_unix.go
parent[bugfix] Carry-over "PinnedAt" when refreshing status (#3373) (diff)
downloadgotosocial-188d28f054dbc9d8897a99d2213d8895922fc330.tar.xz
[chore]: Bump github.com/ncruces/go-sqlite3 from 0.18.3 to 0.18.4 (#3375)
Bumps [github.com/ncruces/go-sqlite3](https://github.com/ncruces/go-sqlite3) from 0.18.3 to 0.18.4. - [Release notes](https://github.com/ncruces/go-sqlite3/releases) - [Commits](https://github.com/ncruces/go-sqlite3/compare/v0.18.3...v0.18.4) --- updated-dependencies: - dependency-name: github.com/ncruces/go-sqlite3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/github.com/ncruces/go-sqlite3/vfs/os_unix.go')
-rw-r--r--vendor/github.com/ncruces/go-sqlite3/vfs/os_unix.go38
1 files changed, 38 insertions, 0 deletions
diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/os_unix.go b/vendor/github.com/ncruces/go-sqlite3/vfs/os_unix.go
index bf4b44efd..111af799a 100644
--- a/vendor/github.com/ncruces/go-sqlite3/vfs/os_unix.go
+++ b/vendor/github.com/ncruces/go-sqlite3/vfs/os_unix.go
@@ -31,3 +31,41 @@ func osSetMode(file *os.File, modeof string) error {
}
return nil
}
+
+func osTestLock(file *os.File, start, len int64) (int16, _ErrorCode) {
+ lock := unix.Flock_t{
+ Type: unix.F_WRLCK,
+ Start: start,
+ Len: len,
+ }
+ if unix.FcntlFlock(file.Fd(), unix.F_GETLK, &lock) != nil {
+ return 0, _IOERR_CHECKRESERVEDLOCK
+ }
+ return lock.Type, _OK
+}
+
+func osLockErrorCode(err error, def _ErrorCode) _ErrorCode {
+ if err == nil {
+ return _OK
+ }
+ if errno, ok := err.(unix.Errno); ok {
+ switch errno {
+ case
+ unix.EACCES,
+ unix.EAGAIN,
+ unix.EBUSY,
+ unix.EINTR,
+ unix.ENOLCK,
+ unix.EDEADLK,
+ unix.ETIMEDOUT:
+ return _BUSY
+ case unix.EPERM:
+ return _PERM
+ }
+ // notest // usually EWOULDBLOCK == EAGAIN
+ if errno == unix.EWOULDBLOCK && unix.EWOULDBLOCK != unix.EAGAIN {
+ return _BUSY
+ }
+ }
+ return def
+}