mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-03-03 15:38:22 +00:00
Release redbean 2.0.4
This commit is contained in:
parent
d5312b60f7
commit
5ddf43332e
4 changed files with 19 additions and 24 deletions
|
@ -43,14 +43,7 @@ relegated wontreturn void __die(void) {
|
||||||
if (IsDebuggerPresent(false)) {
|
if (IsDebuggerPresent(false)) {
|
||||||
DebugBreak();
|
DebugBreak();
|
||||||
}
|
}
|
||||||
if (weaken(ShowBacktrace)) {
|
ShowBacktrace(2, __builtin_frame_address(0));
|
||||||
weaken(ShowBacktrace)(2, __builtin_frame_address(0));
|
|
||||||
} else if (weaken(PrintBacktraceUsingSymbols) && weaken(GetSymbolTable)) {
|
|
||||||
weaken(PrintBacktraceUsingSymbols)(2, __builtin_frame_address(0),
|
|
||||||
weaken(GetSymbolTable)());
|
|
||||||
} else {
|
|
||||||
kprintf("can't backtrace b/c `ShowCrashReports` not linked\n");
|
|
||||||
}
|
|
||||||
__restorewintty();
|
__restorewintty();
|
||||||
_Exit(77);
|
_Exit(77);
|
||||||
} else if (owner == me) {
|
} else if (owner == me) {
|
||||||
|
|
|
@ -35,6 +35,7 @@ static dontinline uint64_t rdrand_failover(void) {
|
||||||
if (r == -1 && errno == EINTR) {
|
if (r == -1 && errno == EINTR) {
|
||||||
r = 0;
|
r = 0;
|
||||||
} else if (r == -1 && errno == EAGAIN) {
|
} else if (r == -1 && errno == EAGAIN) {
|
||||||
|
r = 0;
|
||||||
f = 0;
|
f = 0;
|
||||||
} else {
|
} else {
|
||||||
return rand64();
|
return rand64();
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "libc/errno.h"
|
#include "libc/errno.h"
|
||||||
#include "libc/fmt/fmt.h"
|
#include "libc/fmt/fmt.h"
|
||||||
#include "libc/intrin/kprintf.h"
|
#include "libc/intrin/kprintf.h"
|
||||||
|
#include "libc/intrin/pthread.h"
|
||||||
#include "libc/intrin/spinlock.h"
|
#include "libc/intrin/spinlock.h"
|
||||||
#include "libc/intrin/wait0.internal.h"
|
#include "libc/intrin/wait0.internal.h"
|
||||||
#include "libc/log/check.h"
|
#include "libc/log/check.h"
|
||||||
|
@ -132,10 +133,10 @@ struct Sauce *sauces;
|
||||||
struct Strings strings;
|
struct Strings strings;
|
||||||
struct Sources sources;
|
struct Sources sources;
|
||||||
const char *buildroot;
|
const char *buildroot;
|
||||||
_Alignas(64) char galock;
|
pthread_mutex_t galock;
|
||||||
_Alignas(64) char readlock;
|
pthread_mutex_t readlock;
|
||||||
_Alignas(64) char writelock;
|
pthread_mutex_t writelock;
|
||||||
_Alignas(64) char reportlock;
|
pthread_mutex_t reportlock;
|
||||||
|
|
||||||
unsigned Hash(const void *s, size_t l) {
|
unsigned Hash(const void *s, size_t l) {
|
||||||
return max(1, crc32c(0, s, l));
|
return max(1, crc32c(0, s, l));
|
||||||
|
@ -262,18 +263,18 @@ int LoadRelationshipsWorker(void *arg) {
|
||||||
buf += PAGESIZE;
|
buf += PAGESIZE;
|
||||||
buf[-1] = '\n';
|
buf[-1] = '\n';
|
||||||
for (;;) {
|
for (;;) {
|
||||||
_spinlock(&galock);
|
pthread_mutex_lock(&galock);
|
||||||
if ((src = getargs_next(&ga))) strcpy(srcbuf, src);
|
if ((src = getargs_next(&ga))) strcpy(srcbuf, src);
|
||||||
_spunlock(&galock);
|
pthread_mutex_unlock(&galock);
|
||||||
if (!src) break;
|
if (!src) break;
|
||||||
src = srcbuf;
|
src = srcbuf;
|
||||||
if (ShouldSkipSource(src)) continue;
|
if (ShouldSkipSource(src)) continue;
|
||||||
n = strlen(src);
|
n = strlen(src);
|
||||||
_spinlock(&readlock);
|
pthread_mutex_lock(&readlock);
|
||||||
srcid = GetSourceId(src, n);
|
srcid = GetSourceId(src, n);
|
||||||
_spunlock(&readlock);
|
pthread_mutex_unlock(&readlock);
|
||||||
if ((fd = open(src, O_RDONLY)) == -1) {
|
if ((fd = open(src, O_RDONLY)) == -1) {
|
||||||
_spinlock(&reportlock);
|
pthread_mutex_lock(&reportlock);
|
||||||
OnMissingFile(ga.path, src);
|
OnMissingFile(ga.path, src);
|
||||||
}
|
}
|
||||||
CHECK_NE(-1, (rc = read(fd, buf, MAX_READ)));
|
CHECK_NE(-1, (rc = read(fd, buf, MAX_READ)));
|
||||||
|
@ -286,14 +287,14 @@ int LoadRelationshipsWorker(void *arg) {
|
||||||
path = p + inclen;
|
path = p + inclen;
|
||||||
pathend = memchr(path, '"', pe - path);
|
pathend = memchr(path, '"', pe - path);
|
||||||
if (pathend && (p[-1] == '#' || p[-1] == '.') && p[-2] == '\n') {
|
if (pathend && (p[-1] == '#' || p[-1] == '.') && p[-2] == '\n') {
|
||||||
_spinlock(&readlock);
|
pthread_mutex_lock(&readlock);
|
||||||
dependency = GetSourceId(path, pathend - path);
|
dependency = GetSourceId(path, pathend - path);
|
||||||
_spunlock(&readlock);
|
pthread_mutex_unlock(&readlock);
|
||||||
edge.from = srcid;
|
edge.from = srcid;
|
||||||
edge.to = dependency;
|
edge.to = dependency;
|
||||||
_spinlock(&writelock);
|
pthread_mutex_lock(&writelock);
|
||||||
append(&edges, &edge);
|
append(&edges, &edge);
|
||||||
_spunlock(&writelock);
|
pthread_mutex_unlock(&writelock);
|
||||||
p = pathend;
|
p = pathend;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -311,7 +312,7 @@ void LoadRelationships(int argc, char *argv[]) {
|
||||||
CLONE_SETTLS | CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID,
|
CLONE_SETTLS | CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID,
|
||||||
(void *)(intptr_t)i, 0, __initialize_tls(tls[i]), 64,
|
(void *)(intptr_t)i, 0, __initialize_tls(tls[i]), 64,
|
||||||
(int *)(tls[i] + 0x38)) == -1) {
|
(int *)(tls[i] + 0x38)) == -1) {
|
||||||
_spinlock(&reportlock);
|
pthread_mutex_lock(&reportlock);
|
||||||
kprintf("error: clone(%d) failed %m\n", i);
|
kprintf("error: clone(%d) failed %m\n", i);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -426,7 +427,7 @@ void Explore(void) {
|
||||||
CLONE_SETTLS | CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID,
|
CLONE_SETTLS | CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID,
|
||||||
(void *)(intptr_t)i, 0, __initialize_tls(tls[i]), 64,
|
(void *)(intptr_t)i, 0, __initialize_tls(tls[i]), 64,
|
||||||
(int *)(tls[i] + 0x38)) == -1) {
|
(int *)(tls[i] + 0x38)) == -1) {
|
||||||
_spinlock(&reportlock);
|
pthread_mutex_lock(&reportlock);
|
||||||
kprintf("error: clone(%d) failed %m\n", i);
|
kprintf("error: clone(%d) failed %m\n", i);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,7 @@ STATIC_YOINK("zip_uri_support");
|
||||||
#define REDBEAN "redbean"
|
#define REDBEAN "redbean"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define VERSION 0x020003
|
#define VERSION 0x020004
|
||||||
#define HEARTBEAT 5000 /*ms*/
|
#define HEARTBEAT 5000 /*ms*/
|
||||||
#define HASH_LOAD_FACTOR /* 1. / */ 4
|
#define HASH_LOAD_FACTOR /* 1. / */ 4
|
||||||
#define MONITOR_MICROS 150000
|
#define MONITOR_MICROS 150000
|
||||||
|
|
Loading…
Add table
Reference in a new issue