diff --git a/checkin_notes b/checkin_notes index 6e150749dc..2c72c70b3d 100644 --- a/checkin_notes +++ b/checkin_notes @@ -2987,3 +2987,20 @@ Charlie April 1 2008 mac_build/ boinc.xcodeproj/ project.pbxproj + +David April 2 2008 + - Client/server protocol: + send if client understands + app version plan class. + The server checks for this instead of version > 6.11. + - clean up unix_util: .h files declare only (extern) interfaces; + no reason for daemon() to be C + + client/ + cs_scheduler.C + lib/ + unix_util.C,h + sched/ + sched_plan.C + sched_send.C + server_types.C,h diff --git a/client/cs_scheduler.C b/client/cs_scheduler.C index 391f29eca9..8832bccd20 100644 --- a/client/cs_scheduler.C +++ b/client/cs_scheduler.C @@ -134,6 +134,12 @@ int CLIENT_STATE::make_scheduler_request(PROJECT* p) { p->duration_correction_factor ); + // write client capabilities + // + fprintf(f, + " \n" + ); + write_platforms(p, mf); // send supported app_versions for anonymous platform clients diff --git a/lib/unix_util.C b/lib/unix_util.C index 02c19f10be..b62257ea9c 100644 --- a/lib/unix_util.C +++ b/lib/unix_util.C @@ -1,6 +1,6 @@ // Berkeley Open Infrastructure for Network Computing // http://boinc.berkeley.edu -// Copyright (C) 2005 University of California +// Copyright (C) 2008 University of California // // This is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -15,45 +15,46 @@ // To view the GNU Lesser General Public License visit // http://www.gnu.org/copyleft/lesser.html // or write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "unix_util.h" #ifndef HAVE_DAEMON -FILE *stderr_null, *stdout_null; +#include +#include + +static FILE *stderr_null, *stdout_null; int daemon(int nochdir, int noclose) { - pid_t childpid,sessionid; - if (!nochdir) { - chdir("/"); - } - if (!noclose) { - stderr_null=freopen("/dev/null","w",stderr); - stdout_null=freopen("/dev/null","w",stdout); - } - childpid=fork(); - if (childpid>0) { - // Fork successful. We are the parent process. - _exit(0); - } - if (childpid<0) { - // Fork unsuccessful. Return -1 - return -1; - } + pid_t childpid,sessionid; + if (!nochdir) { + chdir("/"); + } + if (!noclose) { + stderr_null = freopen("/dev/null", "w", stderr); + stdout_null = freopen("/dev/null", "w", stdout); + } + childpid = fork(); + if (childpid>0) { + // Fork successful. We are the parent process. + _exit(0); + } + if (childpid < 0) { + // Fork unsuccessful. Return -1 + return -1; + } - // Fork successful, We are the child. Make us the lead process of a new - // session. - sessionid=setsid(); - if (sessionid <= 0) { - // setsid() failed - return -1; - } + // Fork successful, We are the child. Make us the lead process of a new + // session. + sessionid = setsid(); + if (sessionid <= 0) { + // setsid() failed + return -1; + } - // success - return 0; -} + // success + return 0; +} #endif /* HAVE_DAEMON */ - - diff --git a/lib/unix_util.h b/lib/unix_util.h index d5f3abb1c8..1428330168 100644 --- a/lib/unix_util.h +++ b/lib/unix_util.h @@ -1,6 +1,6 @@ // Berkeley Open Infrastructure for Network Computing // http://boinc.berkeley.edu -// Copyright (C) 2005 University of California +// Copyright (C) 2008 University of California // // This is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -15,7 +15,7 @@ // To view the GNU Lesser General Public License visit // http://www.gnu.org/copyleft/lesser.html // or write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #ifndef UNIX_UTIL_H #define UNIX_UTIL_H @@ -25,30 +25,9 @@ #include "config.h" - -#ifdef __cplusplus -#include -#include -#else -#include -#include -#endif - -#ifdef HAVE_UNISTD_H -#include -#endif - #ifndef HAVE_DAEMON -#ifdef __cplusplus -extern "C" { -#endif - -int daemon(int nochdir, int noclose); - -#ifdef __cplusplus -} -#endif +extern int daemon(int nochdir, int noclose); #endif /* HAVE_DAEMON */ diff --git a/sched/sched_plan.C b/sched/sched_plan.C index fa4d732d12..046e1b28b1 100644 --- a/sched/sched_plan.C +++ b/sched/sched_plan.C @@ -43,12 +43,6 @@ static void get_ncpus(SCHEDULER_REQUEST& sreq, int& ncpus, bool& bounded) { } bool app_plan(SCHEDULER_REQUEST& sreq, char* plan_class, HOST_USAGE& hu) { - // clients before 6.1.11 don't understand plan_class - // - int v = sreq.core_client_major_version*10000 - + sreq.core_client_minor_version*100 - + sreq.core_client_release; - if (v < 60111) return false; if (!strcmp(plan_class, "mt")) { // the following is for an app that can use anywhere // from 1 to 64 threads, can control this exactly, diff --git a/sched/sched_send.C b/sched/sched_send.C index 5e6a11bb27..3ddd96f85b 100644 --- a/sched/sched_send.C +++ b/sched/sched_send.C @@ -170,7 +170,7 @@ BEST_APP_VERSION* get_app_version( reply.wreq.outdated_core = true; continue; } - if (strlen(av.plan_class)) { + if (strlen(av.plan_class) && sreq.client_cap_plan_class) { if (!app_plan(sreq, av.plan_class, host_usage)) { continue; } diff --git a/sched/server_types.C b/sched/server_types.C index 642f706ff5..42c4101933 100644 --- a/sched/server_types.C +++ b/sched/server_types.C @@ -161,6 +161,7 @@ int SCHEDULER_REQUEST::parse(FILE* fin) { have_other_results_list = false; have_ip_results_list = false; have_time_stats_log = false; + client_cap_plan_class = false; char* unused = fgets(buf, sizeof(buf), fin); if (!match_tag(buf, "")) return ERR_XML_PARSE; @@ -306,6 +307,7 @@ int SCHEDULER_REQUEST::parse(FILE* fin) { coprocs.parse(fin); continue; } + if (parse_bool(buf, "client_cap_plan_class", client_cap_plan_class)) continue; if (match_tag(buf, "")) continue; if (match_tag(buf, "")) continue; diff --git a/sched/server_types.h b/sched/server_types.h index 626df7b933..3dedd1bc22 100644 --- a/sched/server_types.h +++ b/sched/server_types.h @@ -270,6 +270,7 @@ struct SCHEDULER_REQUEST { bool have_other_results_list; bool have_ip_results_list; bool have_time_stats_log; + bool client_cap_plan_class; SCHEDULER_REQUEST(); ~SCHEDULER_REQUEST();