diff --git a/api/boinc_api.C b/api/boinc_api.C index 8528375f53..e4bbd2f90a 100644 --- a/api/boinc_api.C +++ b/api/boinc_api.C @@ -93,22 +93,6 @@ static void cleanup_shared_mem(); static int update_app_progress(double frac_done, double cpu_t, double cp_cpu_t, double ws_t); static int set_timer(double period); -#ifndef _WIN32 -static bool core_client_is_running() { - int retval; - bool running = true; - retval = lock_semaphore(aid.core_semaphore_key); - if (!retval) { - // we got the semaphore - core client must not be running. - // release semaphore so that other apps can get it - // - running = false; - unlock_semaphore(aid.core_semaphore_key); - } - return running; -} -#endif - // Standard BOINC APIs // diff --git a/checkin_notes b/checkin_notes index 7c50faaf27..33a5dd0fb0 100755 --- a/checkin_notes +++ b/checkin_notes @@ -11115,3 +11115,22 @@ Rom Mar 29 2004 boinc_gui.vcproj win_build/installer/Script Files/ setup.rul + +David Mar 30 2004 + - preparation for moving prefs.C from client/ to lib/ + (so can use in server): + - add bool found_venue return value from GLOBAL_PREFS::parse_file() + - add separate show_global_prefs_source() to print messages + - before sending signals to ACTIVE_TASKs, check their state + to avoid signaling non-existent processes + (this caused the Unix client to crash when reset) + - remove remaining semaphore-related code + + api/ + boinc_api.C + client/ + app.C + client_state.C,h + cs_prefs.C + cs_scheduler.C + prefs.C,h diff --git a/client/app.C b/client/app.C index 7e81a46586..e77ff0ab33 100644 --- a/client/app.C +++ b/client/app.C @@ -553,11 +553,13 @@ pid_t wait4(pid_t pid, int *statusp, int options, struct rusage *rusagep) { #endif bool ACTIVE_TASK::task_exited() { + bool exited = false; + if (state != PROCESS_RUNNING) return true; #ifdef _WIN32 unsigned long exit_code; if (GetExitCodeProcess(pid_handle, &exit_code)) { if (exit_code != STILL_ACTIVE) { - return true; + exited = true; } } #else @@ -566,13 +568,18 @@ bool ACTIVE_TASK::task_exited() { my_pid = wait4(pid, &stat, WNOHANG, &rs); if (my_pid == pid) { + exited = true; + + // Is the following necessary?? double x = rs.ru_utime.tv_sec + rs.ru_utime.tv_usec/1.e6; result->final_cpu_time = current_cpu_time = checkpoint_cpu_time = starting_cpu_time + x; - return true; } #endif - return false; + if (exited) { + state = PROCESS_EXITED; + } + return exited; } // Inserts an active task into the ACTIVE_TASK_SET and starts it up @@ -964,7 +971,7 @@ int ACTIVE_TASK_SET::abort_project(PROJECT* project) { atp = *task_iter; if (atp->result->project == project) { task_iter = active_tasks.erase(task_iter); - delete atp; + delete atp; } else { task_iter++; } @@ -1041,6 +1048,7 @@ void ACTIVE_TASK_SET::request_tasks_exit(PROJECT* proj) { for (i=0; iwup->project != proj) continue; + if (atp->state != PROCESS_RUNNING) continue; atp->request_exit(); } } @@ -1054,6 +1062,7 @@ void ACTIVE_TASK_SET::kill_tasks(PROJECT* proj) { for (i=0; iwup->project != proj) continue; + if (atp->state != PROCESS_RUNNING) continue; atp->kill_task(); } } diff --git a/client/client_state.C b/client/client_state.C index b25076bc03..077a981d30 100644 --- a/client/client_state.C +++ b/client/client_state.C @@ -242,9 +242,16 @@ int CLIENT_STATE::init() { // Read the global preferences file, if it exists. // Do this after reading the state file so we know our venue // - retval = global_prefs.parse_file(host_venue); + bool found_venue; + retval = global_prefs.parse_file( + GLOBAL_PREFS_FILE_NAME, host_venue, found_venue + ); if (retval) { - msg_printf(NULL, MSG_INFO, "No general preferences found - using BOINC defaults"); + msg_printf(NULL, MSG_INFO, + "No general preferences found - using BOINC defaults" + ); + } else { + show_global_prefs_source(found_venue); } install_global_prefs(); diff --git a/client/client_state.h b/client/client_state.h index cc920f4d08..8a5458c76e 100644 --- a/client/client_state.h +++ b/client/client_state.h @@ -220,6 +220,7 @@ private: int suspend_activities(int reason); int resume_activities(); void install_global_prefs(); + void show_global_prefs_source(bool); // --------------- cs_scheduler.C: public: diff --git a/client/cs_apps.C b/client/cs_apps.C index cb70690c38..274045efb6 100644 --- a/client/cs_apps.C +++ b/client/cs_apps.C @@ -186,12 +186,19 @@ bool CLIENT_STATE::input_files_available(RESULT* rp) { unsigned int i; APP_VERSION* avp; FILE_REF fr; + PROJECT* project = rp->project; + avp = wup->avp; for (i=0; iapp_files.size(); i++) { fr = avp->app_files[i]; fip = fr.file_info; if (fip->status != FILE_PRESENT) return false; - if (!fip->verify_existing_file()) return false; + + // don't check file size for anonymous platform + // + if (!project->anonymous_platform) { + if (!fip->verify_existing_file()) return false; + } } for (i=0; iinput_files.size(); i++) { diff --git a/client/cs_prefs.C b/client/cs_prefs.C index 13f61ff887..f0522d3970 100644 --- a/client/cs_prefs.C +++ b/client/cs_prefs.C @@ -155,3 +155,28 @@ int CLIENT_STATE::resume_activities() { return 0; } +void CLIENT_STATE::show_global_prefs_source(bool found_venue) { + PROJECT* pp = lookup_project(global_prefs.source_project.c_str()); + if (pp) { + msg_printf(NULL, MSG_INFO, + "General prefs: from %s (last modified %s)\n", + pp->get_project_name(), time_to_string(global_prefs.mod_time) + ); + } else { + msg_printf(NULL, MSG_INFO, + "General prefs: from unknown project %s (last modified %s)\n", + global_prefs.source_project.c_str(), + time_to_string(global_prefs.mod_time) + ); + } + if (strlen(host_venue)) { + if (found_venue) { + msg_printf(NULL, MSG_INFO, "General prefs: using separate prefs for %s\n", host_venue); + } else { + msg_printf(NULL, MSG_INFO, + "General prefs: no separate prefs for %s; using your defaults\n", host_venue); + } + } else { + msg_printf(NULL, MSG_INFO, "General prefs: using your defaults\n"); + } +} diff --git a/client/cs_scheduler.C b/client/cs_scheduler.C index e5d4c9df2c..dcd1578d99 100644 --- a/client/cs_scheduler.C +++ b/client/cs_scheduler.C @@ -591,9 +591,16 @@ int CLIENT_STATE::handle_scheduler_reply( if (need_to_install_prefs) { - retval = global_prefs.parse_file(host_venue); - if (retval) return retval; - install_global_prefs(); + bool found_venue; + retval = global_prefs.parse_file( + GLOBAL_PREFS_FILE_NAME, host_venue, found_venue + ); + if (retval) { + msg_printf(NULL, MSG_ERROR, "Can't parse general preferences"); + } else { + show_global_prefs_source(found_venue); + install_global_prefs(); + } } // deal with project preferences (should always be there) diff --git a/client/prefs.C b/client/prefs.C index e0f8fa48d7..4b13c4e52d 100644 --- a/client/prefs.C +++ b/client/prefs.C @@ -80,10 +80,9 @@ GLOBAL_PREFS::GLOBAL_PREFS() { // where X==host_venue, then parse that and ignore the rest. // Otherwise ignore elements. // -int GLOBAL_PREFS::parse(FILE* in, char* host_venue) { +int GLOBAL_PREFS::parse(FILE* in, char* host_venue, bool& found_venue) { char buf[256], buf2[256]; bool in_venue = false, in_correct_venue=false; - bool found_venue = false; init(); @@ -95,6 +94,7 @@ int GLOBAL_PREFS::parse(FILE* in, char* host_venue) { run_on_startup = false; hangup_if_dialed = false; + found_venue = false; while (fgets(buf, 256, in)) { if (in_venue) { if (match_tag(buf, "")) { @@ -185,40 +185,20 @@ int GLOBAL_PREFS::parse(FILE* in, char* host_venue) { msg_printf(NULL, MSG_INFO, "GLOBAL_PREFS::parse: unrecognized: %s\n", buf); } } - PROJECT* pp = gstate.lookup_project(source_project.c_str()); - if (pp) { - msg_printf(NULL, MSG_INFO, - "General prefs: from %s (last modified %s)\n", - pp->get_project_name(), time_to_string(mod_time) - ); - } else { - msg_printf(NULL, MSG_INFO, - "General prefs: from unknown project %s (last modified %s)\n", - source_project.c_str(), time_to_string(mod_time) - ); - } - if (strlen(host_venue)) { - if (found_venue) { - msg_printf(NULL, MSG_INFO, "General prefs: using separate prefs for %s\n", host_venue); - } else { - msg_printf(NULL, MSG_INFO, - "General prefs: no separate prefs for %s; using your defaults\n", host_venue); - } - } else { - msg_printf(NULL, MSG_INFO, "General prefs: using your defaults\n"); - } return 0; } // Parse global prefs file // -int GLOBAL_PREFS::parse_file(char* host_venue) { +int GLOBAL_PREFS::parse_file( + char* filename, char* host_venue, bool& found_venue +) { FILE* f; int retval; - f = fopen(GLOBAL_PREFS_FILE_NAME, "r"); + f = fopen(filename, "r"); if (!f) return ERR_FOPEN; - retval = parse(f, host_venue); + retval = parse(f, host_venue, found_venue); fclose(f); return retval; } diff --git a/client/prefs.h b/client/prefs.h index 84c0dfc69b..748683b57e 100644 --- a/client/prefs.h +++ b/client/prefs.h @@ -20,11 +20,7 @@ #ifndef _PREFS_ #define _PREFS_ -#ifndef _WIN32 -#include -#endif - -#include "client_types.h" +#include // Global preferences are edited and stored on BOINC servers. // The native representation of preferences is XML. @@ -64,8 +60,8 @@ struct GLOBAL_PREFS { GLOBAL_PREFS(); void init(); - int parse(FILE*, char* venue); - int parse_file(char* venue); + int parse(FILE*, char* venue, bool& found_venue); + int parse_file(char* filename, char* venue, bool& found_venue); }; #endif diff --git a/doc/participate.php b/doc/participate.php index a48a9097a0..a9e2bdc562 100644 --- a/doc/participate.php +++ b/doc/participate.php @@ -15,6 +15,9 @@ echo "
  • Computation credit
  • Teams
  • Compiling BOINC software yourself +
  • User-supplied FAQs by + Paul D. Buck and + Chris Sutton

    Third-party software and web sites