Make some systemic improvements

- add vdso dump utility
- tests now log stack usage
- rename g_ftrace to __ftrace
- make internal spinlocks go faster
- add conformant c11 atomics library
- function tracing now logs stack usage
- make function call tracing thread safe
- add -X unsecure (no ssl) mode to redbean
- munmap() has more consistent behavior now
- pacify fsync() calls on python unit tests
- make --strace flag work better in redbean
- start minimizing and documenting compiler flags
This commit is contained in:
Justine Tunney 2022-05-18 16:41:29 -07:00
parent c6bbca55e9
commit 9208c83f7a
141 changed files with 1948 additions and 1411 deletions

View file

@ -20,21 +20,28 @@
#include "libc/calls/internal.h"
#include "libc/calls/strace.internal.h"
#include "libc/dce.h"
#include "libc/runtime/runtime.h"
/**
* Blocks until kernel flushes non-metadata buffers for fd to disk.
*
* @return 0 on success, or -1 w/ errno
* @see fsync(), sync_file_range()
* @see sync(), fsync(), sync_file_range()
* @see __nosync to secretly disable
* @asyncsignalsafe
*/
int fdatasync(int fd) {
int rc;
if (!IsWindows()) {
rc = sys_fdatasync(fd);
if (__nosync != 0x5453455454534146) {
if (!IsWindows()) {
rc = sys_fdatasync(fd);
} else {
rc = sys_fdatasync_nt(fd);
}
STRACE("fdatasync(%d) → %d% m", fd, rc);
} else {
rc = sys_fdatasync_nt(fd);
rc = 0;
STRACE("fdatasync(%d) → disabled% m", fd);
}
STRACE("%s(%d) → %d% m", "fdatasync", fd, rc);
return rc;
}