From 5e90ac3dd4fd45ae3386b0a11e98b2de9596530e Mon Sep 17 00:00:00 2001 From: Paul Kulchenko Date: Tue, 22 Nov 2022 22:45:10 -0800 Subject: [PATCH] Update SQLite to use pread()/pwrite() (reapply 98909b13) --- third_party/sqlite3/os_unix.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/third_party/sqlite3/os_unix.c b/third_party/sqlite3/os_unix.c index 23ea26bd9..9c8626879 100644 --- a/third_party/sqlite3/os_unix.c +++ b/third_party/sqlite3/os_unix.c @@ -1,3 +1,4 @@ +// clang-format off /* ** 2004 May 22 ** @@ -44,9 +45,9 @@ ** plus implementations of sqlite3_os_init() and sqlite3_os_end(). */ #include "libc/stdio/rand.h" +#include "libc/sysv/consts/lock.h" #include "third_party/sqlite3/sqliteInt.h" #if SQLITE_OS_UNIX /* This file is used on unix only */ - /* clang-format off */ /* ** There are various methods for file locking used for concurrency @@ -74,7 +75,7 @@ #endif /* Use pread() and pwrite() if they are available */ -#if defined(__APPLE__) +#if defined(__APPLE__) || defined(__COSMOPOLITAN__) /* [jart] */ # define HAVE_PREAD 1 # define HAVE_PWRITE 1 #endif @@ -152,10 +153,6 @@ # include "libc/limits.h" #endif /* OS_VXWORKS */ -#if defined(__APPLE__) || SQLITE_ENABLE_LOCKING_STYLE -# include -#endif - #ifdef HAVE_UTIME # include "libc/time/time.h" #endif @@ -343,14 +340,6 @@ static pid_t randomnessPid = 0; # endif #endif -/* -** Explicitly call the 64-bit version of lseek() on Android. Otherwise, lseek() -** is the 32-bit version, even if _FILE_OFFSET_BITS=64 is defined. -*/ -#ifdef __ANDROID__ -# define lseek lseek64 -#endif - #ifdef __linux__ /* ** Linux-specific IOCTL magic numbers used for controlling F2FS