// Code generated by modernc.org/undup from the per-target sqlite_*.go files; DO NOT EDIT. //go:build (freebsd && amd64) || (freebsd && arm) || (freebsd && arm64) package sqlite3 import ( "unsafe" "modernc.org/libc" ) const CLOCK_BOOTTIME = 4 const CLOCK_TAI = 16 const CLOSE_RANGE_CLOFORK = 8 const COPY_FILE_RANGE_CLONE = 8388608 const COPY_FILE_RANGE_USERFLAGS = 8388608 const FD_RESOLVE_BENEATH = 2 const F_DUP3FD = 24 const F_DUP3FD_SHIFT = 16 const F_DUPFD_CLOFORK = 23 const MINCORE_PSIND_SHIFT = 5 const O_CLOFORK = 134217728 const O_NAMEDATTR = 67108864 const O_XATTR = 67108864 const PROT_CHERI0 = 8 const PROT_CHERI1 = 16 const _PC_CLONE_BLKSIZE = 69 const _PC_HAS_HIDDENSYSTEM = 68 const _PC_HAS_NAMEDATTR = 67 const _PC_NAMEDATTR_ENABLED = 66 const _PC_XATTR_ENABLED = 66 const _PC_XATTR_EXISTS = 67 const _SC_NSIG = 124 const _SC_UEXTERR_MAXLEN = 123 const __CC_SUPPORTS_SYMVER = 1 const __FreeBSD__ = 15 const __FreeBSD_cc_version = 1500000 const __SSP_FORTIFY_LEVEL = 0 // C documentation // // /* // ** Find the mode, uid and gid of file zFile. // */ func _getFileMode(tls *libc.TLS, zFile uintptr, pMode uintptr, pUid uintptr, pGid uintptr) (r int32) { bp := tls.Alloc(224) defer tls.Free(224) var rc int32 var _ /* sStat at bp+0 */ Tstat _ = rc /* Output of stat() on database file */ rc = SQLITE_OK if 0 == (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(4)].FpCurrent})))(tls, zFile, bp) { **(**Tmode_t)(__ccgo_up(pMode)) = libc.Uint16FromInt32(libc.Int32FromUint16((**(**Tstat)(__ccgo_up(bp))).Fst_mode) & int32(0777)) **(**Tuid_t)(__ccgo_up(pUid)) = (**(**Tstat)(__ccgo_up(bp))).Fst_uid **(**Tgid_t)(__ccgo_up(pGid)) = (**(**Tstat)(__ccgo_up(bp))).Fst_gid } else { rc = libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(7)<= int32(SQLITE_MINIMUM_FILE_DESCRIPTOR) { break } if f&(libc.Int32FromInt32(O_EXCL)|libc.Int32FromInt32(O_CREAT)) == libc.Int32FromInt32(O_EXCL)|libc.Int32FromInt32(O_CREAT) { (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(16)].FpCurrent})))(tls, z) } (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(1)].FpCurrent})))(tls, fd) Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+3750, libc.VaList(bp+232, z, fd)) fd = -int32(1) if (*(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[0].FpCurrent})))(tls, __ccgo_ts+3793, O_RDONLY, libc.Int32FromUint16(m)) < 0 { break } } if fd >= 0 { if libc.Int32FromUint16(m) != 0 { if (*(*func(*libc.TLS, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(5)].FpCurrent})))(tls, fd, bp) == 0 && (**(**Tstat)(__ccgo_up(bp))).Fst_size == 0 && libc.Int32FromUint16((**(**Tstat)(__ccgo_up(bp))).Fst_mode)&int32(0777) != libc.Int32FromUint16(m) { (*(*func(*libc.TLS, int32, Tmode_t) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(14)].FpCurrent})))(tls, fd, m) } } } return fd } // C documentation // // /* // ** Return the fallback token corresponding to canonical token iToken, or // ** 0 if iToken has no fallback. // */ func _sqlite3Fts5ParserFallback(tls *libc.TLS, iToken int32) (r int32) { _ = iToken return 0 } /* ** 2014 May 31 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ****************************************************************************** */ /* #include "fts5Int.h" */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is freely granted, provided that this notice * is preserved. * ==================================================== */ /* */ // C documentation // // /* // ** Test the existence of or access permissions of file zPath. The // ** test performed depends on the value of flags: // ** // ** SQLITE_ACCESS_EXISTS: Return 1 if the file exists // ** SQLITE_ACCESS_READWRITE: Return 1 if the file is read and writable. // ** SQLITE_ACCESS_READONLY: Return 1 if the file is readable. // ** // ** Otherwise return 0. // */ func _unixAccess(tls *libc.TLS, NotUsed uintptr, zPath uintptr, flags int32, pResOut uintptr) (r int32) { bp := tls.Alloc(224) defer tls.Free(224) var _ /* buf at bp+0 */ Tstat _ = NotUsed /* The spec says there are three possible values for flags. But only ** two of them are actually used */ if flags == SQLITE_ACCESS_EXISTS { **(**int32)(__ccgo_up(pResOut)) = libc.BoolInt32(0 == (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(4)].FpCurrent})))(tls, zPath, bp) && (!(libc.Int32FromUint16((**(**Tstat)(__ccgo_up(bp))).Fst_mode)&libc.Int32FromInt32(0170000) == libc.Int32FromInt32(0100000)) || (**(**Tstat)(__ccgo_up(bp))).Fst_size > 0)) } else { **(**int32)(__ccgo_up(pResOut)) = libc.BoolInt32((*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(2)].FpCurrent})))(tls, zPath, libc.Int32FromInt32(W_OK)|libc.Int32FromInt32(R_OK)) == 0) } return SQLITE_OK } // C documentation // // /* // ** Check a unixFile that is a database. Verify the following: // ** // ** (1) There is exactly one hard link on the file // ** (2) The file is not a symbolic link // ** (3) The file has not been renamed or unlinked // ** // ** Issue sqlite3_log(SQLITE_WARNING,...) messages if anything is not right. // */ func _verifyDbFile(tls *libc.TLS, pFile uintptr) { bp := tls.Alloc(240) defer tls.Free(240) var rc int32 var _ /* buf at bp+0 */ Tstat _ = rc /* These verifications occurs for the main database only */ if libc.Int32FromUint16((*TunixFile)(unsafe.Pointer(pFile)).FctrlFlags)&int32(UNIXFILE_NOLOCK) != 0 { return } rc = (*(*func(*libc.TLS, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(5)].FpCurrent})))(tls, (*TunixFile)(unsafe.Pointer(pFile)).Fh, bp) if rc != 0 { Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+3834, libc.VaList(bp+232, (*TunixFile)(unsafe.Pointer(pFile)).FzPath)) return } if (**(**Tstat)(__ccgo_up(bp))).Fst_nlink == uint64(0) { Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+3858, libc.VaList(bp+232, (*TunixFile)(unsafe.Pointer(pFile)).FzPath)) return } if (**(**Tstat)(__ccgo_up(bp))).Fst_nlink > uint64(1) { Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+3887, libc.VaList(bp+232, (*TunixFile)(unsafe.Pointer(pFile)).FzPath)) return } if _fileHasMoved(tls, pFile) != 0 { Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+3914, libc.VaList(bp+232, (*TunixFile)(unsafe.Pointer(pFile)).FzPath)) return } } type t__acl_entry_type_t = uint16 type t__acl_flag_t = uint16 type t__acl_flagset_t = uintptr type t__acl_perm_t = uint32 type t__acl_permset_t = uintptr type t__acl_tag_t = uint32 type t__acl_type_t = uint32