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:
Justine Tunney 2022-10-13 13:44:41 -07:00
parent d38700687a
commit 997ce29ddc
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
95 changed files with 959 additions and 418 deletions

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon errno,ECANCELED,125,89,85,88,87,0
.syscon errno,ECANCELED,125,89,85,88,87,1223

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon errno,EILSEQ,84,92,86,84,85,0
.syscon errno,EILSEQ,84,92,86,84,85,582

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon errno,ENOMSG,42,91,83,90,83,0
.syscon errno,ENOMSG,42,91,83,90,83,4306

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon errno,EOVERFLOW,75,84,84,87,84,0
.syscon errno,EOVERFLOW,75,84,84,87,84,534

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon errno,EOWNERDEAD,130,105,96,94,97,0
.syscon errno,EOWNERDEAD,130,105,96,94,97,105

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon errno,ETIME,62,101,60,60,92,0
.syscon errno,ETIME,62,101,60,60,92,1460

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon fcntl,F_TEST,3,3,3,3,3,0
.syscon fcntl2,F_BARRIERFSYNC,-1,85,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon fcntl2,F_FULLFSYNC,0,51,0,0,0,0
.syscon fcntl2,F_FULLFSYNC,-1,51,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon fcntl,F_GETLEASE,0x0401,0,0,0,0,0
.syscon fcntl,F_GETLEASE,0x0401,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon fcntl,F_TLOCK,2,2,2,2,2,0
.syscon fcntl3,F_GETNOSIGPIPE,-1,74,-1,-1,13,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon fcntl2,F_GETOWN,9,5,5,5,5,0
.syscon fcntl2,F_GETOWN,9,5,5,5,5,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon fcntl,F_GETOWN_EX,0x10,0,0,0,0,0
.syscon fcntl,F_GETOWN_EX,0x10,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon fcntl,F_LOCK,1,1,1,1,1,0
.syscon fcntl3,F_GETPATH,-1,50,-1,-1,15,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon fcntl,F_GETPIPE_SZ,0x0408,0,0,0,0,0
.syscon fcntl,F_GETPIPE_SZ,0x0408,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon fcntl,F_GETSIG,11,0,0,0,0,0
.syscon fcntl,F_GETSIG,11,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon fcntl,F_MAXFD,0,0,0,0,11,0
.syscon fcntl,F_MAXFD,-1,-1,-1,-1,11,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon fcntl2,F_NOCACHE,0,48,0,0,0,0
.syscon fcntl2,F_NOCACHE,-1,48,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon fcntl,F_NOTIFY,0x0402,0,0,0,0,0
.syscon fcntl,F_NOTIFY,0x0402,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon fcntl,F_OFD_GETLK,36,0,0,0,0,0
.syscon fcntl,F_OFD_GETLK,36,92,-1,-1,-1,5

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon fcntl,F_OFD_SETLK,37,0,0,0,0,0
.syscon fcntl,F_OFD_SETLK,37,90,-1,-1,-1,6

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon fcntl,F_OFD_SETLKW,38,0,0,0,0,0
.syscon fcntl,F_OFD_SETLKW,38,91,-1,-1,-1,7

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon fcntl,F_SETLEASE,0x0400,0,0,0,0,0
.syscon fcntl,F_SETLEASE,0x0400,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon fcntl,F_ULOCK,0,0,0,0,0,0
.syscon fcntl3,F_SETNOSIGPIPE,-1,73,-1,-1,14,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon fcntl2,F_SETOWN,8,6,6,6,6,0
.syscon fcntl2,F_SETOWN,8,6,6,6,6,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon fcntl,F_SETOWN_EX,15,0,0,0,0,0
.syscon fcntl,F_SETOWN_EX,15,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon fcntl,F_SETPIPE_SZ,0x0407,0,0,0,0,0
.syscon fcntl,F_SETPIPE_SZ,0x0407,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon fcntl,F_SETSIG,10,0,0,0,0,0
.syscon fcntl,F_SETSIG,10,-1,-1,-1,-1,-1

12
libc/sysv/consts/dn.h Normal file
View file

@ -0,0 +1,12 @@
#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_DN_H_
#define COSMOPOLITAN_LIBC_SYSV_CONSTS_DN_H_
#define DN_ACCESS 0x00000001 /* file accessed */
#define DN_MODIFY 0x00000002 /* file modified */
#define DN_CREATE 0x00000004 /* file created */
#define DN_DELETE 0x00000008 /* file removed */
#define DN_RENAME 0x00000010 /* file renamed */
#define DN_ATTRIB 0x00000020 /* file changed attibutes */
#define DN_MULTISHOT 0x80000000 /* don't remove notifier */
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_DN_H_ */

