summaryrefslogtreecommitdiff
path: root/src/unix.c
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2026-08-22 15:27:59 -0700
committerScott Gasch <[email protected]>2026-08-22 15:27:59 -0700
commitdc0c9dbf405095a6483705b153f4c85c64499d4e (patch)
treed83b20c0095726055327cb2879c0a53a591ff4de /src/unix.c
parenta99cc7a0289e4106f6bb1954660a3df5c53d470b (diff)
Bug fixes.
Diffstat (limited to 'src/unix.c')
-rw-r--r--src/unix.c26
1 files changed, 16 insertions, 10 deletions
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