From dc0c9dbf405095a6483705b153f4c85c64499d4e Mon Sep 17 00:00:00 2001 From: Scott Gasch Date: Sat, 22 Aug 2026 15:27:59 -0700 Subject: Bug fixes. --- src/unix.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'src/unix.c') diff --git a/src/unix.c b/src/unix.c index 29ca6c7..99216d0 100644 --- a/src/unix.c +++ b/src/unix.c @@ -424,10 +424,11 @@ Return value: **/ { - __asm__("rdtsc;" - : - : - : "%eax", "%edx"); + ULONG uLow, uHigh; + + __asm__ volatile("rdtsc" + : "=a" (uLow), "=d" (uHigh)); + return(((UINT64)uHigh << 32) | (UINT64)uLow); } @@ -1068,25 +1069,30 @@ SystemCreateSemaphore(ULONG uValue) return(u); } -FLAG +FLAG SystemDeleteSemaphore(ULONG u) { union semun { int val; struct semid_ds *buf; unsigned short *array; } value; + FLAG fRet = TRUE; + memset(&value, 0, sizeof(value)); LOCK_SYSTEM; - if ((u < MAX_SEM) && (g_rgSemaphores[u] >= 0)) + if ((u < MAX_SEM) && (g_rgSemaphores[u] >= 0)) { - if (semctl(g_rgSemaphores[u], 0, IPC_RMID, value) < 0) + if (semctl(g_rgSemaphores[u], 0, IPC_RMID, value) < 0) { - return(FALSE); + fRet = FALSE; + } + else + { + g_rgSemaphores[u] = -1; } - g_rgSemaphores[u] = -1; } UNLOCK_SYSTEM; - return(TRUE); + return(fRet); } void -- cgit v1.3