summaryrefslogtreecommitdiff
path: root/vendor/github.com/ncruces/go-sqlite3/vfs/os_unix.go
diff options
context:
space:
mode:
authorLibravatar Terin Stock <terinjokes@gmail.com>2025-03-09 17:47:56 +0100
committerLibravatar Terin Stock <terinjokes@gmail.com>2025-03-10 01:59:49 +0100
commit3ac1ee16f377d31a0fb80c8dae28b6239ac4229e (patch)
treef61faa581feaaeaba2542b9f2b8234a590684413 /vendor/github.com/ncruces/go-sqlite3/vfs/os_unix.go
parent[chore] update URLs to forked source (diff)
downloadgotosocial-3ac1ee16f377d31a0fb80c8dae28b6239ac4229e.tar.xz
[chore] remove vendor
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.go76
1 files changed, 0 insertions, 76 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
deleted file mode 100644
index c4f9ba870..000000000
--- a/vendor/github.com/ncruces/go-sqlite3/vfs/os_unix.go
+++ /dev/null
@@ -1,76 +0,0 @@
-//go:build unix
-
-package vfs
-
-import (
- "os"
- "syscall"
-
- "golang.org/x/sys/unix"
-)
-
-const (
- _O_NOFOLLOW = unix.O_NOFOLLOW
- canSyncDirs = true
-)
-
-func osAccess(path string, flags AccessFlag) error {
- var access uint32 // unix.F_OK
- switch flags {
- case ACCESS_READWRITE:
- access = unix.R_OK | unix.W_OK
- case ACCESS_READ:
- access = unix.R_OK
- }
- return unix.Access(path, access)
-}
-
-func osSetMode(file *os.File, modeof string) error {
- fi, err := os.Stat(modeof)
- if err != nil {
- return err
- }
- file.Chmod(fi.Mode())
- if sys, ok := fi.Sys().(*syscall.Stat_t); ok {
- file.Chown(int(sys.Uid), int(sys.Gid))
- }
- 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
-}