View file

@ -4,6 +4,7 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
extern const int F_BARRIERFSYNC;
extern const int F_DUPFD;
extern const int F_DUPFD_CLOEXEC;
extern const int F_FULLFSYNC;
@ -12,11 +13,14 @@ extern const int F_GETFL;
extern const int F_GETLEASE;
extern const int F_GETLK64;
extern const int F_GETLK;
extern const int F_GETNOSIGPIPE;
extern const int F_GETOWN;
extern const int F_GETOWN_EX;
extern const int F_GETPATH;
extern const int F_GETPIPE_SZ;
extern const int F_GETSIG;
extern const int F_LOCK;
extern const int F_MAXFD;
extern const int F_NOCACHE;
extern const int F_NOTIFY;
extern const int F_OFD_GETLK;
@ -30,13 +34,11 @@ extern const int F_SETLK64;
extern const int F_SETLK;
extern const int F_SETLKW64;
extern const int F_SETLKW;
extern const int F_SETNOSIGPIPE;
extern const int F_SETOWN;
extern const int F_SETOWN_EX;
extern const int F_SETPIPE_SZ;
extern const int F_SETSIG;
extern const int F_TEST;
extern const int F_TLOCK;
extern const int F_ULOCK;
extern const int F_UNLCK;
extern const int F_WRLCK;
@ -50,20 +52,17 @@ COSMOPOLITAN_C_END_
#define F_SETFL LITERALLY(4)
#define F_DUPFD_CLOEXEC SYMBOLIC(F_DUPFD_CLOEXEC)
#define F_FULLFSYNC SYMBOLIC(F_FULLFSYNC)
#define F_GETLEASE SYMBOLIC(F_GETLEASE)
#define F_GETLK SYMBOLIC(F_GETLK)
#define F_GETLK64 SYMBOLIC(F_GETLK64)
#define F_GETOWN SYMBOLIC(F_GETOWN)
#define F_GETOWN_EX SYMBOLIC(F_GETOWN_EX)
#define F_GETPATH SYMBOLIC(F_GETPATH)
#define F_GETPIPE_SZ SYMBOLIC(F_GETPIPE_SZ)
#define F_GETSIG SYMBOLIC(F_GETSIG)
#define F_LOCK SYMBOLIC(F_LOCK)
#define F_MAXFD SYMBOLIC(F_MAXFD)
#define F_NOCACHE SYMBOLIC(F_NOCACHE)
#define F_NOTIFY SYMBOLIC(F_NOTIFY)
#define F_OFD_GETLK SYMBOLIC(F_OFD_GETLK)
#define F_OFD_SETLK SYMBOLIC(F_OFD_SETLK)
#define F_OFD_SETLKW SYMBOLIC(F_OFD_SETLKW)
#define F_RDLCK SYMBOLIC(F_RDLCK)
#define F_SETLEASE SYMBOLIC(F_SETLEASE)
#define F_SETLK SYMBOLIC(F_SETLK)
@ -74,10 +73,16 @@ COSMOPOLITAN_C_END_
#define F_SETOWN_EX SYMBOLIC(F_SETOWN_EX)
#define F_SETPIPE_SZ SYMBOLIC(F_SETPIPE_SZ)
#define F_SETSIG SYMBOLIC(F_SETSIG)
#define F_TEST SYMBOLIC(F_TEST)
#define F_TLOCK SYMBOLIC(F_TLOCK)
#define F_ULOCK SYMBOLIC(F_ULOCK)
#define F_UNLCK SYMBOLIC(F_UNLCK)
#define F_WRLCK SYMBOLIC(F_WRLCK)
/* avoid leading #ifdef astray */
/* #define F_FULLFSYNC SYMBOLIC(F_FULLFSYNC) */
/* #define F_BARRIERFSYNC SYMBOLIC(F_BARRIERFSYNC) */
/* #define F_OFD_GETLK SYMBOLIC(F_OFD_GETLK) */
/* #define F_OFD_SETLK SYMBOLIC(F_OFD_SETLK) */
/* #define F_OFD_SETLKW SYMBOLIC(F_OFD_SETLKW) */
/* #define F_SETNOSIGPIPE SYMBOLIC(F_SETNOSIGPIPE) */
/* #define F_GETNOSIGPIPE SYMBOLIC(F_GETNOSIGPIPE) */
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_F_H_ */