Make fixes and improvements

- Introduce __assert_disable global
- Improve strsignal() thread safety
- Make system call tracing thread safe
- Fix SO_RCVTIMEO / SO_SNDTIMEO on Windows
- Refactor DescribeFoo() functions into one place
- Fix fork() on Windows when TLS and MAP_STACK exist
- Round upwards in setsockopt(SO_RCVTIMEO) on Windows
- Disable futexes on OpenBSD which seem extremely broken
- Implement a better kludge for monotonic time on Windows
This commit is contained in:
Justine Tunney 2022-06-25 18:17:31 -07:00
parent 5d837c4e7c
commit fbc053e018
186 changed files with 1836 additions and 1325 deletions

View file

@ -32,14 +32,6 @@
#include "libc/sysv/consts/sig.h"
#include "libc/sysv/errfuns.h"
static const char *DescribeHow(char buf[12], int how) {
if (how == SIG_BLOCK) return "SIG_BLOCK";
if (how == SIG_UNBLOCK) return "SIG_UNBLOCK";
if (how == SIG_SETMASK) return "SIG_SETMASK";
FormatInt32(buf, how);
return buf;
}
/**
* Changes signal blocking state of calling thread, e.g.:
*
@ -58,8 +50,6 @@ static const char *DescribeHow(char buf[12], int how) {
*/
int sigprocmask(int how, const sigset_t *opt_set, sigset_t *opt_out_oldset) {
sigset_t old;
char howbuf[12];
char buf[2][41];
int res, rc, arg1;
const sigset_t *arg2;
sigemptyset(&old);
@ -77,8 +67,7 @@ int sigprocmask(int how, const sigset_t *opt_set, sigset_t *opt_out_oldset) {
if (rc != -1 && opt_out_oldset) {
*opt_out_oldset = old;
}
STRACE("sigprocmask(%s, %s, [%s]) → %d% m", DescribeHow(howbuf, how),
DescribeSigset(buf[0], sizeof(buf[0]), 0, opt_set),
DescribeSigset(buf[1], sizeof(buf[1]), rc, opt_out_oldset), rc);
STRACE("sigprocmask(%s, %s, [%s]) → %d% m", DescribeHow(how),
DescribeSigset(0, opt_set), DescribeSigset(rc, opt_out_oldset), rc);
return rc;
}