mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=4189
This commit is contained in:
parent
51fda40804
commit
161fb2868f
|
@ -17332,3 +17332,35 @@ David 12 Sept 2004
|
|||
ss_logic.C
|
||||
lib/
|
||||
app_ipc.h
|
||||
|
||||
David 13 Sept 2004
|
||||
- Preliminary checkin for "GUI URLs" feature
|
||||
(allows projects to send URLs to be use as links in GUIs)
|
||||
This is implemented in a new class GUI_URLS.
|
||||
Its init() member reads template file.
|
||||
Its get_gui_urls() member macro-substitutes user/team/host IDs
|
||||
into the URLs, and produces XML to be included in scheduler replies.
|
||||
- renamed replace_element() to replace_element_contents()
|
||||
- moved try_fopen() from lib/util.C to sched/sched_util.C
|
||||
- added old and new docs to CVS
|
||||
|
||||
doc/ (all new)
|
||||
sched_locality.php
|
||||
client_mac.php
|
||||
delete_file.php
|
||||
get_file.php
|
||||
get_file_list.php
|
||||
gui_rpc_control.php
|
||||
gui_urls.php
|
||||
info.php
|
||||
send_file.php
|
||||
lib/
|
||||
parse.C,h
|
||||
util.C,h
|
||||
sched/
|
||||
handle_request.C
|
||||
main.C,h
|
||||
make_work.C
|
||||
sched_locality.C
|
||||
sched_util.C,h
|
||||
server_types.C,h
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
require_once("docutil.php");
|
||||
page_head("Installing BOINC on Mac OS/X");
|
||||
echo "
|
||||
<a name=mac>
|
||||
<h3>Installing BOINC on Mac OS/X</h3>
|
||||
<p>
|
||||
The Mac OS X client will unpack correctly with gunzip on Mac OS X
|
||||
10.2 (jaguar) or 10.3 (panther) as long as you type the command
|
||||
within Terminal. Stuffit 7.x or newer will work under the Finder
|
||||
in either OS X or OS 9, but I'd recommend using 'gunzip' or 'gzip -d'
|
||||
within Terminal instead.
|
||||
|
||||
<p>
|
||||
However, the two main browsers on OS X (IE 5.2.x and Safari 1.x) will
|
||||
automatically unpack downloads by default, so your work may already
|
||||
be done.
|
||||
|
||||
<p>
|
||||
If you use IE, the boinc client will download and automatically unpack
|
||||
leaving two files:
|
||||
<ol>
|
||||
<li>
|
||||
boinc_2.12_powerpc-apple-darwin
|
||||
[this will have the stuffit icon in the finder]
|
||||
|
||||
<li>
|
||||
boinc_2.12_powerpc-apple-darwin7.0.0
|
||||
[this will not have any icon in the finder]
|
||||
|
||||
</ol>
|
||||
<p>
|
||||
#2 is the unpacked program ready-to-run. You can just start Terminal
|
||||
and run boinc.
|
||||
|
||||
<p>
|
||||
If you use Safari, the boinc client will download and automatically
|
||||
unpack, leaving a single file:
|
||||
<ul>
|
||||
<li>
|
||||
boinc_2.12_powerpc-apple-darwin7.0.0
|
||||
[this will not have any icon in the finder]
|
||||
</ul>
|
||||
This is the unpacked program, but it's not yet ready-to-run (this is
|
||||
a bug with how Safari handles gzipped downloads; we'll fix this soon).
|
||||
|
||||
<p>
|
||||
Here's what you have to do to fix the Safari download (apologies if
|
||||
you already know how to do this):
|
||||
|
||||
<ul>
|
||||
<li> Create a folder in your home directory and put the boinc
|
||||
file in it
|
||||
<li> Start Terminal
|
||||
<li> 'cd' to the folder you just created
|
||||
<li> Type 'chmod +x boinc_2.12_powerpc-apple-darwin7.0.0'
|
||||
(without the quotes)
|
||||
</ul>
|
||||
Now you can run BOINC.
|
||||
";
|
||||
page_tail();
|
||||
?>
|
|
@ -6,7 +6,7 @@ page_head("Community and resources");
|
|||
echo "
|
||||
<h2>Participants</h2>
|
||||
<p>
|
||||
To ask questions or report bugs in the BOINC client software,
|
||||
To ask questions, or to report bugs in the BOINC client software,
|
||||
please go to the
|
||||
<a href=http://setiweb.ssl.berkeley.edu/sah/forum_help_desk.php>Message
|
||||
board area</a> of SETI@home.
|
||||
|
@ -50,8 +50,7 @@ At any given point there are two different versions
|
|||
of the BOINC source code (maintained as separate CVS projects):
|
||||
<ul>
|
||||
<li> <b>boinc</b> is the development version.
|
||||
It may be unstable,
|
||||
and it may not be compatible with publicly-deployed BOINC projects.
|
||||
It may be unstable, and it may not be compatible with public BOINC projects.
|
||||
<li> <b>boinc_public</b> is the stable version.
|
||||
It generally is the version being used
|
||||
(on both client and server) by public BOINC projects.
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
require_once("docutil.php");
|
||||
page_head("Deleting files");
|
||||
echo "
|
||||
To delete a file from a host, use the function
|
||||
<pre>
|
||||
delete_file(int host_id, const char* file_name)
|
||||
</pre>
|
||||
or the command line program
|
||||
<pre>
|
||||
delete_file -host_id X -file_name Y
|
||||
</pre>
|
||||
<p>
|
||||
delete_file() creates a message for the specific host and adds it to
|
||||
the msg_to_host table.
|
||||
This message instructs the client to delete the file.
|
||||
The message is included in the next scheduler reply to the host.
|
||||
The message XML has the form ", html_text("
|
||||
<delete_file_info>file_name</delete_file_info>
|
||||
"),"
|
||||
";
|
||||
page_tail();
|
||||
?>
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
require_once("docutil.php");
|
||||
page_head("Retrieving files");
|
||||
echo "
|
||||
<p>
|
||||
A persistent file can be retrieved from a specific host.
|
||||
This can be done using the function
|
||||
<pre>
|
||||
get_file(int host_id, const char* file_name)
|
||||
</pre>
|
||||
<p>
|
||||
or the command line program
|
||||
<pre>
|
||||
get_file -host_id X -file_name Y
|
||||
</pre>
|
||||
This program must be run in the project's root directory.
|
||||
<p>
|
||||
get_file() creates a result with a name of the form:
|
||||
<pre>
|
||||
get_FILENAME_HOSTID_TIME
|
||||
</pre>
|
||||
<p>
|
||||
Example: get_test.mpg_34_123456789 is a result representing the
|
||||
upload of test.mpg from host number 34 at time 1234567891.
|
||||
<p>
|
||||
An upload message is created for the specific host
|
||||
and added to the msg_to_host table in the database.
|
||||
This message instructs the client to upload the file
|
||||
and acknowledge a successful upload.
|
||||
The upload message included in the next RPC reply to the host.
|
||||
The message has the form:
|
||||
", html_text("
|
||||
<app>
|
||||
<name>FILE_MOVER</name>
|
||||
</app>
|
||||
<app_version>
|
||||
<app_name>FILE_MOVER</app_name>
|
||||
<version_num>BOINC_MAJOR_VERSION</version_num>
|
||||
</app_version>
|
||||
<file_info>
|
||||
<name>file_name</name>
|
||||
<url>upload_dir</url>
|
||||
<max_nbytes>1e10</max_nbytes>
|
||||
<upload_when_present/>
|
||||
</file_info>
|
||||
RESULT_XML
|
||||
<workunit>
|
||||
<name>result.name</name>
|
||||
<app_name>FILE_MOVER</app_name>
|
||||
</workunit>
|
||||
"),"
|
||||
Include ", html_text("<msg_to_host/>"), " in config.xml.
|
||||
Currently ", html_text("<ignore_upload_certificates/>"), "
|
||||
needs to be included as there is no
|
||||
way to send upload certificates with these files.
|
||||
";
|
||||
page_tail();
|
||||
?>
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
require_once("docutil.php");
|
||||
page_head("Retrieving file lists");
|
||||
echo "
|
||||
To instruct a host to send a list of all persistent files,
|
||||
use the function
|
||||
<pre>
|
||||
request_file_list(int host_id)
|
||||
</pre>
|
||||
or the command line program
|
||||
<pre>
|
||||
request_file_list [ -host_id X ]
|
||||
</pre>
|
||||
If -host_id is absent, get file lists for all hosts.
|
||||
|
||||
<p>
|
||||
A message is created for the specific host (or all hosts) and added to the
|
||||
msg_to_host table in the database.
|
||||
The upload message included in the next RPC reply to the host.
|
||||
<p>
|
||||
???? how do you tell it where to upload the list???
|
||||
";
|
||||
page_tail();
|
||||
?>
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
require_once("docutil.php");
|
||||
page_head("Access control");
|
||||
echo "
|
||||
By default the core client accepts GUI RPC connections
|
||||
only from programs on the same host.
|
||||
You can provides access to other hosts in two ways:
|
||||
<ul>
|
||||
<li> If you run the client with the
|
||||
-allow_remote_gui_rpc command line option,
|
||||
it will accept connections from any host.
|
||||
<li>
|
||||
You can create
|
||||
a file remote_hosts.cfg in your BOINC directory containing
|
||||
a list of allowed dns host names or ip addresses (one per line).
|
||||
Those hosts will be able to connect.
|
||||
The remote_hosts.cfg file can have comment lines that start with either a #
|
||||
or a ; character as well.
|
||||
</ul>
|
||||
";
|
||||
|
||||
page_tail();
|
||||
?>
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
require_once("docutil.php");
|
||||
page_head("GUI URLs");
|
||||
echo "
|
||||
<p>
|
||||
<b>GUI URLs</b> is a mechanism allowing projects to pass URLs to the client,
|
||||
for display as links in the GUI.
|
||||
<p>
|
||||
Projects can includes a file 'gui_urls.xml' in the project root directory,
|
||||
with the following form:
|
||||
|
||||
",html_text("
|
||||
<gui_urls>
|
||||
<gui_url>
|
||||
<name>Your account</name>
|
||||
<description>View your account information and credit totals</description>
|
||||
<url>http://foo.project.com/blah.php?userid=<userid></url>
|
||||
</gui_url>
|
||||
<gui_url>
|
||||
<name>Help</name>
|
||||
<description>Get help about SETI@home</description>
|
||||
<url>http://foo.project.com/help.php</url>
|
||||
</gui_url>
|
||||
...
|
||||
</gui_urls>
|
||||
"),"
|
||||
<p>
|
||||
Each entry describes a GUI URL.
|
||||
The elements are:
|
||||
";
|
||||
list_start();
|
||||
list_item("name", "A short name, used e.g. as a menu item");
|
||||
list_item("description", "An explanation, used e.g. as a rollover popup");
|
||||
list_item("url", "The URL");
|
||||
list_end();
|
||||
echo "
|
||||
All items are macro-substituted as follows:
|
||||
";
|
||||
list_start();
|
||||
list_item(htmlspecialchars("<userid/>"), "The user ID");
|
||||
list_item(htmlspecialchars("<teamid/>"), "The team ID");
|
||||
list_item(htmlspecialchars("<hostid/>"), "The host ID");
|
||||
list_item(htmlspecialchars("<authenticator/>"), "The user's account ID");
|
||||
list_end();
|
||||
page_tail();
|
||||
?>
|
|
@ -81,6 +81,7 @@ Solve biomedical questions of protein-related diseases.
|
|||
Analyze radio-telescope data,
|
||||
looking for evidence of extraterrestrial life.
|
||||
</ul>
|
||||
Visit any of these sites to download BOINC client software.
|
||||
We encourage you to participate in multiple projects,
|
||||
so that your computer will be kept busy even
|
||||
while projects are down or out of work.
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
require_once("docutil.php");
|
||||
|
||||
page_head('Rules and Policies');
|
||||
echo "
|
||||
|
||||
The following rules and policy apply to BOINC.
|
||||
BOINC-based projects may have additional rules and policies.
|
||||
|
||||
<h3>Run BOINC only on authorized computers</h3>
|
||||
|
||||
<p>
|
||||
Run BOINC only on computers that you own,
|
||||
or for which you have obtained the owner's permission.
|
||||
Some companies and schools have policies that prohibit using their computers
|
||||
for BOINC-based projects.
|
||||
|
||||
<h3>How BOINC will use your computer</h3>
|
||||
|
||||
<p>
|
||||
When you run BOINC on your computer,
|
||||
it will use part of the computer's CPU power, disk space, and network bandwidth.
|
||||
You can control how much of your resources are used by BOINC,
|
||||
and when it uses them.
|
||||
|
||||
<h3>Privacy policy</h3>
|
||||
|
||||
<p>
|
||||
To avoid computing while you're typing,
|
||||
BOINC monitors mouse and keyboard and activity
|
||||
(it does not record keystrokes).
|
||||
This may trigger some anti-virus software.
|
||||
|
||||
<p>
|
||||
Your account on a BOINC-based project is identified by a name that you choose.
|
||||
This name may be shown on the project's web site,
|
||||
along with a summary of the work your computer has done for the project
|
||||
and other BOINC projects.
|
||||
If you want to be anonymous, choose a name that doesn't reveal your identity.
|
||||
|
||||
<p>
|
||||
If you participate in a BOINC-based project,
|
||||
information about your computer
|
||||
(such as its processor type, amount of memory, etc.)
|
||||
will be recorded by the project and used to decide
|
||||
what type of work to assign to your computer.
|
||||
This information will also be shown on the project's web site.
|
||||
Nothing that reveals your computer's location
|
||||
(e.g. its domain name or network address) will be shown.
|
||||
|
||||
<p>
|
||||
To participate in a BOINC-based project,
|
||||
you must give an address where you receive email.
|
||||
This address will not be shown on the project's web site
|
||||
or shared with organizations.
|
||||
The project may send you periodic newsletters;
|
||||
however, you can choose not to be sent these at any time.
|
||||
|
||||
<h3>Is it safe to run BOINC?</h3>
|
||||
|
||||
<p>
|
||||
Any time you download a program through the Internet you are taking a chance:
|
||||
the program might have dangerous errors,
|
||||
or the download server might have been hacked.
|
||||
|
||||
<h3>Liability</h3>
|
||||
|
||||
<p>
|
||||
The BOINC project and the University of California
|
||||
assume no liability for damage to your computer,
|
||||
loss of data, or any other event or condition that may occur
|
||||
as a result of participating in BOINC-based projects.
|
||||
|
||||
";
|
||||
page_tail();
|
||||
?>
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
require_once("docutil.php");
|
||||
|
||||
page_head("Locality scheduling");
|
||||
|
||||
echo "
|
||||
<b>Locality scheduling</b> is intended for projects for which
|
||||
<ul>
|
||||
<li> Each workunit has a large input file
|
||||
(it may have other smaller input files as well).
|
||||
<li> Each large input file is used by many workunits.
|
||||
</ul>
|
||||
|
||||
The goal of locality scheduling is to minimize
|
||||
the amount of data transfer to hosts.
|
||||
In sending work to at given host,
|
||||
the scheduler tries to send results
|
||||
that uses input files already on the host.
|
||||
|
||||
<p>
|
||||
To use locality scheduling, projects must do the following:
|
||||
|
||||
<ul>
|
||||
<li> Workunit names must be of the form FILENAME__*,
|
||||
where FILENAME is the name of the large input file
|
||||
used by that workunit.
|
||||
These filenames cannot contain '__'.
|
||||
<li> The <file_info> for each large input file must contain the tags
|
||||
",html_text(" <sticky/>
|
||||
<report_on_rpc/>"),"
|
||||
<li> The config.xml file must contain",html_text("<locality_scheduling/>"),"
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
Locality scheduling works as follows:
|
||||
<ul>
|
||||
<li> Each scheduler RPC contains a list of the
|
||||
large files already on the host, if any.
|
||||
<li> The scheduler attempts to send results that use a file
|
||||
already on the host.
|
||||
<li> For each file that is on the host and for which
|
||||
no results are available for sending,
|
||||
the scheduler instructs the host to delete the file.
|
||||
</ul>
|
||||
";
|
||||
page_tail();
|
||||
?>
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
require_once("docutil.php");
|
||||
page_head("Sending files");
|
||||
echo "
|
||||
To send a file to a specific host, use the function
|
||||
<pre>
|
||||
send_file(int host_id, const char* file_name, int priority, long int exp_date)
|
||||
</pre>
|
||||
or the command line program
|
||||
<pre>
|
||||
send_file -host_id X -file_name Y -priority Z -days_exp
|
||||
</pre>
|
||||
<ul>
|
||||
<li> priority is the relative importance of the file (default = 1)
|
||||
<li> days_exp is the number of days the file should stay on the
|
||||
host (default = 100)
|
||||
</ul>
|
||||
<p>
|
||||
send_file creates a result and initializes it with a name of the form
|
||||
send_FILENAME_HOSTID_TIME.
|
||||
<p>
|
||||
A message is created for the host and added to the msg_to_host table.
|
||||
This message instructs the client to download the file
|
||||
and acknowledge a successful download.
|
||||
The download message included in the next RPC reply to the host.
|
||||
The message has the form:
|
||||
", html_text("
|
||||
<app>
|
||||
<name>FILE_MOVER</name>
|
||||
</app>
|
||||
<app_version>
|
||||
<app_name>FILE_MOVER</app_name>
|
||||
<version_num>n</version_num>
|
||||
</app_version>
|
||||
RESULT_XML
|
||||
<file_info>
|
||||
<name>file_name</name>
|
||||
<url>download_dir/file_name</url>
|
||||
<md5_cksum>md5</md5_cksum>
|
||||
<nbytes>file->nbytes</nbytes>
|
||||
<sticky/>
|
||||
<priority>priority</priority>
|
||||
<exp_date>exp_date</exp_date>
|
||||
</file_info>
|
||||
<workunit>
|
||||
<name>result.name</name>
|
||||
<app_name>FILE_MOVER</app_name>
|
||||
<file_ref>
|
||||
<file_name>file_name</file_name>
|
||||
</file_ref>
|
||||
</workunit>"), "
|
||||
";
|
||||
page_tail();
|
||||
?>
|
|
@ -25,11 +25,7 @@ results of the same workunit,
|
|||
in an attempt to obtain unearned credit
|
||||
or have erroneous results accepted as correct.
|
||||
</ul>
|
||||
In general, the BOINC scheduler responds to a work request
|
||||
by enumerating unsent results from the database,
|
||||
sending them to the host,
|
||||
and continuing until requested duration X is reached.
|
||||
However, this process is limited in various ways:
|
||||
Work distribution is constrained by a number of rules:
|
||||
<ul>
|
||||
<li> A result is sent only if an application version
|
||||
is available for the host's platform.
|
||||
|
@ -62,7 +58,17 @@ No results are sent of the core client has a different
|
|||
major version than the scheduling server.
|
||||
</ul>
|
||||
|
||||
In general, the BOINC scheduler responds to a work request
|
||||
by enumerating unsent results from the database,
|
||||
filtering them by the above criteria,
|
||||
sending them to the host,
|
||||
and continuing until requested duration X is reached.
|
||||
|
||||
<p>
|
||||
For projects that have very large input files,
|
||||
each of which is used by many workunit,
|
||||
BOINC offers an alternative work distribution policy
|
||||
called <a href=sched_locality.php>locality scheduling</a>.
|
||||
";
|
||||
page_tail();
|
||||
?>
|
||||
|
|
20
lib/parse.C
20
lib/parse.C
|
@ -206,9 +206,11 @@ int read_file_malloc(const char* pathname, char*& str) {
|
|||
}
|
||||
|
||||
|
||||
// replace XML element contents. not currently used
|
||||
// replace XML element contents (element must be present)
|
||||
//
|
||||
void replace_element(char* buf, char* start, char* end, char* replacement) {
|
||||
void replace_element_contents(
|
||||
char* buf, char* start, char* end, char* replacement
|
||||
) {
|
||||
char temp[4096], *p, *q;
|
||||
|
||||
p = strstr(buf, start);
|
||||
|
@ -219,6 +221,20 @@ void replace_element(char* buf, char* start, char* end, char* replacement) {
|
|||
strcat(p, temp);
|
||||
}
|
||||
|
||||
// replace a substring. Do at most one instance.
|
||||
//
|
||||
bool str_replace(char* str, char* substr, char* replacement) {
|
||||
char temp[4096], *p;
|
||||
|
||||
p = strstr(str, substr);
|
||||
if (!p) return false;
|
||||
int n = strlen(substr);
|
||||
strcpy(temp, p+n);
|
||||
strcpy(p, replacement);
|
||||
strcat(p, temp);
|
||||
return true;
|
||||
}
|
||||
|
||||
// if the given XML has an element of the form
|
||||
// <venue name="venue_name">
|
||||
// ...
|
||||
|
|
|
@ -40,7 +40,10 @@ extern int dup_element_contents(FILE* in, const char* end_tag, char** pp);
|
|||
extern int copy_element_contents(FILE* in, const char* end_tag, char* p, int len);
|
||||
extern int copy_element_contents(FILE* in, const char* end_tag, std::string&);
|
||||
extern int read_file_malloc(const char* pathname, char*& str);
|
||||
extern void replace_element(char* buf, char* start, char* end, char* replacement);
|
||||
extern void replace_element_contents(
|
||||
char* buf, char* start, char* end, char* replacement
|
||||
);
|
||||
extern bool str_replace(char* str, char* old, char* neww);
|
||||
extern char* sgets(char* buf, int len, char* &in);
|
||||
extern void xml_escape(std::string&, std::string&);
|
||||
extern void xml_escape(char*, std::string&);
|
||||
|
|
34
lib/util.C
34
lib/util.C
|
@ -765,37 +765,3 @@ int dir_hier_url(
|
|||
sprintf(result, "%s/%x/%s", root, sum, filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
// try to open a file.
|
||||
// On failure:
|
||||
// return ERR_FOPEN if the dir is there but not file
|
||||
// (this is generally a nonrecoverable failure)
|
||||
// return ERR_OPENDIR if dir is not there.
|
||||
// (this is generally a recoverable error,
|
||||
// like NFS mount failure, that may go away later)
|
||||
//
|
||||
int try_fopen(char* path, FILE*& f, char* mode) {
|
||||
char* p;
|
||||
DIR* d;
|
||||
char dirpath[256];
|
||||
|
||||
f = fopen(path, mode);
|
||||
if (!f) {
|
||||
memset(dirpath, '\0', sizeof(dirpath));
|
||||
p = strrchr(path, '/');
|
||||
if (p) {
|
||||
strncpy(dirpath, path, (int)(p-path));
|
||||
} else {
|
||||
strcpy(dirpath, ".");
|
||||
}
|
||||
if ((d = opendir(dirpath)) == NULL) {
|
||||
return ERR_OPENDIR;
|
||||
} else {
|
||||
closedir(d);
|
||||
return ERR_FOPEN;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
|
@ -127,6 +127,4 @@ extern int dir_hier_url(
|
|||
const char* filename, const char* root, int fanout, char* result
|
||||
);
|
||||
|
||||
extern int try_fopen(char* path, FILE*& f, char* mode);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -789,7 +789,8 @@ void handle_request(
|
|||
|
||||
if (sreq.parse(fin) == 0){
|
||||
log_messages.printf(
|
||||
SCHED_MSG_LOG::NORMAL, "Handling request: IP %s, auth %s, host %d, platform %s, version %d.%02d\n",
|
||||
SCHED_MSG_LOG::NORMAL,
|
||||
"Handling request: IP %s, auth %s, host %d, platform %s, version %d.%02d\n",
|
||||
get_remote_addr(), sreq.authenticator, sreq.hostid, sreq.platform_name,
|
||||
sreq.core_client_major_version, sreq.core_client_minor_version
|
||||
);
|
||||
|
|
|
@ -66,6 +66,7 @@ void get_log_path(char* p) {
|
|||
bool use_files = false; // use disk files for req/reply msgs (for debugging)
|
||||
|
||||
SCHED_CONFIG config;
|
||||
GUI_URLS gui_urls;
|
||||
key_t sema_key;
|
||||
int g_pid;
|
||||
|
||||
|
@ -129,6 +130,8 @@ int main() {
|
|||
exit(0);
|
||||
}
|
||||
|
||||
gui_urls.init();
|
||||
|
||||
sprintf(path, "%s/code_sign_public", config.key_dir);
|
||||
retval = read_file_malloc(path, code_sign_key);
|
||||
if (retval) {
|
||||
|
|
|
@ -20,8 +20,10 @@
|
|||
#include "boinc_db.h"
|
||||
#include "sched_config.h"
|
||||
#include "synch.h"
|
||||
#include "server_types.h"
|
||||
|
||||
extern SCHED_CONFIG config;
|
||||
extern GUI_URLS gui_urls;
|
||||
extern key_t sema_key;
|
||||
extern int g_pid;
|
||||
extern void lock_sema();
|
||||
|
|
|
@ -68,15 +68,21 @@ void replace_file_name(
|
|||
while (p) {
|
||||
if (parse_str(p, "<name>", temp, sizeof(temp))) {
|
||||
if(!strcmp(filename, temp)) {
|
||||
replace_element(xml_doc + (p - buf),"<name>","</name>",new_filename);
|
||||
replace_element_contents(
|
||||
xml_doc + (p - buf),"<name>","</name>", new_filename
|
||||
);
|
||||
}
|
||||
} else if (parse_str(p, "<file_name>", temp, sizeof(temp))) {
|
||||
if(!strcmp(filename, temp)) {
|
||||
replace_element(xml_doc + (p - buf),"<file_name>","</file_name>",new_filename);
|
||||
replace_element_contents(
|
||||
xml_doc+(p-buf), "<file_name>","</file_name>", new_filename
|
||||
);
|
||||
}
|
||||
} else if (parse_str(p, "<url>", temp, sizeof(temp))) {
|
||||
if(!strcmp(temp, download_path)) {
|
||||
replace_element(xml_doc + (p - buf),"<url>","</url>",new_download_path);
|
||||
replace_element_contents(
|
||||
xml_doc + (p - buf),"<url>","</url>", new_download_path
|
||||
);
|
||||
}
|
||||
}
|
||||
p = strtok(0, "\n");
|
||||
|
|
|
@ -1,13 +1,29 @@
|
|||
// The contents of this file are subject to the BOINC Public License
|
||||
// Version 1.0 (the "License"); you may not use this file except in
|
||||
// compliance with the License. You may obtain a copy of the License at
|
||||
// http://boinc.berkeley.edu/license_1.0.txt
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS"
|
||||
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
// License for the specific language governing rights and limitations
|
||||
// under the License.
|
||||
//
|
||||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||
//
|
||||
// The Initial Developer of the Original Code is the SETI@home project.
|
||||
// Portions created by the SETI@home project are Copyright (C) 2002
|
||||
// University of California at Berkeley. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
//
|
||||
|
||||
// "Locality scheduling": a scheduling discipline in which
|
||||
// there are large sticky input files,
|
||||
// and many WUs share a single input file.
|
||||
// If a host already has an input file,
|
||||
// we try to send him another result that uses that file.
|
||||
//
|
||||
// The rules for using locality scheduling:
|
||||
// - the input files must have names such that
|
||||
// no name is a substring of another
|
||||
// - result names must be of the form FILENAME__xxx
|
||||
// see doc/sched_locality.php
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -24,6 +24,7 @@ using namespace std;
|
|||
#include <unistd.h>
|
||||
|
||||
#include "filesys.h"
|
||||
#include "error_numbers.h"
|
||||
#include "sched_msgs.h"
|
||||
#include "sched_util.h"
|
||||
|
||||
|
@ -74,3 +75,35 @@ void check_stop_daemons() {
|
|||
bool check_stop_sched() {
|
||||
return boinc_file_exists(STOP_SCHED_FILENAME);
|
||||
}
|
||||
|
||||
// try to open a file.
|
||||
// On failure:
|
||||
// return ERR_FOPEN if the dir is there but not file
|
||||
// (this is generally a nonrecoverable failure)
|
||||
// return ERR_OPENDIR if dir is not there.
|
||||
// (this is generally a recoverable error,
|
||||
// like NFS mount failure, that may go away later)
|
||||
//
|
||||
int try_fopen(char* path, FILE*& f, char* mode) {
|
||||
char* p;
|
||||
DIR* d;
|
||||
char dirpath[256];
|
||||
|
||||
f = fopen(path, mode);
|
||||
if (!f) {
|
||||
memset(dirpath, '\0', sizeof(dirpath));
|
||||
p = strrchr(path, '/');
|
||||
if (p) {
|
||||
strncpy(dirpath, path, (int)(p-path));
|
||||
} else {
|
||||
strcpy(dirpath, ".");
|
||||
}
|
||||
if ((d = opendir(dirpath)) == NULL) {
|
||||
return ERR_OPENDIR;
|
||||
} else {
|
||||
closedir(d);
|
||||
return ERR_FOPEN;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -33,5 +33,6 @@ extern void set_debug_level(int);
|
|||
extern void check_stop_daemons();
|
||||
extern bool check_stop_sched();
|
||||
extern void install_stop_signal_handler();
|
||||
extern int try_fopen(char* path, FILE*& f, char* mode);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -213,6 +213,7 @@ SCHEDULER_REPLY::~SCHEDULER_REPLY() {
|
|||
int SCHEDULER_REPLY::write(FILE* fout) {
|
||||
unsigned int i, j;
|
||||
string u1, u2, t1, t2;
|
||||
char buf[LARGE_BLOB_SIZE];
|
||||
|
||||
fprintf(fout,
|
||||
"<scheduler_reply>\n"
|
||||
|
@ -370,6 +371,10 @@ int SCHEDULER_REPLY::write(FILE* fout) {
|
|||
file_deletes[i].name
|
||||
);
|
||||
}
|
||||
|
||||
gui_urls.get_gui_urls(user, team, host, buf);
|
||||
fputs(buf, fout);
|
||||
|
||||
end:
|
||||
fprintf(fout,
|
||||
"</scheduler_reply>\n"
|
||||
|
@ -555,3 +560,28 @@ void GLOBAL_PREFS::parse(char* buf, char* venue) {
|
|||
parse_double(buf2, "<disk_max_used_pct>", disk_max_used_pct);
|
||||
parse_double(buf2, "<disk_min_free_gb>", disk_min_free_gb);
|
||||
}
|
||||
|
||||
void GUI_URLS::init() {
|
||||
text = 0;
|
||||
read_file_malloc("../gui_urls.xml", text);
|
||||
}
|
||||
|
||||
void GUI_URLS::get_gui_urls(USER& user, TEAM& team, HOST& host, char* buf) {
|
||||
bool found;
|
||||
char userid[256], teamid[256], hostid[256];
|
||||
strcpy(buf, "");
|
||||
if (!text) return;
|
||||
strcpy(buf, text);
|
||||
|
||||
sprintf(userid, "%d", user.id);
|
||||
sprintf(teamid, "%d", team.id);
|
||||
sprintf(hostid, "%d", host.id);
|
||||
while (1) {
|
||||
found = false;
|
||||
found |= str_replace(buf, "<userid/>", userid);
|
||||
found |= str_replace(buf, "<hostid/>", hostid);
|
||||
found |= str_replace(buf, "<teamid/>", teamid);
|
||||
found |= str_replace(buf, "<authenticator/>", user.authenticator);
|
||||
if (!found) break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,6 +84,12 @@ struct GLOBAL_PREFS {
|
|||
void parse(char* buf, char* venue);
|
||||
};
|
||||
|
||||
struct GUI_URLS {
|
||||
char* text;
|
||||
void init();
|
||||
void get_gui_urls(USER& user, TEAM& team, HOST& host, char*);
|
||||
};
|
||||
|
||||
struct SCHEDULER_REQUEST {
|
||||
char authenticator[256];
|
||||
char platform_name[256];
|
||||
|
|
Loading…
Reference in New Issue