mirror of https://github.com/BOINC/boinc.git
parent
615ff954a9
commit
a85f32729a
10
Makefile.in
10
Makefile.in
|
@ -26,17 +26,13 @@ ifndef BOINC_EMAIL
|
|||
BOINC_WARN_ENV = 1
|
||||
BOINC_EMAIL_MSG = $(ENV_MSG_1)"BOINC_EMAIL"$(ENV_MSG_2)
|
||||
endif
|
||||
ifndef BOINC_URL_BASE
|
||||
BOINC_WARN_ENV = 1
|
||||
BOINC_URL_BASE_MSG = $(ENV_MSG_1)"BOINC_URL_BASE"$(ENV_MSG_2)
|
||||
endif
|
||||
ifndef BOINC_KEY_DIR
|
||||
BOINC_WARN_ENV = 1
|
||||
BOINC_KEY_DIR_MSG = $(ENV_MSG_1)"BOINC_KEY_DIR"$(ENV_MSG_2)
|
||||
endif
|
||||
ifndef BOINC_KEY
|
||||
ifndef BOINC_SHMEM_KEY
|
||||
BOINC_WARN_ENV = 1
|
||||
BOINC_KEY_MSG = $(ENV_MSG_1)"BOINC_KEY"$(ENV_MSG_2)
|
||||
BOINC_SHMEM_KEY_MSG = $(ENV_MSG_1)"BOINC_SHMEM_KEY"$(ENV_MSG_2)
|
||||
endif
|
||||
ifndef BOINC_DB_NAME
|
||||
BOINC_WARN_ENV = 1
|
||||
|
@ -66,7 +62,7 @@ ENV_MESSAGES = "****************************************" \
|
|||
$(BOINC_EMAIL_MSG) \
|
||||
$(BOINC_URL_BASE_MSG) \
|
||||
$(BOINC_KEY_DIR_MSG) \
|
||||
$(BOINC_KEY_MSG) \
|
||||
$(BOINC_SHMEM_KEY_MSG) \
|
||||
$(BOINC_DB_NAME_MSG) \
|
||||
$(BOINC_USER_MSG) \
|
||||
$(BOINC_UPLOAD_URL_MSG) \
|
||||
|
|
|
@ -1667,3 +1667,35 @@ David August 24, 2002
|
|||
filesys.C,h
|
||||
lib/
|
||||
error_numbers.h
|
||||
|
||||
David August 25, 2002
|
||||
- Implemented project name (as shown in GUI).
|
||||
It's stored in the DB (in a single-row "project" table)
|
||||
and sent in scheduler RPC
|
||||
- Changed env var BOINC_KEY to BOINC_SHMEM_KEY
|
||||
(avoid confusion w/ encryption keys)
|
||||
|
||||
Makefile.in
|
||||
client/
|
||||
cs_scheduler.C
|
||||
filesys.C
|
||||
scheduler_op.C,h
|
||||
win/
|
||||
windows_cpp.h
|
||||
wingui.cpp
|
||||
db/
|
||||
db.h
|
||||
db_mysql.C
|
||||
schema.sql
|
||||
sched/
|
||||
Makefile.in
|
||||
feeder.C
|
||||
main.C
|
||||
server_types.C
|
||||
show_shmem.C
|
||||
test/
|
||||
init.inc
|
||||
test_uc.php
|
||||
test_uc_win.php
|
||||
tools/
|
||||
add.C
|
||||
|
|
|
@ -182,8 +182,8 @@ int CLIENT_STATE::make_scheduler_request(PROJECT* p, double work_req) {
|
|||
p->authenticator,
|
||||
p->hostid,
|
||||
p->rpc_seqno,
|
||||
platform_name,
|
||||
version,
|
||||
platform_name,
|
||||
version,
|
||||
work_req
|
||||
);
|
||||
if (p->code_sign_key) {
|
||||
|
@ -319,6 +319,9 @@ void CLIENT_STATE::handle_scheduler_reply(
|
|||
f = fopen(SCHED_OP_RESULT_FILE, "r");
|
||||
retval = sr.parse(f);
|
||||
|
||||
if (strlen(sr.project_name)) {
|
||||
strcpy(project->project_name, sr.project_name);
|
||||
}
|
||||
if (strlen(sr.message)) {
|
||||
show_message(sr.message, sr.message_priority);
|
||||
}
|
||||
|
@ -395,23 +398,23 @@ void CLIENT_STATE::handle_scheduler_reply(
|
|||
if (!project->code_sign_key) {
|
||||
project->code_sign_key = strdup(sr.code_sign_key);
|
||||
} else {
|
||||
if (sr.code_sign_key_signature) {
|
||||
retval = verify_string2(
|
||||
sr.code_sign_key, sr.code_sign_key_signature,
|
||||
project->code_sign_key, signature_valid
|
||||
);
|
||||
if (!retval && signature_valid) {
|
||||
free(project->code_sign_key);
|
||||
project->code_sign_key = strdup(sr.code_sign_key);
|
||||
} else {
|
||||
fprintf(stdout,
|
||||
"New code signing key from %s doesn't validate\n",
|
||||
project->project_name
|
||||
);
|
||||
}
|
||||
} else {
|
||||
fprintf(stdout, "Missing code sign key signature\n");
|
||||
}
|
||||
if (sr.code_sign_key_signature) {
|
||||
retval = verify_string2(
|
||||
sr.code_sign_key, sr.code_sign_key_signature,
|
||||
project->code_sign_key, signature_valid
|
||||
);
|
||||
if (!retval && signature_valid) {
|
||||
free(project->code_sign_key);
|
||||
project->code_sign_key = strdup(sr.code_sign_key);
|
||||
} else {
|
||||
fprintf(stdout,
|
||||
"New code signing key from %s doesn't validate\n",
|
||||
project->project_name
|
||||
);
|
||||
}
|
||||
} else {
|
||||
fprintf(stdout, "Missing code sign key signature\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -265,7 +265,7 @@ int boinc_rename(char* old, char* newf) {
|
|||
|
||||
#ifdef _WIN32
|
||||
void full_path(char* relname, char* path) {
|
||||
_getcwd(path, 256);
|
||||
_getcwd(path, 256);
|
||||
strcat(path, PATH_SEPARATOR);
|
||||
strcat(path, relname);
|
||||
}
|
||||
|
|
|
@ -214,7 +214,7 @@ bool SCHEDULER_OP::poll() {
|
|||
// here we're fetching the master file for a project
|
||||
//
|
||||
if (http_op.http_op_state == HTTP_STATE_DONE) {
|
||||
action = true;
|
||||
action = true;
|
||||
project->master_url_fetch_pending = false;
|
||||
http_ops->remove(&http_op);
|
||||
if (http_op.http_op_retval == 0) {
|
||||
|
@ -265,7 +265,7 @@ bool SCHEDULER_OP::poll() {
|
|||
//
|
||||
scheduler_op_done = false;
|
||||
if (http_op.http_op_state == HTTP_STATE_DONE) {
|
||||
action = true;
|
||||
action = true;
|
||||
http_ops->remove(&http_op);
|
||||
if (http_op.http_op_retval) {
|
||||
if (log_flags.sched_op_debug) {
|
||||
|
@ -374,6 +374,8 @@ int SCHEDULER_REPLY::parse(FILE* in) {
|
|||
// Do nothing
|
||||
} else if (match_tag(buf, "</scheduler_reply>")) {
|
||||
return 0;
|
||||
} else if (parse_str(buf, "<project_name>", project_name)) {
|
||||
continue;
|
||||
} else if (parse_int(buf, "<hostid>", hostid)) {
|
||||
continue;
|
||||
} else if (parse_int(buf, "<request_delay>", request_delay)) {
|
||||
|
@ -385,11 +387,11 @@ int SCHEDULER_REPLY::parse(FILE* in) {
|
|||
if (retval) return ERR_XML_PARSE;
|
||||
} else if (match_tag(buf, "<code_sign_key>")) {
|
||||
retval = dup_element_contents(in, "</code_sign_key>", &code_sign_key);
|
||||
//fprintf(stderr, "code_sign_key: %s\n", code_sign_key);
|
||||
//fprintf(stderr, "code_sign_key: %s\n", code_sign_key);
|
||||
if (retval) {
|
||||
fprintf(stderr, "error: SCHEDULER_REPLY.parse: xml parsing error\n");
|
||||
fprintf(stderr, "error: SCHEDULER_REPLY.parse: xml parsing error\n");
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
}
|
||||
} else if (match_tag(buf, "<code_sign_key_signature>")) {
|
||||
retval = dup_element_contents(in, "</code_sign_key_signature>", &code_sign_key_signature);
|
||||
if (retval) return ERR_XML_PARSE;
|
||||
|
|
|
@ -75,6 +75,7 @@ struct SCHEDULER_REPLY {
|
|||
int request_delay;
|
||||
char message[1024];
|
||||
char message_priority[256];
|
||||
char project_name[256];
|
||||
int prefs_mod_time;
|
||||
char* prefs_xml;
|
||||
vector<APP> apps;
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
#ifndef _WINDOWS_CPP
|
||||
#define _WINDOWS_CPP
|
||||
|
||||
#define HOSTTYPE "Windows"
|
||||
#define HOST "Windows"
|
||||
#define HOSTTYPE "windows_intelx86"
|
||||
#define HOST "windows_intelx86"
|
||||
#define VERSION 1
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
#define IDC_LOGIN_OK 3
|
||||
#endif
|
||||
|
||||
// Global vars
|
||||
|
||||
CMainWindow* main_window;
|
||||
CFont m_fontMain;
|
||||
CMyApp myApp;
|
||||
|
@ -27,6 +29,82 @@ TEXT_TABLE user_info;
|
|||
int m_cxChar;
|
||||
int m_cyChar;
|
||||
|
||||
char* result_titles[] = {"Project", "Application", "CPU time", "status"};
|
||||
int result_widths[] = {12, 20, 12, 18};
|
||||
char* file_xfer_titles[] = {"Project", "File", "Size", "direction"};
|
||||
int file_xfer_widths[] = {12, 20, 12, 12};
|
||||
char* disk_usage_titles[] = {"Project", "space used"};
|
||||
int disk_usage_widths[] = {12, 20};
|
||||
char* project_titles[] = {"Project", "total CPU", "share"};
|
||||
int project_widths[] = {12, 15, 15};
|
||||
char* user_info_titles[] = {"Name", "Team", "Total credit", "Recent credit"};
|
||||
int user_info_widths[] = {20, 20, 15, 15};
|
||||
|
||||
void show_message(char* p, char* prior) {
|
||||
//MessageBox(NULL, p, prior, MB_OK);
|
||||
printf("Message (%s): %s\n", prior, p);
|
||||
}
|
||||
|
||||
int initialize_prefs() {
|
||||
CLoginDialog dlg(IDD_LOGIN);
|
||||
int retval = dlg.DoModal();
|
||||
if (retval != IDOK) return -1;
|
||||
write_initial_prefs((char*)(LPCTSTR) dlg.url, (char*)(LPCTSTR) dlg.auth);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void show_result(TEXT_LINE& line, RESULT& result) {
|
||||
char buf[256];
|
||||
line.set_field(0, result.project->project_name);
|
||||
line.set_field(1, result.app->name);
|
||||
sprintf(buf, "%f", result.final_cpu_time);
|
||||
line.set_field(2, buf);
|
||||
switch(result.state) {
|
||||
case RESULT_NEW:
|
||||
line.set_field(3, "New"); break;
|
||||
case RESULT_FILES_DOWNLOADED:
|
||||
line.set_field(3, "Ready to run"); break;
|
||||
case RESULT_COMPUTE_DONE:
|
||||
line.set_field(3, "Computation done"); break;
|
||||
case RESULT_READY_TO_ACK:
|
||||
line.set_field(3, "Results uploaded"); break;
|
||||
case RESULT_SERVER_ACK:
|
||||
line.set_field(3, "Acknowledged"); break;
|
||||
}
|
||||
}
|
||||
|
||||
void show_file_xfer(TEXT_LINE& line, FILE_XFER& fx) {
|
||||
char buf[256];
|
||||
|
||||
line.set_field(0, fx.fip->project->project_name);
|
||||
line.set_field(1, fx.fip->name);
|
||||
sprintf(buf, "%f", fx.fip->nbytes);
|
||||
line.set_field(2, buf);
|
||||
line.set_field(3, fx.fip->generated_locally?"upload":"download");
|
||||
}
|
||||
|
||||
void update_gui(CLIENT_STATE& cs) {
|
||||
int i, n;
|
||||
|
||||
n = min(results.nlines, cs.results.size());
|
||||
for (i=0; i<n; i++) {
|
||||
show_result(results.lines[i+1], *cs.results[i]);
|
||||
}
|
||||
for (i=n; i<results.nlines; i++) {
|
||||
results.blank_line(i);
|
||||
}
|
||||
|
||||
n = min(file_xfers.nlines, cs.file_xfers->file_xfers.size());
|
||||
for (i=0; i<n; i++) {
|
||||
show_file_xfer(file_xfers.lines[i], *cs.file_xfers->file_xfers[i]);
|
||||
}
|
||||
for (i=n; i<file_xfers.nlines; i++) {
|
||||
file_xfers.blank_line(i);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------ CLoginDialog -------------
|
||||
|
||||
CLoginDialog::CLoginDialog(UINT y) : CDialog(y){
|
||||
}
|
||||
|
||||
|
@ -46,16 +124,7 @@ BEGIN_MESSAGE_MAP (CLoginDialog, CDialog)
|
|||
ON_BN_CLICKED(IDC_LOGIN_OK, OnOK)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
char* result_titles[] = {"Project", "Application", "CPU time", "% done"};
|
||||
int result_widths[] = {12, 20, 12, 18};
|
||||
char* file_xfer_titles[] = {"Project", "File", "Size", "% done"};
|
||||
int file_xfer_widths[] = {12, 20, 12, 12};
|
||||
char* disk_usage_titles[] = {"Project", "space used"};
|
||||
int disk_usage_widths[] = {12, 20};
|
||||
char* project_titles[] = {"Project", "total CPU", "share"};
|
||||
int project_widths[] = {12, 15, 15};
|
||||
char* user_info_titles[] = {"Name", "Team", "Total credit", "Recent credit"};
|
||||
int user_info_widths[] = {20, 20, 15, 15};
|
||||
// ----------- TEXT_TABLE ------------
|
||||
|
||||
void TEXT_TABLE::create(char* title, int nf, int sl, int nl, char** titles, int* w) {
|
||||
int i, j, col, rcol;
|
||||
|
@ -157,7 +226,7 @@ void CALLBACK CMainWindow::TimerProc(HWND h, UINT x, UINT id, DWORD time) {
|
|||
char buf[256];
|
||||
n++;
|
||||
sprintf(buf, "%d", n);
|
||||
results.set_field(0, 0, buf);
|
||||
user_info.set_field(0, 0, buf);
|
||||
|
||||
#if 1
|
||||
while (gstate.do_something()) {
|
||||
|
@ -167,6 +236,7 @@ void CALLBACK CMainWindow::TimerProc(HWND h, UINT x, UINT id, DWORD time) {
|
|||
#endif
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
update_gui(gstate);
|
||||
}
|
||||
|
||||
int CMainWindow::OnCreate (LPCREATESTRUCT lpcs)
|
||||
|
@ -200,9 +270,9 @@ int CMainWindow::OnCreate (LPCREATESTRUCT lpcs)
|
|||
projects.create("Projects", 3, 22, 3, project_titles, project_widths);
|
||||
user_info.create("User info", 4, 28, 2, user_info_titles, user_info_widths);
|
||||
|
||||
NetOpen();
|
||||
freopen("stdout.txt", "w", stdout);
|
||||
freopen("stderr.txt", "w", stderr);
|
||||
NetOpen();
|
||||
freopen("stdout.txt", "w", stdout);
|
||||
freopen("stderr.txt", "w", stderr);
|
||||
read_log_flags();
|
||||
int retval = gstate.init();
|
||||
if (retval) exit(retval);
|
||||
|
@ -211,19 +281,6 @@ int CMainWindow::OnCreate (LPCREATESTRUCT lpcs)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void show_message(char* p, char* prior) {
|
||||
//MessageBox(NULL, p, prior, MB_OK);
|
||||
printf("Message (%s): %s\n", prior, p);
|
||||
}
|
||||
|
||||
int initialize_prefs() {
|
||||
CLoginDialog dlg(IDD_LOGIN);
|
||||
int retval = dlg.DoModal();
|
||||
if (retval != IDOK) return -1;
|
||||
write_initial_prefs((char*)(LPCTSTR) dlg.url, (char*)(LPCTSTR) dlg.auth);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CMainWindow::PostNcDestroy ()
|
||||
{
|
||||
delete this;
|
||||
|
@ -238,47 +295,3 @@ void CMainWindow::OnLoginMenu() {
|
|||
int retval = dlg.DoModal();
|
||||
}
|
||||
|
||||
void show_result(TEXT_LINE& line, RESULT& result) {
|
||||
char buf[256];
|
||||
line.set_field(0, result.project->project_name);
|
||||
line.set_field(1, result.app->name);
|
||||
sprintf(buf, "%f", result.final_cpu_time);
|
||||
line.set_field(2, buf);
|
||||
#if 0
|
||||
sprintf(buf, "%f", result.fraction_done);
|
||||
line.set_field(3, buf);
|
||||
#endif
|
||||
}
|
||||
|
||||
void show_file_xfer(TEXT_LINE& line, FILE_XFER& fx) {
|
||||
char buf[256];
|
||||
|
||||
line.set_field(0, fx.fip->project->project_name);
|
||||
line.set_field(1, fx.fip->name);
|
||||
sprintf(buf, "%f", fx.fip->nbytes);
|
||||
line.set_field(2, buf);
|
||||
#if 0
|
||||
sprintf(buf, "%f", fx.fip->fraction_done*100);
|
||||
line.set_field(3, buf);
|
||||
#endif
|
||||
}
|
||||
|
||||
void update_gui(CLIENT_STATE& cs) {
|
||||
int i, n;
|
||||
|
||||
n = min(results.nlines, cs.results.size());
|
||||
for (i=0; i<n; i++) {
|
||||
show_result(results.lines[i], *cs.results[i]);
|
||||
}
|
||||
for (i=n; i<results.nlines; i++) {
|
||||
results.blank_line(i);
|
||||
}
|
||||
|
||||
n = min(file_xfers.nlines, cs.file_xfers->file_xfers.size());
|
||||
for (i=0; i<n; i++) {
|
||||
show_file_xfer(file_xfers.lines[i], *cs.file_xfers->file_xfers[i]);
|
||||
}
|
||||
for (i=n; i<file_xfers.nlines; i++) {
|
||||
file_xfers.blank_line(i);
|
||||
}
|
||||
}
|
||||
|
|
8
db/db.h
8
db/db.h
|
@ -32,6 +32,11 @@
|
|||
// Maximum allowed size for SQL based blobs (Binary Large Object)
|
||||
#define MAX_BLOB_SIZE 4096
|
||||
|
||||
struct PROJECT {
|
||||
int id;
|
||||
char name[256];
|
||||
};
|
||||
|
||||
// A compilation target, i.e. a architecture/OS combination.
|
||||
// Currently the core client will be given only applications
|
||||
// that match its platform exactly.
|
||||
|
@ -243,6 +248,9 @@ extern int db_close();
|
|||
extern void db_print_error(char*);
|
||||
extern int db_insert_id();
|
||||
|
||||
extern int db_project_new(PROJECT& p);
|
||||
extern int db_project_enum(PROJECT& p);
|
||||
|
||||
extern int db_platform_new(PLATFORM& p);
|
||||
extern int db_platform_enum(PLATFORM& p);
|
||||
extern int db_platform_lookup_name(PLATFORM&);
|
||||
|
|
|
@ -25,17 +25,19 @@
|
|||
|
||||
#include "db.h"
|
||||
|
||||
#define TYPE_PLATFORM 1
|
||||
#define TYPE_APP 2
|
||||
#define TYPE_APP_VERSION 3
|
||||
#define TYPE_USER 4
|
||||
#define TYPE_TEAM 5
|
||||
#define TYPE_HOST 6
|
||||
#define TYPE_WORKUNIT 7
|
||||
#define TYPE_RESULT 8
|
||||
#define TYPE_PROJECT 1
|
||||
#define TYPE_PLATFORM 2
|
||||
#define TYPE_APP 3
|
||||
#define TYPE_APP_VERSION 4
|
||||
#define TYPE_USER 5
|
||||
#define TYPE_TEAM 6
|
||||
#define TYPE_HOST 7
|
||||
#define TYPE_WORKUNIT 8
|
||||
#define TYPE_RESULT 9
|
||||
|
||||
char* table_name[] = {
|
||||
"",
|
||||
"project",
|
||||
"platform",
|
||||
"app",
|
||||
"app_version",
|
||||
|
@ -47,6 +49,7 @@ char* table_name[] = {
|
|||
};
|
||||
|
||||
void struct_to_str(void* vp, char* q, int type) {
|
||||
PROJECT* prp;
|
||||
PLATFORM* pp;
|
||||
APP* app;
|
||||
APP_VERSION* avp;
|
||||
|
@ -58,6 +61,14 @@ void struct_to_str(void* vp, char* q, int type) {
|
|||
assert(vp!=NULL);
|
||||
assert(q!=NULL);
|
||||
switch(type) {
|
||||
case TYPE_PROJECT:
|
||||
prp = (PROJECT*)vp;
|
||||
sprintf(q,
|
||||
"id=%d, name='%s'",
|
||||
prp->id,
|
||||
prp->name
|
||||
);
|
||||
break;
|
||||
case TYPE_PLATFORM:
|
||||
pp = (PLATFORM*)vp;
|
||||
sprintf(q,
|
||||
|
@ -209,6 +220,7 @@ void struct_to_str(void* vp, char* q, int type) {
|
|||
}
|
||||
|
||||
void row_to_struct(MYSQL_ROW& r, void* vp, int type) {
|
||||
PROJECT* prp;
|
||||
PLATFORM* pp;
|
||||
APP* app;
|
||||
APP_VERSION* avp;
|
||||
|
@ -221,6 +233,12 @@ void row_to_struct(MYSQL_ROW& r, void* vp, int type) {
|
|||
int i=0;
|
||||
assert(vp!=NULL);
|
||||
switch(type) {
|
||||
case TYPE_PROJECT:
|
||||
prp = (PROJECT*)vp;
|
||||
memset(prp, 0, sizeof(PROJECT));
|
||||
prp->id = atoi(r[i++]);
|
||||
strcpy(prp->name, r[i++]);
|
||||
break;
|
||||
case TYPE_PLATFORM:
|
||||
pp = (PLATFORM*)vp;
|
||||
memset(pp, 0, sizeof(PLATFORM));
|
||||
|
@ -360,6 +378,17 @@ void row_to_struct(MYSQL_ROW& r, void* vp, int type) {
|
|||
}
|
||||
|
||||
|
||||
////////// PROJECT /////////
|
||||
|
||||
int db_project_new(PROJECT& p) {
|
||||
return db_new(&p, TYPE_PROJECT);
|
||||
}
|
||||
|
||||
int db_project_enum(PROJECT& p) {
|
||||
static ENUM e;
|
||||
return db_enum(e, &p, TYPE_PROJECT);
|
||||
}
|
||||
|
||||
////////// PLATFORM /////////
|
||||
|
||||
int db_platform_new(PLATFORM& p) {
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
use BOINC_DB_NAME
|
||||
|
||||
create table project (
|
||||
id integer not null auto_increment,
|
||||
name varchar(254) not null,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
create table platform (
|
||||
id integer not null auto_increment,
|
||||
create_time integer not null,
|
||||
|
|
|
@ -13,7 +13,7 @@ CFLAGS = -g -Wall @DEFS@ \
|
|||
-I@top_srcdir@/tools \
|
||||
-DBOINC_DB_NAME=\"$(BOINC_DB_NAME)\" \
|
||||
-DBOINC_DB_PASSWD=\"$(BOINC_DB_PASSWD)\" \
|
||||
-DBOINC_KEY=$(BOINC_KEY) \
|
||||
-DBOINC_SHMEM_KEY=$(BOINC_SHMEM_KEY) \
|
||||
-DBOINC_KEY_DIR=\"$(BOINC_KEY_DIR)\" \
|
||||
-DBOINC_UPLOAD_DIR=\"$(BOINC_UPLOAD_DIR)\" \
|
||||
-DBOINC_USER=\"$(BOINC_USER)\" \
|
||||
|
|
|
@ -65,7 +65,7 @@ int check_trigger(SCHED_SHMEM* ssp) {
|
|||
fclose(f);
|
||||
if (!strcmp(buf, "<quit/>\n")) {
|
||||
detach_shmem((void*)ssp);
|
||||
destroy_shmem(BOINC_KEY);
|
||||
destroy_shmem(BOINC_SHMEM_KEY);
|
||||
unlink(TRIGGER_FILENAME);
|
||||
exit(0);
|
||||
} else if (!strcmp(buf, "<reread_db/>\n")) {
|
||||
|
@ -179,12 +179,12 @@ int main(int argc, char** argv) {
|
|||
}
|
||||
}
|
||||
|
||||
retval = destroy_shmem(BOINC_KEY);
|
||||
retval = destroy_shmem(BOINC_SHMEM_KEY);
|
||||
if (retval) {
|
||||
fprintf(stderr, "feeder: can't destroy shmem\n");
|
||||
exit(1);
|
||||
}
|
||||
retval = create_shmem(BOINC_KEY, sizeof(SCHED_SHMEM), &p);
|
||||
retval = create_shmem(BOINC_SHMEM_KEY, sizeof(SCHED_SHMEM), &p);
|
||||
if (retval) {
|
||||
fprintf(stderr, "feeder: can't create shmem\n");
|
||||
exit(1);
|
||||
|
|
52
sched/main.C
52
sched/main.C
|
@ -27,12 +27,16 @@
|
|||
#include "shmem.h"
|
||||
#include "server_types.h"
|
||||
#include "handle_request.h"
|
||||
#include "main.h"
|
||||
|
||||
#define REQ_FILE_PREFIX "/tmp/boinc_req_"
|
||||
#define REPLY_FILE_PREFIX "/tmp/boinc_reply_"
|
||||
//#define REQ_FILE_PREFIX "/disks/milkyway/a/users/anderson/boinc_cvs/boinc/sched/boinc_req_"
|
||||
//#define REPLY_FILE_PREFIX "/disks/milkyway/a/users/anderson/boinc_cvs/boinc/sched/boinc_reply_"
|
||||
|
||||
PROJECT gproject;
|
||||
|
||||
int return_error(char* p) {
|
||||
assert(p!=NULL);
|
||||
fprintf(stderr, "BOINC server: %s\n", p);
|
||||
printf("<error_msg>%s</error_msg>\n", p);
|
||||
return 1;
|
||||
|
@ -52,42 +56,74 @@ int main() {
|
|||
void* p;
|
||||
unsigned int counter=0;
|
||||
char* code_sign_key;
|
||||
bool found;
|
||||
|
||||
sprintf(path, "%s/code_sign_public", BOINC_KEY_DIR);
|
||||
retval = read_file_malloc(path, code_sign_key);
|
||||
if (retval) {
|
||||
fprintf(stderr,
|
||||
"BOINC scheduler - compiled by BOINC_USER: can't read code sign key file (%s)\n", path
|
||||
"BOINC scheduler (%s): can't read code sign key file (%s)\n",
|
||||
BOINC_USER, path
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
retval = attach_shmem(BOINC_KEY, &p);
|
||||
retval = attach_shmem(BOINC_SHMEM_KEY, &p);
|
||||
if (retval) {
|
||||
fprintf(stderr, "BOINC scheduler - Compiled by BOINC_USER: can't attach shmem\n");
|
||||
fprintf(stderr,
|
||||
"BOINC scheduler (%s): can't attach shmem\n",
|
||||
BOINC_USER
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
ssp = (SCHED_SHMEM*)p;
|
||||
retval = ssp->verify();
|
||||
if (retval) {
|
||||
fprintf(stderr, "BOINC scheduler - Compiled by BOINC_USER: shmem has wrong struct sizes - recompile\n");
|
||||
fprintf(stderr,
|
||||
"BOINC scheduler (%s): shmem has wrong struct sizes - recompile\n",
|
||||
BOINC_USER
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
for (i=0; i<10; i++) {
|
||||
if (ssp->ready) break;
|
||||
fprintf(stderr, "BOINC scheduler - Compiled by BOINC_USER: waiting for ready flag\n");
|
||||
fprintf(stderr,
|
||||
"BOINC scheduler (%s): waiting for ready flag\n",
|
||||
BOINC_USER
|
||||
);
|
||||
sleep(1);
|
||||
}
|
||||
if (!ssp->ready) {
|
||||
fprintf(stderr, "BOINC scheduler - Compiled by BOINC_USER: feeder doesn't seem to be running\n");
|
||||
fprintf(stderr,
|
||||
"BOINC scheduler (%s): feeder doesn't seem to be running\n",
|
||||
BOINC_USER
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
//fprintf(stderr, "got ready flag\n");
|
||||
retval = db_open(BOINC_DB_NAME, BOINC_DB_PASSWD);
|
||||
if (retval) {
|
||||
exit(return_error("BOINC scheduler - Compiled by BOINC_USER: can't open database"));
|
||||
fprintf(stderr,
|
||||
"BOINC scheduler (%s): can't open database\n",
|
||||
BOINC_USER
|
||||
);
|
||||
return_error("can't open database");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
found = false;
|
||||
while (!db_project_enum(gproject)) {
|
||||
found = true;
|
||||
}
|
||||
if (!found) {
|
||||
fprintf(stderr,
|
||||
"BOINC scheduler (%s): can't find project\n",
|
||||
BOINC_USER
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
pid = getpid();
|
||||
#ifdef _USING_FCGI_
|
||||
while(FCGI_Accept() >= 0) {
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <assert.h>
|
||||
|
||||
#include "parse.h"
|
||||
#include "main.h"
|
||||
#include "server_types.h"
|
||||
|
||||
SCHEDULER_REQUEST::SCHEDULER_REQUEST() {
|
||||
|
@ -109,8 +110,11 @@ int SCHEDULER_REPLY::write(FILE* fout) {
|
|||
assert(fout!=NULL);
|
||||
fprintf(fout,
|
||||
"<scheduler_reply>\n"
|
||||
"<project_name>%s</project_name>\n",
|
||||
gproject.name
|
||||
);
|
||||
|
||||
|
||||
if (request_delay) {
|
||||
fprintf(fout, "<request_delay>%d</request_delay>\n", request_delay);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ int main() {
|
|||
int retval;
|
||||
void* p;
|
||||
|
||||
retval = attach_shmem(BOINC_KEY, &p);
|
||||
retval = attach_shmem(BOINC_SHMEM_KEY, &p);
|
||||
if (retval) {
|
||||
printf("can't attach shmem\n");
|
||||
exit(1);
|
||||
|
|
|
@ -131,6 +131,10 @@ function add_prefs($file) {
|
|||
PassThru("../tools/add prefs -email_addr $BOINC_EMAIL -prefs_file $file");
|
||||
}
|
||||
|
||||
function add_project($name) {
|
||||
PassThru("../tools/add project -project_name '$name'");
|
||||
}
|
||||
|
||||
function add_platform($platform) {
|
||||
global $BOINC_PLATFORM;
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
create_keys();
|
||||
init_client_dirs("prefs1.xml");
|
||||
copy_to_download_dir("input");
|
||||
add_project("Test Project");
|
||||
add_platform(null);
|
||||
add_user("prefs.xml");
|
||||
add_app("upper_case", null, null);
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
create_keys();
|
||||
init_client_dirs("prefs1.xml");
|
||||
copy_to_download_dir("input");
|
||||
add_project("Test Project");
|
||||
add_platform("windows_intelx86");
|
||||
add_user("prefs.xml");
|
||||
add_app("upper_case", "windows_intelx86", "upper_case.exe");
|
||||
|
|
26
tools/add.C
26
tools/add.C
|
@ -20,6 +20,8 @@
|
|||
// add.C - add items to the DB
|
||||
//
|
||||
// usages:
|
||||
// add project -project_name x
|
||||
// add project
|
||||
// add app -app_name x
|
||||
// add application
|
||||
// create DB record
|
||||
|
@ -49,17 +51,30 @@ APP app;
|
|||
PLATFORM platform;
|
||||
APP_VERSION app_version;
|
||||
USER user;
|
||||
PROJECT project;
|
||||
|
||||
int version, retval, nexec_files;
|
||||
double nbytes;
|
||||
bool signed_exec_files;
|
||||
char buf[256], md5_cksum[64];
|
||||
char *app_name=0, *platform_name=0;
|
||||
char *app_name=0, *platform_name=0, *project_name=0;
|
||||
char* exec_dir=0, *exec_files[10], *signature_files[10];
|
||||
char *email_addr=0, *user_name=0, *web_password=0, *authenticator=0;
|
||||
char *prefs_file=0, *download_dir, *download_url;
|
||||
char* code_sign_keyfile;
|
||||
char *message=0, *message_priority=0;
|
||||
|
||||
void add_project() {
|
||||
int retval;
|
||||
|
||||
memset(&project, 0, sizeof(project));
|
||||
strcpy(project.name, project_name);
|
||||
retval = db_project_new(project);
|
||||
if (retval) {
|
||||
db_print_error("db_project_new");
|
||||
}
|
||||
}
|
||||
|
||||
void add_app() {
|
||||
int retval;
|
||||
|
||||
|
@ -258,7 +273,10 @@ int main(int argc, char** argv) {
|
|||
printf("can't open DB %s\n", getenv("BOINC_DB_NAME"));
|
||||
}
|
||||
for (i=2; i<argc; i++) {
|
||||
if (!strcmp(argv[i], "-app_name")) {
|
||||
if (!strcmp(argv[i], "-project_name")) {
|
||||
i++;
|
||||
project_name = argv[i];
|
||||
} else if (!strcmp(argv[i], "-app_name")) {
|
||||
i++;
|
||||
app_name = argv[i];
|
||||
} else if (!strcmp(argv[i], "-platform_name")) {
|
||||
|
@ -323,7 +341,9 @@ int main(int argc, char** argv) {
|
|||
code_sign_keyfile = argv[i];
|
||||
}
|
||||
}
|
||||
if (!strcmp(argv[1], "app")) {
|
||||
if (!strcmp(argv[1], "project")) {
|
||||
add_project();
|
||||
} else if (!strcmp(argv[1], "app")) {
|
||||
add_app();
|
||||
} else if (!strcmp(argv[1], "platform")) {
|
||||
add_platform();
|
||||
|
|
Loading…
Reference in New Issue