*** empty log message ***

svn path=/trunk/boinc/; revision=3192
This commit is contained in:
David Anderson 2004-03-30 23:05:34 +00:00
parent 54e51074c9
commit e4f9f62bd1
11 changed files with 98 additions and 60 deletions

View File

@ -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
//

View File

@ -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

View File

@ -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; i<active_tasks.size(); i++) {
atp = active_tasks[i];
if (proj && atp->wup->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; i<active_tasks.size(); i++) {
atp = active_tasks[i];
if (proj && atp->wup->project != proj) continue;
if (atp->state != PROCESS_RUNNING) continue;
atp->kill_task();
}
}

View File

@ -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();

View File

@ -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:

View File

@ -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; i<avp->app_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; i<wup->input_files.size(); i++) {

View File

@ -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");
}
}

View File

@ -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)

View File

@ -80,10 +80,9 @@ GLOBAL_PREFS::GLOBAL_PREFS() {
// where X==host_venue, then parse that and ignore the rest.
// Otherwise ignore <venue> 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, "</venue>")) {
@ -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;
}

View File

@ -20,11 +20,7 @@
#ifndef _PREFS_
#define _PREFS_
#ifndef _WIN32
#include <vector>
#endif
#include "client_types.h"
#include <stdio.h>
// 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

View File

@ -15,6 +15,9 @@ echo "
<li> <a href=credit.php>Computation credit</a>
<li> <a href=teams.php>Teams</a>
<li> <a href=anonymous_platform.php>Compiling BOINC software yourself</a>
<li> User-supplied FAQs by
<a href=http://homepage.mac.com/pauldbuck/>Paul D. Buck</a> and
<a href=http://users.iafrica.com/c/ch/chrissu/boinc-README.html>Chris Sutton</a>
</ul>
<p>
<b>Third-party software and web sites</b>