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

@ -16,6 +16,28 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/strace.internal.h"
#include "libc/runtime/runtime.h"
int __strace;
/**
* System call logging enabled state.
*
* If Cosmopolitan was compiled with the `SYSDEBUG` macro (this is the
* default behavior, except in tiny and release modes) then `__strace`
* shall control whether or not system calls are logged to fd 2. If it's
* greater than zero, syscalls are logged. Otherwise, they're aren't.
*
* By convention, functions wishing to disable syscall tracing for a
* short time period should say:
*
* void foo() {
* --__strace;
* bar();
* ++__strace;
* }
*
* This way you still have some flexibility to force syscall tracing, by
* setting `__strace` to a higher number like `2` or `200`. Even though
* under normal circumstances, `__strace` should only be either zero or
* one.
*/
_Atomic(int) __strace;

View file

@ -26,26 +26,26 @@
// wouldn't impact this counter.
.bss
.align 8
g_syscount:
__syscount:
.quad 0
.endobj g_syscount,globl
.endobj __syscount,globl
.previous
.initbss 701,_init_g_syscount
g_syscount_next:
.initbss 701,_init___syscount
__syscount_next:
.quad 0
.endobj g_syscount_next
.endobj __syscount_next
.previous
syscount:
incq g_syscount(%rip)
jmp *g_syscount_next(%rip)
incq __syscount(%rip)
jmp *__syscount_next(%rip)
.endfn syscount
.previous
.init.start 701,_init_g_syscount
.init.start 701,_init___syscount
mov __systemfive(%rip),%rax
stosq
ezlea syscount,ax
mov %rax,__systemfive(%rip)
.init.end 701,_init_g_syscount
.init.end 701,_init___syscount

View file

@ -33,7 +33,7 @@ LIBC_SYSV_A_DIRECTDEPS = \
LIBC_SYSV_A_FILES := \
libc/sysv/macros.internal.h \
libc/sysv/errfuns.h \
libc/sysv/g_syscount.S \
libc/sysv/syscount.S \
libc/sysv/restorert.S \
libc/sysv/syscall.S \
libc/sysv/systemfive.S \
@ -75,9 +75,11 @@ o/libc/sysv/consts/syscon.internal.inc: \
libc/macros-cpp.internal.inc \
libc/macros.internal.inc
# we can't use asan and ubsan because:
# we're higher in the topological order of things
o/$(MODE)/libc/sysv/errno.greg.o: \
OVERRIDE_CFLAGS += \
$(NO_MAGIC)
-fno-sanitize=all
#───────────────────────────────────────────────────────────────────────────────