Update SQLite to use pread()/pwrite() (reapply 98909b13)

This commit is contained in:
Paul Kulchenko 2022-11-22 22:45:10 -08:00
parent 95595c1d5a
commit 5e90ac3dd4

View file

@ -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 <sys/mount.h>
#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