Make more fixes and improvements

- Fix Makefile flaking due to ZIPOBJ_FLAGS generation
- Make printf() floating point and gdtoa thread safe
- Polish up the runit / runitd programs some more
- Prune some more makefile dependencies
This commit is contained in:
Justine Tunney 2022-06-13 11:02:13 -07:00
parent 3c285337a2
commit a3865ecc3c
61 changed files with 316 additions and 132 deletions

View file

@ -56,7 +56,7 @@ int cthread_join(cthread_t td, void **exitcode) {
if (~atomic_fetch_add(&td->state, cthread_joining) & cthread_finished) {
while ((x = atomic_load(&td->tid))) {
// FUTEX_WAIT_PRIVATE makes it hang
cthread_memory_wait32((uint32_t *)&td->tid, x, 0);
cthread_memory_wait32(&td->tid, x, 0);
}
}
if (exitcode) {

View file

@ -70,8 +70,8 @@ int cthread_sem_init(cthread_sem_t *, int);
int cthread_sem_destroy(cthread_sem_t *);
int cthread_sem_wait(cthread_sem_t *, int, const struct timespec *);
int cthread_sem_signal(cthread_sem_t *);
int cthread_memory_wait32(uint32_t *, uint32_t, const struct timespec *);
int cthread_memory_wake32(uint32_t *, int);
int cthread_memory_wait32(int *, int, const struct timespec *);
int cthread_memory_wake32(int *, int);
void cthread_zombies_add(cthread_t);
void cthread_zombies_reap(void);

View file

@ -24,12 +24,11 @@
#include "libc/thread/freebsd.internal.h"
#include "libc/thread/thread.h"
int cthread_memory_wait32(uint32_t* addr, uint32_t val,
const struct timespec* timeout) {
int cthread_memory_wait32(int* addr, int val, const struct timespec* timeout) {
size_t size;
struct _umtx_time *put, ut;
if (IsLinux() || IsOpenbsd()) {
return futex(addr, FUTEX_WAIT, val, timeout, 0);
return sys_futex(addr, FUTEX_WAIT, val, timeout, 0);
#if 0
} else if (IsFreebsd()) {
@ -59,9 +58,9 @@ int cthread_memory_wait32(uint32_t* addr, uint32_t val,
}
}
int cthread_memory_wake32(uint32_t* addr, int n) {
int cthread_memory_wake32(int* addr, int n) {
if (IsLinux() || IsOpenbsd()) {
return futex(addr, FUTEX_WAKE, n, 0, 0);
return sys_futex(addr, FUTEX_WAKE, n, 0, 0);
#if 0
} else if (IsFreebsd()) {
return _umtx_op(addr, UMTX_OP_MUTEX_WAKE, n, 0, 0);