diff --git a/api/boinc_api.cpp b/api/boinc_api.cpp index c58111a182..63f14e9d94 100644 --- a/api/boinc_api.cpp +++ b/api/boinc_api.cpp @@ -195,35 +195,32 @@ static int start_worker_signals(); char* boinc_msg_prefix(char* sbuf, int len) { char buf[256]; - struct tm* tm; + struct tm tm; + int n; + time_t x = time(0); - - if(x == (time_t)-1) { - *sbuf='\0'; // make sure there is a valid (empty) string returned + if (x == -1) { + strcpy(sbuf, "time() failed"); return sbuf; } - - if(!(tm = localtime(&x))) { - *sbuf='\0'; // make sure there is a valid (empty) string returned + if (localtime_r(&x, &tm) == NULL) { + strcpy(sbuf, "localtime() failed"); return sbuf; } - - if(!strftime(buf, sizeof(buf)-1, "%H:%M:%S", tm)) { - *sbuf='\0'; // make sure there is a valid (empty) string returned + if (strftime(buf, sizeof(buf)-1, "%H:%M:%S", &tm) == 0) { + strcpy(sbuf, "strftime() failed"); return sbuf; } - #ifdef _WIN32 - if(_snprintf(sbuf, len, "%s (%d):", buf, GetCurrentProcessId()) < 0) + n = _snprintf(sbuf, len, "%s (%d):", buf, GetCurrentProcessId()); #else - if(snprintf(sbuf, len, "%s (%d):", buf, getpid()) < 0) + n = snprintf(sbuf, len, "%s (%d):", buf, getpid()); #endif - { - *sbuf='\0'; // make sure there is a valid (empty) string returned + if (n < 0) { + strcpy(sbuf, "sprintf() failed"); return sbuf; - } - - sbuf[len-1] = '\0'; // just in case + } + sbuf[len-1] = 0; // just in case return sbuf; } diff --git a/checkin_notes b/checkin_notes index 2e177cfad3..75f1a1983e 100644 --- a/checkin_notes +++ b/checkin_notes @@ -8531,3 +8531,12 @@ Rom 01 Dec 2010 clientgui/ sg_StatImageLoader.cpp + +David 1 Dec 2010 + - API: use localtime_r() instead of localtime() + + api/ + boinc_api.cpp + client/ + acct_mgr_cpp + client_types.h diff --git a/client/acct_mgr.cpp b/client/acct_mgr.cpp index 5d3b284fd9..6672abffa1 100644 --- a/client/acct_mgr.cpp +++ b/client/acct_mgr.cpp @@ -74,9 +74,7 @@ int ACCT_MGR_OP::do_rpc( boinc_delete_file(ACCT_MGR_LOGIN_FILENAME); error_num = 0; for (i=0; iattached_via_acct_mgr = false; - p->ams_resource_share = -1; + gstate.projects[i]->detach_ams(); } return 0; } diff --git a/client/client_types.h b/client/client_types.h index e6196664f7..acc847d916 100644 --- a/client/client_types.h +++ b/client/client_types.h @@ -235,7 +235,14 @@ struct PROJECT : PROJ_AM { bool no_cuda_apps; bool no_ati_apps; + // the following are from the account manager, if any + // + bool no_cpu_ams; + bool no_cuda_ams; + bool no_ati_ams; + // the following set dynamically + // bool cuda_defer_sched; // This project has a CUDA job for which there's insuff. video RAM. // Don't fetch more CUDA jobs; they might have same problem @@ -455,6 +462,15 @@ struct PROJECT : PROJ_AM { void abort_not_started(); // abort unstarted jobs + // clear AMS-related fields + inline void detach_ams() { + attached_via_acct_mgr = false; + ams_resource_share = -1; + no_cpu_ams = false; + no_cuda_ams = false; + no_ati_ams = false; + } + #ifdef SIM RANDOM_PROCESS available; int index; diff --git a/samples/wrappture/Makefile b/samples/wrappture/Makefile index a0e7167086..3da96f4070 100644 --- a/samples/wrappture/Makefile +++ b/samples/wrappture/Makefile @@ -4,6 +4,7 @@ BOINC_DIR = ../.. BOINC_API_DIR = $(BOINC_DIR)/api BOINC_LIB_DIR = $(BOINC_DIR)/lib +RAPPTURE_DIR = ~/rappture/rappture/src/core CXXFLAGS = -g \ -I$(BOINC_DIR) \