mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-04 02:08:30 +00:00
Fix bugs with new memory manager
This fixes a regression in mmap(MAP_FIXED) on Windows caused by a recent revision. This change also fixes ZipOS so it no longer needs a MAP_FIXED mapping to open files from the PKZIP store. The memory mapping mutex was implemented incorrectly earlier which meant that ftrace and strace could cause cause crashes. This lock and other recursive mutexes are rewritten so that it should be provable that recursive mutexes in cosmopolitan are asynchronous signal safe.
This commit is contained in:
parent
6de12c1032
commit
464858dbb4
34 changed files with 353 additions and 313 deletions
|
@ -2,17 +2,30 @@
|
|||
#define COSMOPOLITAN_LIBC_CALLS_STRUCT_SIGSET_INTERNAL_H_
|
||||
#include "libc/calls/struct/sigset.h"
|
||||
#include "libc/mem/alloca.h"
|
||||
#include "libc/sysv/consts/sig.h"
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
#ifndef MODE_DBG
|
||||
/* block sigs because theoretical edge cases */
|
||||
#define BLOCK_SIGNALS \
|
||||
do { \
|
||||
sigset_t _SigMask; \
|
||||
_SigMask = __sig_block()
|
||||
|
||||
#define ALLOW_SIGNALS \
|
||||
__sig_unblock(_SigMask); \
|
||||
} \
|
||||
while (0)
|
||||
#else
|
||||
/* doesn't block signals so we can get a crash
|
||||
report, when a core runtime library crashes */
|
||||
#define BLOCK_SIGNALS \
|
||||
do { \
|
||||
sigset_t _SigMask; \
|
||||
sigprocmask(SIG_SETMASK, 0, &_SigMask)
|
||||
#define ALLOW_SIGNALS \
|
||||
} \
|
||||
while (0)
|
||||
#endif
|
||||
|
||||
sigset_t __sig_block(void);
|
||||
void __sig_unblock(sigset_t);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue