From 2713f5662dfde971db9d71a71bd23777d7d9312f Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Wed, 26 Sep 2007 10:17:11 +0000 Subject: [PATCH] Mac/Linux/UNIX: V6 apps uses shmget() to run with V5 clients svn path=/trunk/boinc/; revision=13669 --- api/boinc_api.C | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/api/boinc_api.C b/api/boinc_api.C index 06a80ef421..4c22c56568 100644 --- a/api/boinc_api.C +++ b/api/boinc_api.C @@ -170,17 +170,19 @@ static int setup_shared_mem() { app_client_shm = NULL; } #else -#ifdef USE_FILE_MAPPED_SHMEM - if (attach_shmem( MMAPPED_FILE_NAME, (void**)&app_client_shm->shm)) { - delete app_client_shm; - app_client_shm = NULL; + if (aid.shmem_seg_name == -1) { + // Version 6 Unix/Linux/Mac client + if (attach_shmem_mmap( MMAPPED_FILE_NAME, (void**)&app_client_shm->shm)) { + delete app_client_shm; + app_client_shm = NULL; + } + } else { + // EMX or version 5 Unix/Linux/Mac client + if (attach_shmem(aid.shmem_seg_name, (void**)&app_client_shm->shm)) { + delete app_client_shm; + app_client_shm = NULL; + } } -#else - if (attach_shmem(aid.shmem_seg_name, (void**)&app_client_shm->shm)) { - delete app_client_shm; - app_client_shm = NULL; - } -#endif // ! USE_FILE_MAPPED_SHMEM #endif // ! _WIN32 if (app_client_shm == NULL) return -1; return 0;