Fix some issues

This commit is contained in:
Justine Tunney 2023-10-09 20:18:48 -07:00
parent 211d5d902e
commit 9d372f48dd
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
29 changed files with 373 additions and 63 deletions

View file

@ -18,9 +18,12 @@
*/
#include "libc/assert.h"
#include "libc/calls/calls.h"
#include "libc/calls/syscall-sysv.internal.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/intrin/atomic.h"
#include "libc/limits.h"
#include "libc/runtime/syslib.internal.h"
#include "libc/sysv/errfuns.h"
#include "libc/thread/semaphore.h"
@ -34,6 +37,13 @@
*/
int sem_trywait(sem_t *sem) {
int v;
#if 0
if (IsXnuSilicon() && sem->sem_magic == SEM_MAGIC_KERNEL) {
return _sysret(__syslib->__sem_trywait(sem->sem_kernel));
}
#endif
v = atomic_load_explicit(&sem->sem_value, memory_order_relaxed);
do {
unassert(v > INT_MIN);