diff --git a/client/app.cpp b/client/app.cpp index 162a6389c5..0f0e39cd86 100644 --- a/client/app.cpp +++ b/client/app.cpp @@ -229,7 +229,7 @@ void ACTIVE_TASK::cleanup_task() { if (app_client_shm.shm) { #ifndef __EMX__ - if (app_version->api_major_version() >= 6) { + if (app_version->api_version_at_least(6, 0)) { retval = detach_shmem_mmap(app_client_shm.shm, sizeof(SHARED_MEM)); } else #endif diff --git a/client/app_start.cpp b/client/app_start.cpp index aa403242e5..dbf876aaad 100644 --- a/client/app_start.cpp +++ b/client/app_start.cpp @@ -163,7 +163,7 @@ int ACTIVE_TASK::get_shmem_seg_name() { char init_data_path[MAXPATHLEN]; #ifndef __EMX__ // shmem_seg_name is not used with mmap() shared memory - if (app_version->api_major_version() >= 6) { + if (app_version->api_version_at_least(6, 0)) { shmem_seg_name = -1; return 0; } @@ -512,7 +512,7 @@ int ACTIVE_TASK::start(bool test) { unsigned int i; FILE_REF fref; FILE_INFO* fip; - int retval, rt; + int retval; APP_INIT_DATA aid; #ifdef _WIN32 bool success = false; @@ -693,9 +693,11 @@ int ACTIVE_TASK::start(bool test) { sprintf(cmdline, "%s %s %s", exec_path, wup->command_line.c_str(), app_version->cmdline ); - rt = app_version->gpu_usage.rsc_type; - if (rt) { - coproc_cmdline(rt, result, app_version->gpu_usage.usage, cmdline); + if (!app_version->api_version_at_least(7, 5)) { + rt = app_version->gpu_usage.rsc_type; + if (rt) { + coproc_cmdline(rt, result, app_version->gpu_usage.usage, cmdline); + } } relative_to_absolute(slot_dir, slotdirpath); @@ -884,9 +886,11 @@ int ACTIVE_TASK::start(bool test) { wup->command_line.c_str(), app_version->cmdline ); - rt = app_version->gpu_usage.rsc_type; - if (rt) { - coproc_cmdline(rt, result, app_version->gpu_usage.usage, cmdline); + if (!app_version->api_version_at_least(7, 5)) { + int rt = app_version->gpu_usage.rsc_type; + if (rt) { + coproc_cmdline(rt, result, app_version->gpu_usage.usage, cmdline); + } } // Set up client/app shared memory seg if needed @@ -895,7 +899,7 @@ int ACTIVE_TASK::start(bool test) { #ifdef ANDROID if (true) { #else - if (app_version->api_major_version() >= 6) { + if (app_version->api_version_at_least(6, 0)) { #endif // Use mmap() shared memory sprintf(buf, "%s/%s", slot_dir, MMAPPED_FILE_NAME); diff --git a/client/client_types.cpp b/client/client_types.cpp index a641e3d550..28036ab7c5 100644 --- a/client/client_types.cpp +++ b/client/client_types.cpp @@ -983,11 +983,13 @@ void APP_VERSION::clear_errors() { } } -int APP_VERSION::api_major_version() { - int v, n; - n = sscanf(api_version, "%d", &v); - if (n != 1) return 0; - return v; +bool APP_VERSION::api_version_at_least(int major, int minor) { + int maj, min, n; + n = sscanf(api_version, "%d.%d", &maj, &min); + if (n != 2) return false; + if (maj < major) return false; + if (maj > major) return true; + return min >= minor; } int FILE_REF::parse(XML_PARSER& xp) { diff --git a/client/client_types.h b/client/client_types.h index 325dd1034c..908b21eb8a 100644 --- a/client/client_types.h +++ b/client/client_types.h @@ -282,7 +282,7 @@ struct APP_VERSION { char api_version[16]; double avg_ncpus; double max_ncpus; - GPU_USAGE gpu_usage; // can only use 1 GPUtype + GPU_USAGE gpu_usage; // can only use 1 GPU type double gpu_ram; double flops; char cmdline[256]; @@ -326,7 +326,7 @@ struct APP_VERSION { bool had_download_failure(int& failnum); void get_file_errors(std::string&); void clear_errors(); - int api_major_version(); + bool api_version_at_least(int major, int minor); inline bool uses_coproc(int rt) { return (gpu_usage.rsc_type == rt); }