mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 15:28:30 +00:00
Elevate Windows production worthiness
- SQLite file locking now works on Windows - SQLite will now use fdatasync() on non-Apple platforms - Fix Ctrl-C handler on Windows to not crash with TLS - Signals now work in multithreaded apps on Windows - fcntl() will now accurately report EINVAL errors - fcntl() now has excellent --strace logging - Token bucket replenish now go 100x faster - *NSYNC cancellations now work on Windows - Support closefrom() on NetBSD
This commit is contained in:
parent
d38700687a
commit
997ce29ddc
95 changed files with 959 additions and 418 deletions
4
third_party/sqlite3/README.cosmo
vendored
4
third_party/sqlite3/README.cosmo
vendored
|
@ -10,3 +10,7 @@ ORIGIN
|
|||
LICENSE
|
||||
|
||||
Public Domain or MIT
|
||||
|
||||
LOCAL CHANGES
|
||||
|
||||
- Changed the fsync() code to be configured at runtime.
|
||||
|
|
4
third_party/sqlite3/main.c
vendored
4
third_party/sqlite3/main.c
vendored
|
@ -3105,10 +3105,6 @@ static int openDatabase(
|
|||
char *zErrMsg = 0; /* Error message from sqlite3ParseUri() */
|
||||
int i; /* Loop counter */
|
||||
|
||||
// TODO(jart): Fix SQLite.
|
||||
extern bool __force_sqlite_to_work_until_we_can_fix_it;
|
||||
__force_sqlite_to_work_until_we_can_fix_it = true;
|
||||
|
||||
#ifdef SQLITE_ENABLE_API_ARMOR
|
||||
if( ppDb==0 ) return SQLITE_MISUSE_BKPT;
|
||||
#endif
|
||||
|
|
15
third_party/sqlite3/os_unix.c
vendored
15
third_party/sqlite3/os_unix.c
vendored
|
@ -53,6 +53,8 @@
|
|||
#include "third_party/sqlite3/sqlite3.h"
|
||||
#include "third_party/sqlite3/mutex.internal.h"
|
||||
#include "third_party/sqlite3/mutex.internal.h"
|
||||
#include "libc/sysv/consts/f.h"
|
||||
#include "libc/dce.h"
|
||||
#include "third_party/sqlite3/sqliteInt.inc"
|
||||
#if SQLITE_OS_UNIX /* This file is used on unix only */
|
||||
|
||||
|
@ -3612,8 +3614,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;
|
||||
|
@ -3626,7 +3629,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
|
||||
|
|
2
third_party/sqlite3/shell.c
vendored
2
third_party/sqlite3/shell.c
vendored
|
@ -59,6 +59,7 @@
|
|||
#include "libc/sysv/consts/rusage.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/errno.h"
|
||||
#if SQLITE_USER_AUTHENTICATION
|
||||
#include "third_party/sqlite3/sqlite3userauth.inc"
|
||||
#endif
|
||||
|
@ -10573,6 +10574,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