1
0
mirror of https://github.com/simh/simh.git synced 2026-02-27 01:00:07 +00:00

SHMEM: Fix all Linux code paths to only use shm_ APIs when available

This commit is contained in:
Mark Pizzolato
2020-07-09 08:27:57 -07:00
parent e2d0095010
commit a73ab48c0e

View File

@@ -626,12 +626,14 @@ if ((*shmem)->shm_base == MAP_FAILED) {
*addr = (*shmem)->shm_base;
return SCPE_OK;
#else
*shmem = NULL;
return SCPE_NOFNC;
#endif
}
void sim_shmem_close (SHMEM *shmem)
{
#if defined (HAVE_SHM_OPEN)
if (shmem == NULL)
return;
if (shmem->shm_base != MAP_FAILED)
@@ -642,12 +644,13 @@ if (shmem->shm_fd != -1) {
}
free (shmem->shm_name);
free (shmem);
#endif
}
int32 sim_shmem_atomic_add (int32 *p, int32 v)
{
#if defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
return __sync_add_and_fetch((int *) p, v);
return __sync_add_and_fetch ((int *) p, v);
#else
return *p + v;
#endif