Add torture test for zipos file descriptors

This change hardens the code for opening /zip/ files using the system
call interface. Thread safety and signal safety has been improved for
file descriptors in general. We now document fixed addresses that are
needed for low level allocations.
This commit is contained in:
Justine Tunney 2022-06-15 16:19:50 -07:00
parent 579080cd4c
commit e466dd0553
44 changed files with 2981 additions and 307 deletions

View file

@ -20,7 +20,6 @@
#include "libc/bits/atomic.h"
#include "libc/bits/weaken.h"
#include "libc/intrin/kprintf.h"
#include "libc/intrin/spinlock.h"
#include "libc/log/backtrace.internal.h"
#include "libc/log/log.h"
#include "libc/macros.internal.h"
@ -71,14 +70,14 @@ static struct Memlog {
long usage;
} __memlog;
_Alignas(64) static int __memlog_lock_obj;
static pthread_mutex_t __memlog_lock_obj;
static void __memlog_lock(void) {
_spinlock(&__memlog_lock_obj);
pthread_mutex_lock(&__memlog_lock_obj);
}
static void __memlog_unlock(void) {
_spunlock(&__memlog_lock_obj);
pthread_mutex_unlock(&__memlog_lock_obj);
}
static long __memlog_size(void *p) {