// Code generated by modernc.org/undup from the per-target sqlite_*.go files; DO NOT EDIT. //go:build (linux && 386) || (linux && amd64) || (linux && ppc64le) || (linux && s390x) package sqlite3 import ( "unsafe" "modernc.org/libc" ) // 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(144) defer tls.Free(144) 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)) = (**(**Tstat)(__ccgo_up(bp))).Fst_mode & uint32(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+3752, libc.VaList(bp+152, z, fd)) fd = -int32(1) if (*(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[0].FpCurrent})))(tls, __ccgo_ts+3795, O_RDONLY, libc.Int32FromUint32(m)) < 0 { break } } if fd >= 0 { if m != uint32(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 && (**(**Tstat)(__ccgo_up(bp))).Fst_mode&uint32(0777) != m { (*(*func(*libc.TLS, int32, Tmode_t) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(14)].FpCurrent})))(tls, fd, m) } } } return fd } // 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(144) defer tls.Free(144) 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) && (!((**(**Tstat)(__ccgo_up(bp))).Fst_mode&libc.Uint32FromInt32(S_IFMT) == libc.Uint32FromInt32(S_IFREG)) || (**(**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 }