From 1aa4230d9aeadf64715ae84bb23177d832733906 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 14 Apr 2004 23:32:17 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=3263 --- checkin_notes | 14 +++++++++++++- client/file_names.C | 12 +++++------- lib/app_ipc.C | 2 +- lib/filesys.C | 25 +++++++++++++++++++++++++ lib/filesys.h | 1 + sched/sched_config.C | 3 +++ sched/sched_config.h | 1 + sched/server_types.C | 3 +++ 8 files changed, 52 insertions(+), 9 deletions(-) diff --git a/checkin_notes b/checkin_notes index bba174374f..5191ec7d1e 100755 --- a/checkin_notes +++ b/checkin_notes @@ -11454,7 +11454,7 @@ David April 8 2004 David April 8 2004 - If an active task is in limbo, don't mark its result as done! - (from James Drew) + (from James Drews) client/ cs_apps.C @@ -11600,3 +11600,15 @@ David April 14 2004 top_hosts.php top_teams.php top_users.php + +David April 14 2004 + - added boinc_make_dirs() + (preliminary support for projects subdirs for CPDN) + - If is in config file, send it in sched replies + + lib/ + app_ipc.C + filesys.C,h + sched/ + sched_config.C,h + server_types.C diff --git a/client/file_names.C b/client/file_names.C index 1f0de631e5..50bc092545 100644 --- a/client/file_names.C +++ b/client/file_names.C @@ -81,31 +81,29 @@ int make_project_dir(PROJECT& p) { boinc_mkdir(PROJECTS_DIR); get_project_dir(&p, buf); - boinc_mkdir(buf); - return 0; + return boinc_mkdir(buf); } int remove_project_dir(PROJECT& p) { char buf[256]; + int retval; get_project_dir(&p, buf); clean_out_dir(buf); - boinc_rmdir(buf); - return 0; + return boinc_rmdir(buf); } // Create the slot directory for the specified slot # // int make_slot_dir(int slot) { char buf[256]; - if(slot<0) { + if (slot<0) { msg_printf(NULL, MSG_ERROR, "make_slot_dir(): negative slot\n"); return ERR_NEG; } boinc_mkdir(SLOTS_DIR); get_slot_dir(slot, buf); - boinc_mkdir(buf); - return 0; + return boinc_mkdir(buf); } void get_account_filename(char* master_url, char* path) { diff --git a/lib/app_ipc.C b/lib/app_ipc.C index 526483b096..7972e1e970 100755 --- a/lib/app_ipc.C +++ b/lib/app_ipc.C @@ -117,7 +117,7 @@ int parse_init_data_file(FILE* f, APP_INIT_DATA& ai) { #endif else if (parse_double(buf, "", ai.checkpoint_period)) continue; else if (parse_double(buf, "", ai.fraction_done_update_period)) continue; - else fprintf(stderr, "parse_init_data_file: unrecognized %s", buf); + //else fprintf(stderr, "parse_init_data_file: unrecognized %s", buf); } return 0; } diff --git a/lib/filesys.C b/lib/filesys.C index 0dcbf38f9a..cc6e0cc8d2 100755 --- a/lib/filesys.C +++ b/lib/filesys.C @@ -401,6 +401,31 @@ int boinc_rmdir(const char* name) { #endif } +// if "filepath" is of the form a/b/c, +// create directories dirpath/a, dirpath/a/b etc. +// +int boinc_make_dirs(const char* dirpath, const char* filepath) { + char buf[1024], oldpath[1024], newpath[1024]; + int retval; + char *p, *q; + + if (strlen(filepath) + strlen(dirpath) > 1023) return ERR_BUFFER_OVERFLOW; + strcpy(buf, filepath); + + q = buf; + while(*q) { + p = strchr(q, '/'); + if (!p) break; + *p = 0; + sprintf(newpath, "%s%s%s", oldpath, PATH_SEPARATOR, q); + retval = boinc_mkdir(newpath); + if (retval) return retval; + strcpy(oldpath, newpath); + q = p+1; + } + return 0; +} + int lock_file(char* filename) { int retval; diff --git a/lib/filesys.h b/lib/filesys.h index 6c4ad5d015..bc1827f50e 100755 --- a/lib/filesys.h +++ b/lib/filesys.h @@ -75,6 +75,7 @@ extern int lock_file(char*); extern void full_path(char* relname, char* path); #endif extern int get_filesystem_info(double& total, double& free); +extern int boinc_make_dirs(char*, char*); class DirScanner { #ifdef _WIN32 diff --git a/sched/sched_config.C b/sched/sched_config.C index f71fe8a601..1bcdecbc8e 100644 --- a/sched/sched_config.C +++ b/sched/sched_config.C @@ -64,6 +64,9 @@ int SCHED_CONFIG::parse(istream& f) { if (match_tag(buf.c_str(), "")) { one_result_per_user_per_wu = true; } + if (match_tag(buf.c_str(), "")) { + non_cpu_intensive = true; + } if (match_tag(buf.c_str(), "")) { trickle_down = true; } diff --git a/sched/sched_config.h b/sched/sched_config.h index 4e4c25e517..adad300c52 100644 --- a/sched/sched_config.h +++ b/sched/sched_config.h @@ -41,6 +41,7 @@ public: bool trickle_down; int min_sendwork_interval; int max_wus_to_send; + bool non_cpu_intensive; int parse(istream& f); int parse_file(char* dir="."); diff --git a/sched/server_types.C b/sched/server_types.C index 7bec992986..1c7c0a683d 100644 --- a/sched/server_types.C +++ b/sched/server_types.C @@ -310,6 +310,9 @@ int SCHEDULER_REPLY::write(FILE* fout) { td.xml ); } + if (config.non_cpu_intensive) { + fprintf(fout, "\n"); + } end: fprintf(fout, "\n"