mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-28 08:12:28 +00:00
Get Redbean fork() working on the New Technology
Now that we have understandable system call tracing on Windows, this change rewrites many of the polyfill internals for that platform, to help things get closer to tip top shape. Support for complex forking scenarios had been in a regressed state for quite some time. Now, it works! Subsequent changes should be able to address the performance.
This commit is contained in:
parent
efedef6e65
commit
0cb6b6ff4b
84 changed files with 1340 additions and 338 deletions
|
@ -54,16 +54,16 @@ struct Timestamps {
|
|||
extern int __pid;
|
||||
extern bool __replmode;
|
||||
extern bool __nomultics;
|
||||
static volatile unsigned long long kbirth;
|
||||
volatile unsigned long long __kbirth;
|
||||
|
||||
privileged static struct Timestamps kenter(void) {
|
||||
struct Timestamps ts;
|
||||
ts.start = rdtsc();
|
||||
ts.birth = kbirth;
|
||||
ts.birth = __kbirth;
|
||||
if (!ts.birth) {
|
||||
ts.birth = kStartTsc;
|
||||
if (!ts.birth) ts.birth = 1;
|
||||
cmpxchg(&kbirth, 0, ts.birth);
|
||||
cmpxchg(&__kbirth, 0, ts.birth);
|
||||
}
|
||||
return ts;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ privileged static void kleave(struct Timestamps ts) {
|
|||
elapse = unsignedsubtract(finish, ts.start);
|
||||
adjust = ts.birth + elapse;
|
||||
if (!adjust) adjust = 1;
|
||||
cmpxchg(&kbirth, ts.birth, adjust); /* ignore overlapping time intervals */
|
||||
cmpxchg(&__kbirth, ts.birth, adjust); /* ignore overlapping time intervals */
|
||||
}
|
||||
|
||||
privileged static inline char *kadvance(char *p, char *e, long n) {
|
||||
|
@ -465,7 +465,8 @@ privileged static size_t kformat(char *b, size_t n, const char *fmt, va_list va,
|
|||
}
|
||||
goto EmitChar;
|
||||
case 'm':
|
||||
if (!(x = errno) && sign == ' ') {
|
||||
if (!(x = errno) && sign == ' ' &&
|
||||
(!IsWindows() || !__imp_GetLastError())) {
|
||||
break;
|
||||
} else if (weaken(strerror_r) &&
|
||||
!weaken(strerror_r)(x, z, sizeof(z))) {
|
||||
|
@ -572,7 +573,7 @@ privileged static size_t kformat(char *b, size_t n, const char *fmt, va_list va,
|
|||
goto EmitChar;
|
||||
}
|
||||
} else if (type < -1) {
|
||||
if ((t = *s++ & 255)) {
|
||||
if ((t = *s++ & 255) || prec) {
|
||||
t = kCp437[t];
|
||||
}
|
||||
} else if (type < 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue