mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-25 12:00:31 +00:00
Fix XNU / FreeBSD / OpenBSD / RHEL5 / NT bugs
For the first time ever, all tests in this codebase now pass, when run automatically on macos, freebsd, openbsd, rhel5, rhel7, alpine and windows via the network using the runit and runitd build tools - Fix vfork exec path etc. - Add XNU opendir() support - Add OpenBSD opendir() support - Add Linux history to syscalls.sh - Use copy_file_range on FreeBSD 13+ - Fix system calls with 7+ arguments - Fix Windows with greater than 16 FDs - Fix RUNIT.COM and RUNITD.COM flakiness - Fix OpenBSD munmap() when files are mapped - Fix long double so it's actually long on Windows - Fix OpenBSD truncate() and ftruncate() thunk typo - Let Windows fcntl() be used on socket files descriptors - Fix Windows fstat() which had an accidental printf statement - Fix RHEL5 CLOCK_MONOTONIC by not aliasing to CLOCK_MONOTONIC_RAW This is wonderful. I never could have dreamed it would be possible to get it working so well on so many platforms with tiny binaries. Fixes #31 Fixes #25 Fixes #14
This commit is contained in:
parent
c20dad3534
commit
45b72485ad
1032 changed files with 6083 additions and 2348 deletions
|
@ -115,6 +115,8 @@ static int ppatoi(const char **str) {
|
|||
*
|
||||
* @note implementation detail of printf(), snprintf(), etc.
|
||||
* @see printf() for wordier documentation
|
||||
* @asyncsignalsafe
|
||||
* @vforksafe
|
||||
*/
|
||||
hidden int palandprintf(void *fn, void *arg, const char *format, va_list va) {
|
||||
void *p;
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
* if the output buffer wasn't passed, or was too short, then the
|
||||
* number of characters that *would* have been written is returned
|
||||
* @see palandprintf() and printf() for detailed documentation
|
||||
* @asyncsignalsafe
|
||||
* @vforksafe
|
||||
*/
|
||||
int(snprintf)(char* buf, size_t count, const char* fmt, ...) {
|
||||
int rc;
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
*
|
||||
* @see palandprintf() and printf() for detailed documentation
|
||||
* @see snprintf() for same w/ buf size param
|
||||
* @asyncsignalsafe
|
||||
* @vforksafe
|
||||
*/
|
||||
int(sprintf)(char *buf, const char *fmt, ...) {
|
||||
int rc;
|
||||
|
|
|
@ -28,11 +28,12 @@
|
|||
|
||||
typedef int (*emit_f)(int (*)(long, void *), void *, wint_t);
|
||||
|
||||
static int StoaEmitByte(int f(long, void *), void *a, wint_t c) {
|
||||
static noinstrument int StoaEmitByte(int f(long, void *), void *a, wint_t c) {
|
||||
return f(c, a);
|
||||
}
|
||||
|
||||
static int StoaEmitWordEncodedString(int f(long, void *), void *a, uint64_t w) {
|
||||
static noinstrument int StoaEmitWordEncodedString(int f(long, void *), void *a,
|
||||
uint64_t w) {
|
||||
do {
|
||||
if (f(w & 0xff, a) == -1) {
|
||||
return -1;
|
||||
|
@ -41,7 +42,8 @@ static int StoaEmitWordEncodedString(int f(long, void *), void *a, uint64_t w) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int StoaEmitUnicode(int f(long, void *), void *a, wint_t c) {
|
||||
static noinstrument int StoaEmitUnicode(int f(long, void *), void *a,
|
||||
wint_t c) {
|
||||
if (isascii(c)) {
|
||||
return f(c, a);
|
||||
} else {
|
||||
|
@ -49,7 +51,7 @@ static int StoaEmitUnicode(int f(long, void *), void *a, wint_t c) {
|
|||
}
|
||||
}
|
||||
|
||||
static int StoaEmitQuoted(int f(long, void *), void *a, wint_t c) {
|
||||
static noinstrument int StoaEmitQuoted(int f(long, void *), void *a, wint_t c) {
|
||||
if (isascii(c)) {
|
||||
return StoaEmitWordEncodedString(f, a, cescapec(c));
|
||||
} else {
|
||||
|
@ -57,12 +59,14 @@ static int StoaEmitQuoted(int f(long, void *), void *a, wint_t c) {
|
|||
}
|
||||
}
|
||||
|
||||
static int StoaEmitVisualized(int f(long, void *), void *a, wint_t c) {
|
||||
static noinstrument int StoaEmitVisualized(int f(long, void *), void *a,
|
||||
wint_t c) {
|
||||
return StoaEmitUnicode(f, a, (*weaken(kCp437))[c]);
|
||||
}
|
||||
|
||||
static int StoaEmitQuote(int out(long, void *), void *arg, unsigned flags,
|
||||
char ch, unsigned char signbit) {
|
||||
static noinstrument int StoaEmitQuote(int out(long, void *), void *arg,
|
||||
unsigned flags, char ch,
|
||||
unsigned char signbit) {
|
||||
if (flags & FLAGS_REPR) {
|
||||
if (signbit == 63) {
|
||||
if (out('L', arg) == -1) return -1;
|
||||
|
|
|
@ -28,7 +28,8 @@ struct SprintfStr {
|
|||
size_t n;
|
||||
};
|
||||
|
||||
static int vsnprintfputchar(unsigned char c, struct SprintfStr *str) {
|
||||
static noinstrument int vsnprintfputchar(unsigned char c,
|
||||
struct SprintfStr *str) {
|
||||
if (str->i < str->n) str->p[str->i] = c;
|
||||
str->i++;
|
||||
return 0;
|
||||
|
@ -44,6 +45,8 @@ static int vsnprintfputchar(unsigned char c, struct SprintfStr *str) {
|
|||
* if the output buffer wasn't passed, or was too short, then the
|
||||
* number of characters that *would* have been written is returned
|
||||
* @see palandprintf() and printf() for detailed documentation
|
||||
* @asyncsignalsafe
|
||||
* @vforksafe
|
||||
*/
|
||||
int(vsnprintf)(char *buf, size_t size, const char *fmt, va_list va) {
|
||||
struct SprintfStr str = {buf, 0, size};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue