// Code generated by modernc.org/undup from the per-target sqlite_*.go files; DO NOT EDIT. //go:build (netbsd && amd64) || (openbsd && amd64) || (openbsd && arm64) package sqlite3 import ( "unsafe" "modernc.org/libc" ) const CHAR_BIT = 8 const CLOCKS_PER_SEC = 100 const CLOCK_MONOTONIC = 3 const DL_GETERRNO = 1 const DL_LAZY = 1 const INT_MAX = 2147483647 const INT_MIN = -2147483648 const IOCPARM_MAX = 0 const LLONG_MAX = 9223372036854775807 const LLONG_MIN = -9223372036854775808 const LONG_BIT = 64 const LONG_MAX = 9223372036854775807 const LONG_MIN = -9223372036854775808 const MADV_FREE = 6 const MADV_SPACEAVAIL = 5 const MAP_INHERIT_COPY = 1 const MAP_INHERIT_NONE = 2 const MAP_INHERIT_SHARE = 0 const QUAD_MAX = 9223372036854775807 const QUAD_MIN = -9223372036854775808 const SCHAR_MAX = 127 const SCHAR_MIN = -128 const SHRT_MAX = 32767 const SHRT_MIN = -32768 const SIZE_T_MAX = 18446744073709551615 const STRIPDISC = 6 const TIOCFLAG_CLOCAL = 2 const TIOCFLAG_CRTSCTS = 4 const TIOCFLAG_MDMBUF = 8 const TIOCFLAG_SOFTCAR = 1 type Tcpuid_t = uint64 type Tqdiv_t = struct { Fquot Tquad_t Frem Tquad_t } type Ttimer_t = int32 type Tunchar = uint8 // C documentation // // /* // ** The unixFile structure is subclass of sqlite3_file specific to the unix // ** VFS implementations. // */ type TunixFile = struct { FpMethod uintptr FpVfs uintptr FpInode uintptr Fh int32 FeFileLock uint8 FctrlFlags uint16 FlastErrno int32 FlockingContext uintptr FpPreallocatedUnused uintptr FzPath uintptr FpShm uintptr FszChunk int32 FsectorSize int32 FdeviceCharacteristics int32 } const UCHAR_MAX = 255 const UINT_MAX = 4294967295 const ULLONG_MAX = 18446744073709551615 const ULONG_MAX = 18446744073709551615 const UQUAD_MAX = 18446744073709551615 const USHRT_MAX = 65535 const WORD_BIT = 32 const _BIG_ENDIAN = 4321 const _LITTLE_ENDIAN = 1234 const _SC_FSYNC = 29 const _SC_PAGESIZE = 28 const _SC_PAGE_SIZE = 28 const _SC_XOPEN_SHM = 30 const __BEGIN_DECLS = 0 const __BEGIN_HIDDEN_DECLS = 0 const __BEGIN_PUBLIC_DECLS = 0 const __END_DECLS = 0 const __END_HIDDEN_DECLS = 0 const __END_PUBLIC_DECLS = 0 // C documentation // // /* // ** This function performs the parts of the "close file" operation // ** common to all locking schemes. It closes the directory and file // ** handles, if they are valid, and sets all fields of the unixFile // ** structure to 0. // ** // ** It is *not* necessary to hold the mutex when this routine is called, // ** even on VxWorks. A mutex will be acquired on VxWorks by the // ** vxworksReleaseFileId() routine. // */ func _closeUnixFile(tls *libc.TLS, id uintptr) (r int32) { var pFile uintptr _ = pFile pFile = id if (*TunixFile)(unsafe.Pointer(pFile)).Fh >= 0 { _robust_close(tls, pFile, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(42509)) (*TunixFile)(unsafe.Pointer(pFile)).Fh = -int32(1) } Xsqlite3_free(tls, (*TunixFile)(unsafe.Pointer(pFile)).FpPreallocatedUnused) libc.Xmemset(tls, pFile, 0, uint64(88)) return SQLITE_OK } // C documentation // // /* // ** Lower the locking level on file descriptor pFile to eFileLock. eFileLock // ** must be either NO_LOCK or SHARED_LOCK. // ** // ** If the locking level of the file descriptor is already at or below // ** the requested locking level, this routine is a no-op. // ** // ** When the locking level reaches NO_LOCK, delete the lock file. // */ func _dotlockUnlock(tls *libc.TLS, id uintptr, eFileLock int32) (r int32) { var pFile, zLockFile uintptr var rc, tErrno int32 _, _, _, _ = pFile, rc, tErrno, zLockFile pFile = id zLockFile = (*TunixFile)(unsafe.Pointer(pFile)).FlockingContext /* no-op if possible */ if libc.Int32FromUint8((*TunixFile)(unsafe.Pointer(pFile)).FeFileLock) == eFileLock { return SQLITE_OK } /* To downgrade to shared, simply update our internal notion of the ** lock state. No need to mess with the file on disk. */ if eFileLock == int32(SHARED_LOCK) { (*TunixFile)(unsafe.Pointer(pFile)).FeFileLock = uint8(SHARED_LOCK) return SQLITE_OK } /* To fully unlock the database, delete the lock file */ rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(19)].FpCurrent})))(tls, zLockFile) if rc < 0 { tErrno = **(**int32)(__ccgo_up(libc.X__errno(tls))) if tErrno == int32(ENOENT) { rc = SQLITE_OK } else { rc = libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(8)< int32(SHARED_LOCK) { reserved = int32(1) } /* Otherwise see if some other process holds it. */ if !(reserved != 0) && !((*TunixInodeInfo)(unsafe.Pointer((*TunixFile)(unsafe.Pointer(pFile)).FpInode)).FbProcessLock != 0) { (**(**Tflock)(__ccgo_up(bp))).Fl_whence = SEEK_SET (**(**Tflock)(__ccgo_up(bp))).Fl_start = int64(_sqlite3PendingByte + libc.Int32FromInt32(1)) (**(**Tflock)(__ccgo_up(bp))).Fl_len = int64(1) (**(**Tflock)(__ccgo_up(bp))).Fl_type = int16(F_WRLCK) if (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(7)].FpCurrent})))(tls, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(F_GETLK), libc.VaList(bp+32, bp)) != 0 { rc = libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(14)<iBusyTimeout ** value is set, then it is the number of milliseconds to wait before ** failing the lock. The iBusyTimeout value is always reset back to ** zero on each call. ** ** If SQLITE_ENABLE_SETLK_TIMEOUT is not defined, then do a non-blocking ** attempt to set the lock. */ // C documentation // // /* // ** Use F_GETLK to check whether or not there are any readers with open // ** wal-mode transactions in other processes on database file pFile. If // ** no error occurs, return SQLITE_OK and set (*piOut) to 1 if there are // ** such transactions, or 0 otherwise. If an error occurs, return an // ** SQLite error code. The final value of *piOut is undefined in this // ** case. // */ func _unixFcntlExternalReader(tls *libc.TLS, pFile uintptr, piOut uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var pShmNode uintptr var rc int32 var _ /* f at bp+0 */ Tflock _, _ = pShmNode, rc rc = SQLITE_OK **(**int32)(__ccgo_up(piOut)) = 0 if (*TunixFile)(unsafe.Pointer(pFile)).FpShm != 0 { pShmNode = (*TunixShm)(unsafe.Pointer((*TunixFile)(unsafe.Pointer(pFile)).FpShm)).FpShmNode libc.Xmemset(tls, bp, 0, uint64(24)) (**(**Tflock)(__ccgo_up(bp))).Fl_type = int16(F_WRLCK) (**(**Tflock)(__ccgo_up(bp))).Fl_whence = SEEK_SET (**(**Tflock)(__ccgo_up(bp))).Fl_start = int64((libc.Int32FromInt32(22)+libc.Int32FromInt32(SQLITE_SHM_NLOCK))*libc.Int32FromInt32(4) + libc.Int32FromInt32(3)) (**(**Tflock)(__ccgo_up(bp))).Fl_len = int64(libc.Int32FromInt32(SQLITE_SHM_NLOCK) - libc.Int32FromInt32(3)) Xsqlite3_mutex_enter(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FpShmMutex) if (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(7)].FpCurrent})))(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int32(F_GETLK), libc.VaList(bp+32, bp)) < 0 { rc = libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(15)< 0x40000200 ** ** This works well on the local file system, but shows a nearly 100x ** slowdown in read performance on AFP because the AFP client disables ** the read cache when byte-range locks are present. Enabling the read ** cache exposes a cache coherency problem that is present on all OS X ** supported network file systems. NFS and AFP both observe the ** close-to-open semantics for ensuring cache coherency ** [http://nfs.sourceforge.net/#faq_a8], which does not effectively ** address the requirements for concurrent database access by multiple ** readers and writers ** [http://www.nabble.com/SQLite-on-NFS-cache-coherency-td15655701.html]. ** ** To address the performance and cache coherency issues, proxy file locking ** changes the way database access is controlled by limiting access to a ** single host at a time and moving file locks off of the database file ** and onto a proxy file on the local file system. ** ** ** Using proxy locks ** ----------------- ** ** C APIs ** ** sqlite3_file_control(db, dbname, SQLITE_FCNTL_SET_LOCKPROXYFILE, ** | ":auto:"); ** sqlite3_file_control(db, dbname, SQLITE_FCNTL_GET_LOCKPROXYFILE, ** &); ** ** ** SQL pragmas ** ** PRAGMA [database.]lock_proxy_file= | :auto: ** PRAGMA [database.]lock_proxy_file ** ** Specifying ":auto:" means that if there is a conch file with a matching ** host ID in it, the proxy path in the conch file will be used, otherwise ** a proxy path based on the user's temp dir ** (via confstr(_CS_DARWIN_USER_TEMP_DIR,...)) will be used and the ** actual proxy file name is generated from the name and path of the ** database file. For example: ** ** For database path "/Users/me/foo.db" ** The lock path will be "/sqliteplocks/_Users_me_foo.db:auto:") ** ** Once a lock proxy is configured for a database connection, it can not ** be removed, however it may be switched to a different proxy path via ** the above APIs (assuming the conch file is not being held by another ** connection or process). ** ** ** How proxy locking works ** ----------------------- ** ** Proxy file locking relies primarily on two new supporting files: ** ** * conch file to limit access to the database file to a single host ** at a time ** ** * proxy file to act as a proxy for the advisory locks normally ** taken on the database ** ** The conch file - to use a proxy file, sqlite must first "hold the conch" ** by taking an sqlite-style shared lock on the conch file, reading the ** contents and comparing the host's unique host ID (see below) and lock ** proxy path against the values stored in the conch. The conch file is ** stored in the same directory as the database file and the file name ** is patterned after the database file name as ".-conch". ** If the conch file does not exist, or its contents do not match the ** host ID and/or proxy path, then the lock is escalated to an exclusive ** lock and the conch file contents is updated with the host ID and proxy ** path and the lock is downgraded to a shared lock again. If the conch ** is held by another process (with a shared lock), the exclusive lock ** will fail and SQLITE_BUSY is returned. ** ** The proxy file - a single-byte file used for all advisory file locks ** normally taken on the database file. This allows for safe sharing ** of the database file for multiple readers and writers on the same ** host (the conch ensures that they all use the same local lock file). ** ** Requesting the lock proxy does not immediately take the conch, it is ** only taken when the first request to lock database file is made. ** This matches the semantics of the traditional locking behavior, where ** opening a connection to a database file does not take a lock on it. ** The shared lock and an open file descriptor are maintained until ** the connection to the database is closed. ** ** The proxy file and the lock file are never deleted so they only need ** to be created the first time they are used. ** ** Configuration options ** --------------------- ** ** SQLITE_PREFER_PROXY_LOCKING ** ** Database files accessed on non-local file systems are ** automatically configured for proxy locking, lock files are ** named automatically using the same logic as ** PRAGMA lock_proxy_file=":auto:" ** ** SQLITE_PROXY_DEBUG ** ** Enables the logging of error messages during host id file ** retrieval and creation ** ** LOCKPROXYDIR ** ** Overrides the default directory used for lock proxy files that ** are named automatically via the ":auto:" setting ** ** SQLITE_DEFAULT_PROXYDIR_PERMISSIONS ** ** Permissions to use when creating a directory for storing the ** lock proxy files, only used when LOCKPROXYDIR is not set. ** ** ** As mentioned above, when compiled with SQLITE_PREFER_PROXY_LOCKING, ** setting the environment variable SQLITE_FORCE_PROXY_LOCKING to 1 will ** force proxy locking to be used for every database file opened, and 0 ** will force automatic proxy locking to be disabled for all database ** files (explicitly calling the SQLITE_FCNTL_SET_LOCKPROXYFILE pragma or ** sqlite_file_control API is not affected by SQLITE_FORCE_PROXY_LOCKING). */ /* ** Proxy locking is only available on MacOSX */ /* ** The proxy locking style is intended for use with AFP filesystems. ** And since AFP is only supported on MacOSX, the proxy locking is also ** restricted to MacOSX. ** ** ******************* End of the proxy lock implementation ********************** ******************************************************************************/ // C documentation // // /* // ** If pFile has a -shm file open and it is sharing that file with some // ** other connection, either in the same process or in a separate process, // ** then return true. Return false if either pFile does not have a -shm // ** file open or if it is the only connection to that -shm file across the // ** entire system. // ** // ** This routine is not required for correct operation. It can always return // ** false and SQLite will continue to operate according to spec. However, // ** when this routine does its job, it adds extra robustness in cases // ** where database file locks have been erroneously deleted in a WAL-mode // ** database by doing close(open(DATABASE_PATHNAME)) or similar. // ** // ** With false negatives, SQLite still operates to spec, though with less // ** robustness. With false positives, the last database connection on a // ** WAL-mode database will fail to unlink the -wal and -shm files, which // ** is annoying but harmless. False positives will also prevent a database // ** connection from running "PRAGMA journal_mode=DELETE" in order to take // ** the database out of WAL mode, which is perhaps more serious, but is // ** still not a disaster. // */ func _unixIsSharingShmNode(tls *libc.TLS, pFile uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var pShmNode uintptr var _ /* lock at bp+0 */ Tflock _ = pShmNode if (*TunixFile)(unsafe.Pointer(pFile)).FpShm == uintptr(0) { return 0 } if libc.Int32FromUint16((*TunixFile)(unsafe.Pointer(pFile)).FctrlFlags)&int32(UNIXFILE_EXCL) != 0 { return 0 } pShmNode = (*TunixShm)(unsafe.Pointer((*TunixFile)(unsafe.Pointer(pFile)).FpShm)).FpShmNode libc.Xmemset(tls, bp, 0, uint64(24)) (**(**Tflock)(__ccgo_up(bp))).Fl_whence = SEEK_SET (**(**Tflock)(__ccgo_up(bp))).Fl_start = int64((libc.Int32FromInt32(22)+libc.Int32FromInt32(SQLITE_SHM_NLOCK))*libc.Int32FromInt32(4) + libc.Int32FromInt32(SQLITE_SHM_NLOCK)) (**(**Tflock)(__ccgo_up(bp))).Fl_len = int64(1) (**(**Tflock)(__ccgo_up(bp))).Fl_type = int16(F_WRLCK) (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(7)].FpCurrent})))(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int32(F_GETLK), libc.VaList(bp+32, bp)) return libc.BoolInt32(int32((**(**Tflock)(__ccgo_up(bp))).Fl_type) != int32(F_UNLCK)) } // C documentation // // /* // ** Lock the file with the lock specified by parameter eFileLock - one // ** of the following: // ** // ** (1) SHARED_LOCK // ** (2) RESERVED_LOCK // ** (3) PENDING_LOCK // ** (4) EXCLUSIVE_LOCK // ** // ** Sometimes when requesting one lock state, additional lock states // ** are inserted in between. The locking might fail on one of the later // ** transitions leaving the lock state different from what it started but // ** still short of its goal. The following chart shows the allowed // ** transitions and the inserted intermediate states: // ** // ** UNLOCKED -> SHARED // ** SHARED -> RESERVED // ** SHARED -> EXCLUSIVE // ** RESERVED -> (PENDING) -> EXCLUSIVE // ** PENDING -> EXCLUSIVE // ** // ** This routine will only increase a lock. Use the sqlite3OsUnlock() // ** routine to lower a locking level. // */ func _unixLock(tls *libc.TLS, id uintptr, eFileLock int32) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var pFile, pInode uintptr var rc, tErrno, v1 int32 var _ /* lock at bp+0 */ Tflock _, _, _, _, _ = pFile, pInode, rc, tErrno, v1 /* The following describes the implementation of the various locks and ** lock transitions in terms of the POSIX advisory shared and exclusive ** lock primitives (called read-locks and write-locks below, to avoid ** confusion with SQLite lock names). The algorithms are complicated ** slightly in order to be compatible with Windows95 systems simultaneously ** accessing the same database file, in case that is ever required. ** ** Symbols defined in os.h identify the 'pending byte' and the 'reserved ** byte', each single bytes at well known offsets, and the 'shared byte ** range', a range of 510 bytes at a well known offset. ** ** To obtain a SHARED lock, a read-lock is obtained on the 'pending ** byte'. If this is successful, 'shared byte range' is read-locked ** and the lock on the 'pending byte' released. (Legacy note: When ** SQLite was first developed, Windows95 systems were still very common, ** and Windows95 lacks a shared-lock capability. So on Windows95, a ** single randomly selected by from the 'shared byte range' is locked. ** Windows95 is now pretty much extinct, but this work-around for the ** lack of shared-locks on Windows95 lives on, for backwards ** compatibility.) ** ** A process may only obtain a RESERVED lock after it has a SHARED lock. ** A RESERVED lock is implemented by grabbing a write-lock on the ** 'reserved byte'. ** ** An EXCLUSIVE lock may only be requested after either a SHARED or ** RESERVED lock is held. An EXCLUSIVE lock is implemented by obtaining ** a write-lock on the entire 'shared byte range'. Since all other locks ** require a read-lock on one of the bytes within this range, this ensures ** that no other locks are held on the database. ** ** If a process that holds a RESERVED lock requests an EXCLUSIVE, then ** a PENDING lock is obtained first. A PENDING lock is implemented by ** obtaining a write-lock on the 'pending byte'. This ensures that no new ** SHARED locks can be obtained, but existing SHARED locks are allowed to ** persist. If the call to this function fails to obtain the EXCLUSIVE ** lock in this case, it holds the PENDING lock instead. The client may ** then re-attempt the EXCLUSIVE lock later on, after existing SHARED ** locks have cleared. */ rc = SQLITE_OK pFile = id tErrno = 0 /* If there is already a lock of this type or more restrictive on the ** unixFile, do nothing. Don't use the end_lock: exit path, as ** unixEnterMutex() hasn't been called yet. */ if libc.Int32FromUint8((*TunixFile)(unsafe.Pointer(pFile)).FeFileLock) >= eFileLock { return SQLITE_OK } /* Make sure the locking sequence is correct. ** (1) We never move from unlocked to anything higher than shared lock. ** (2) SQLite never explicitly requests a pending lock. ** (3) A shared lock is always held when a reserve lock is requested. */ /* This mutex is needed because pFile->pInode is shared across threads */ pInode = (*TunixFile)(unsafe.Pointer(pFile)).FpInode Xsqlite3_mutex_enter(tls, (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) /* If some thread using this PID has a lock via a different unixFile* ** handle that precludes the requested lock, return BUSY. */ if libc.Int32FromUint8((*TunixFile)(unsafe.Pointer(pFile)).FeFileLock) != libc.Int32FromUint8((*TunixInodeInfo)(unsafe.Pointer(pInode)).FeFileLock) && (libc.Int32FromUint8((*TunixInodeInfo)(unsafe.Pointer(pInode)).FeFileLock) >= int32(PENDING_LOCK) || eFileLock > int32(SHARED_LOCK)) { rc = int32(SQLITE_BUSY) goto end_lock } /* If a SHARED lock is requested, and some thread using this PID already ** has a SHARED or RESERVED lock, then increment reference counts and ** return SQLITE_OK. */ if eFileLock == int32(SHARED_LOCK) && (libc.Int32FromUint8((*TunixInodeInfo)(unsafe.Pointer(pInode)).FeFileLock) == int32(SHARED_LOCK) || libc.Int32FromUint8((*TunixInodeInfo)(unsafe.Pointer(pInode)).FeFileLock) == int32(RESERVED_LOCK)) { (*TunixFile)(unsafe.Pointer(pFile)).FeFileLock = uint8(SHARED_LOCK) (*TunixInodeInfo)(unsafe.Pointer(pInode)).FnShared = (*TunixInodeInfo)(unsafe.Pointer(pInode)).FnShared + 1 (*TunixInodeInfo)(unsafe.Pointer(pInode)).FnLock = (*TunixInodeInfo)(unsafe.Pointer(pInode)).FnLock + 1 goto end_lock } /* A PENDING lock is needed before acquiring a SHARED lock and before ** acquiring an EXCLUSIVE lock. For the SHARED lock, the PENDING will ** be released. */ (**(**Tflock)(__ccgo_up(bp))).Fl_len = int64(1) (**(**Tflock)(__ccgo_up(bp))).Fl_whence = SEEK_SET if eFileLock == int32(SHARED_LOCK) || eFileLock == int32(EXCLUSIVE_LOCK) && libc.Int32FromUint8((*TunixFile)(unsafe.Pointer(pFile)).FeFileLock) == int32(RESERVED_LOCK) { if eFileLock == int32(SHARED_LOCK) { v1 = int32(F_RDLCK) } else { v1 = int32(F_WRLCK) } (**(**Tflock)(__ccgo_up(bp))).Fl_type = int16(v1) (**(**Tflock)(__ccgo_up(bp))).Fl_start = int64(_sqlite3PendingByte) if _unixFileLock(tls, pFile, bp) != 0 { tErrno = **(**int32)(__ccgo_up(libc.X__errno(tls))) rc = _sqliteErrorFromPosixError(tls, tErrno, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(15)< int32(1) { /* We are trying for an exclusive lock but another thread in this ** same process is still holding a shared lock. */ rc = int32(SQLITE_BUSY) } else { if _unixIsSharingShmNode(tls, pFile) != 0 { /* We are in WAL mode and attempting to delete the SHM and WAL ** files due to closing the connection or changing out of WAL mode, ** but another process still holds locks on the SHM file, thus ** indicating that database locks have been broken, perhaps due ** to a rogue close(open(dbFile)) or similar. */ rc = int32(SQLITE_BUSY) } else { /* The request was for a RESERVED or EXCLUSIVE lock. It is ** assumed that there is a SHARED or greater lock on the file ** already. */ (**(**Tflock)(__ccgo_up(bp))).Fl_type = int16(F_WRLCK) if eFileLock == int32(RESERVED_LOCK) { (**(**Tflock)(__ccgo_up(bp))).Fl_start = int64(_sqlite3PendingByte + libc.Int32FromInt32(1)) (**(**Tflock)(__ccgo_up(bp))).Fl_len = int64(1) } else { (**(**Tflock)(__ccgo_up(bp))).Fl_start = int64(_sqlite3PendingByte + libc.Int32FromInt32(2)) (**(**Tflock)(__ccgo_up(bp))).Fl_len = int64(SHARED_SIZE) } if _unixFileLock(tls, pFile, bp) != 0 { tErrno = **(**int32)(__ccgo_up(libc.X__errno(tls))) rc = _sqliteErrorFromPosixError(tls, tErrno, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(15)<lastErrno has been set by seekAndRead(). ** Usually we return SQLITE_IOERR_READ here, though for some ** kinds of errors we return SQLITE_IOERR_CORRUPTFS. The ** SQLITE_IOERR_CORRUPTFS will be converted into SQLITE_CORRUPT ** prior to returning to the application by the sqlite3ApiExit() ** routine. */ switch (*TunixFile)(unsafe.Pointer(pFile)).FlastErrno { case int32(ERANGE): fallthrough case int32(EIO): fallthrough case int32(ENXIO): return libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(33)<