- Client/server protocol:

send <client_cap_plan_class/> 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

svn path=/trunk/boinc/; revision=15006
This commit is contained in:
David Anderson 2008-04-02 19:05:08 +00:00
parent 291a192efe
commit 8ba1188dd0
8 changed files with 63 additions and 63 deletions

View File

@ -2987,3 +2987,20 @@ Charlie April 1 2008
mac_build/
boinc.xcodeproj/
project.pbxproj
David April 2 2008
- Client/server protocol:
send <client_cap_plan_class/> 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

View File

@ -134,6 +134,12 @@ int CLIENT_STATE::make_scheduler_request(PROJECT* p) {
p->duration_correction_factor
);
// write client capabilities
//
fprintf(f,
" <client_cap_plan_class/>\n"
);
write_platforms(p, mf);
// send supported app_versions for anonymous platform clients

View File

@ -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 <cstdio>
#include <cstdlib>
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 */

View File

@ -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 <cstdio>
#include <cstdlib>
#else
#include <stdio.h>
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#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 */

View File

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

View File

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

View File

@ -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, "<scheduler_request>")) 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, "<active_task_set>")) continue;
if (match_tag(buf, "<app>")) continue;

View File

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