SHMEM: Fix all Linux code paths to only use shm_ APIs when available
This commit is contained in:
parent
e2d0095010
commit
a73ab48c0e
1 changed files with 4 additions and 1 deletions
|
@ -626,12 +626,14 @@ if ((*shmem)->shm_base == MAP_FAILED) {
|
||||||
*addr = (*shmem)->shm_base;
|
*addr = (*shmem)->shm_base;
|
||||||
return SCPE_OK;
|
return SCPE_OK;
|
||||||
#else
|
#else
|
||||||
|
*shmem = NULL;
|
||||||
return SCPE_NOFNC;
|
return SCPE_NOFNC;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void sim_shmem_close (SHMEM *shmem)
|
void sim_shmem_close (SHMEM *shmem)
|
||||||
{
|
{
|
||||||
|
#if defined (HAVE_SHM_OPEN)
|
||||||
if (shmem == NULL)
|
if (shmem == NULL)
|
||||||
return;
|
return;
|
||||||
if (shmem->shm_base != MAP_FAILED)
|
if (shmem->shm_base != MAP_FAILED)
|
||||||
|
@ -642,12 +644,13 @@ if (shmem->shm_fd != -1) {
|
||||||
}
|
}
|
||||||
free (shmem->shm_name);
|
free (shmem->shm_name);
|
||||||
free (shmem);
|
free (shmem);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 sim_shmem_atomic_add (int32 *p, int32 v)
|
int32 sim_shmem_atomic_add (int32 *p, int32 v)
|
||||||
{
|
{
|
||||||
#if defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
|
#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
|
#else
|
||||||
return *p + v;
|
return *p + v;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue