mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-08 10:50:28 +00:00
Update SQLite to configure fsync() at runtime (reapply 997ce29d
)
This commit is contained in:
parent
b382e4b93a
commit
9018a16e9f
2 changed files with 14 additions and 4 deletions
15
third_party/sqlite3/os_unix.c
vendored
15
third_party/sqlite3/os_unix.c
vendored
|
@ -47,6 +47,8 @@
|
|||
#include "libc/stdio/rand.h"
|
||||
#include "libc/sysv/consts/lock.h"
|
||||
#include "third_party/sqlite3/sqliteInt.h"
|
||||
#include "libc/sysv/consts/f.h"
|
||||
#include "libc/dce.h"
|
||||
#if SQLITE_OS_UNIX /* This file is used on unix only */
|
||||
|
||||
/*
|
||||
|
@ -3628,8 +3630,9 @@ static int full_fsync(int fd, int fullSync, int dataOnly){
|
|||
struct stat buf;
|
||||
rc = osFstat(fd, &buf);
|
||||
}
|
||||
#elif HAVE_FULLFSYNC
|
||||
if( fullSync ){
|
||||
#elif HAVE_FULLFSYNC || defined(__COSMOPOLITAN__)
|
||||
/* [jart] use runtime os detection */
|
||||
if( fullSync && F_FULLFSYNC != -1 ){
|
||||
rc = osFcntl(fd, F_FULLFSYNC, 0);
|
||||
}else{
|
||||
rc = 1;
|
||||
|
@ -3642,7 +3645,13 @@ static int full_fsync(int fd, int fullSync, int dataOnly){
|
|||
** It'd be better to detect fullfsync support once and avoid
|
||||
** the fcntl call every time sync is called.
|
||||
*/
|
||||
if( rc ) rc = fsync(fd);
|
||||
if( rc ) {
|
||||
if( IsXnu() ){
|
||||
rc = fsync(fd);
|
||||
}else{
|
||||
rc = fdatasync(fd);
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
/* fdatasync() on HFS+ doesn't yet flush the file size if it changed correctly
|
||||
|
|
3
third_party/sqlite3/shell.c
vendored
3
third_party/sqlite3/shell.c
vendored
|
@ -140,7 +140,7 @@ typedef sqlite3_int64 i64;
|
|||
typedef sqlite3_uint64 u64;
|
||||
typedef unsigned char u8;
|
||||
#if SQLITE_USER_AUTHENTICATION
|
||||
# include "sqlite3userauth.h"
|
||||
# include "third_party/sqlite3/sqlite3userauth.h"
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32) && !defined(WIN32)
|
||||
|
@ -11265,6 +11265,7 @@ static void process_sqliterc(
|
|||
p->in = inSaved;
|
||||
p->lineno = savedLineno;
|
||||
sqlite3_free(zBuf);
|
||||
errno = 0; /* [jart] clear error */
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue