Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client and API: add plan class to APP_INIT_DATA #5830

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/app_start.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ void ACTIVE_TASK::init_app_init_data(APP_INIT_DATA& aid) {
aid.release = BOINC_RELEASE;
aid.app_version = app_version->version_num;
safe_strcpy(aid.app_name, wup->app->name);
safe_strcpy(aid.plan_class, app_version->plan_class);
safe_strcpy(aid.symstore, project->symstore);
safe_strcpy(aid.acct_mgr_url, gstate.acct_mgr_info.master_url);
if (project->project_specific_prefs.length()) {
Expand Down
16 changes: 8 additions & 8 deletions client/client_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,27 +785,27 @@ int FILE_INFO::gunzip(char* md5_buf) {
void APP_VERSION::init() {
safe_strcpy(app_name, "");
version_num = 0;
safe_strcpy(platform, "");
safe_strcpy(plan_class, "");
safe_strcpy(api_version, "");
platform[0] = 0;
plan_class[0] = 0;
api_version[0] = 0;
avg_ncpus = 1;
gpu_usage.rsc_type = 0;
gpu_usage.usage = 0;
gpu_ram = 0;
flops = gstate.host_info.p_fpops;
safe_strcpy(cmdline, "");
safe_strcpy(file_prefix, "");
cmdline[0] = 0;
file_prefix[0] = 0;
needs_network = false;
app = NULL;
project = NULL;
ref_cnt = 0;
graphics_exec_fip = NULL;
safe_strcpy(graphics_exec_path,"");
safe_strcpy(graphics_exec_file, "");
graphics_exec_path[0] = 0;
graphics_exec_file[0] = 0;
max_working_set_size = 0;
missing_coproc = false;
missing_coproc_usage = 0.0;
safe_strcpy(missing_coproc_name, "");
missing_coproc_name[0] = 0;
dont_throttle = false;
is_vm_app = false;
is_wrapper = false;
Expand Down
59 changes: 29 additions & 30 deletions lib/app_ipc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,14 @@ APP_INIT_DATA::APP_INIT_DATA(const APP_INIT_DATA& a) {

APP_INIT_DATA &APP_INIT_DATA::operator=(const APP_INIT_DATA& a) {
if (this != &a) {
copy(a);
copy(a);
}
return *this;
}

void APP_INIT_DATA::copy(const APP_INIT_DATA& a) {
safe_strcpy(app_name, a.app_name);
safe_strcpy(plan_class, a.plan_class);
safe_strcpy(symstore, a.symstore);
safe_strcpy(acct_mgr_url, a.acct_mgr_url);
safe_strcpy(user_name, a.user_name);
Expand Down Expand Up @@ -138,8 +139,12 @@ int write_init_data_file(FILE* f, APP_INIT_DATA& ai) {
ai.teamid,
ai.hostid
);
if (strlen(ai.app_name)) {
fprintf(f, "<app_name>%s</app_name>\n", ai.app_name);
// some strings are always present;
// for others, print only if present

fprintf(f, "<app_name>%s</app_name>\n", ai.app_name);
if (strlen(ai.plan_class)) {
fprintf(f, "<plan_class>%s</plan_class>\n", ai.plan_class);
}
if (strlen(ai.symstore)) {
fprintf(f, "<symstore>%s</symstore>\n", ai.symstore);
Expand All @@ -158,21 +163,11 @@ int write_init_data_file(FILE* f, APP_INIT_DATA& ai) {
xml_escape(ai.user_name, buf, sizeof(buf));
fprintf(f, "<user_name>%s</user_name>\n", buf);
}
if (strlen(ai.project_dir)) {
fprintf(f, "<project_dir>%s</project_dir>\n", ai.project_dir);
}
if (strlen(ai.boinc_dir)) {
fprintf(f, "<boinc_dir>%s</boinc_dir>\n", ai.boinc_dir);
}
if (strlen(ai.authenticator)) {
fprintf(f, "<authenticator>%s</authenticator>\n", ai.authenticator);
}
if (strlen(ai.wu_name)) {
fprintf(f, "<wu_name>%s</wu_name>\n", ai.wu_name);
}
if (strlen(ai.result_name)) {
fprintf(f, "<result_name>%s</result_name>\n", ai.result_name);
}
fprintf(f, "<project_dir>%s</project_dir>\n", ai.project_dir);
fprintf(f, "<boinc_dir>%s</boinc_dir>\n", ai.boinc_dir);
fprintf(f, "<authenticator>%s</authenticator>\n", ai.authenticator);
fprintf(f, "<wu_name>%s</wu_name>\n", ai.wu_name);
fprintf(f, "<result_name>%s</result_name>\n", ai.result_name);
#ifdef _WIN32
if (strlen(ai.shmem_seg_name)) {
fprintf(f, "<comm_obj_name>%s</comm_obj_name>\n", ai.shmem_seg_name);
Expand Down Expand Up @@ -241,7 +236,9 @@ int write_init_data_file(FILE* f, APP_INIT_DATA& ai) {
MIOFILE mf;
mf.init_file(f);
ai.host_info.write(mf, true, true);
ai.proxy_info.write(mf);
if (ai.proxy_info.using_proxy()) {
ai.proxy_info.write(mf);
}
ai.global_prefs.write(mf);
for (unsigned int i=0; i<ai.app_files.size(); i++) {
fprintf(f, "<app_file>%s</app_file>\n", ai.app_files[i].c_str());
Expand All @@ -255,20 +252,21 @@ void APP_INIT_DATA::clear() {
minor_version = 0;
release = 0;
app_version = 0;
safe_strcpy(app_name, "");
safe_strcpy(symstore, "");
safe_strcpy(acct_mgr_url, "");
app_name[0] = 0;
plan_class[0] = 0;
symstore[0] = 0;
acct_mgr_url[0] = 0;
project_preferences = NULL;
userid = 0;
teamid = 0;
hostid = 0;
safe_strcpy(user_name, "");
safe_strcpy(team_name, "");
safe_strcpy(project_dir, "");
safe_strcpy(boinc_dir, "");
safe_strcpy(wu_name, "");
safe_strcpy(result_name, "");
safe_strcpy(authenticator, "");
user_name[0] = 0;
team_name[0] = 0;
project_dir[0] = 0;
boinc_dir[0] = 0;
wu_name[0] = 0;
result_name[0] = 0;
authenticator[0] = 0;
slot = 0;
client_pid = 0;
user_total_credit = 0;
Expand All @@ -292,7 +290,7 @@ void APP_INIT_DATA::clear() {
checkpoint_period = 0;
// gpu_type is an empty string for client versions before 6.13.3 without this
// field or (on newer clients) if BOINC did not assign an OpenCL GPU to task.
safe_strcpy(gpu_type, "");
gpu_type[0] = 0;
// gpu_device_num < 0 for client versions before 6.13.3 without this field
// or (on newer clients) if BOINC did not assign an OpenCL GPU to task.
gpu_device_num = -1;
Expand Down Expand Up @@ -365,6 +363,7 @@ int parse_init_data_file(FILE* f, APP_INIT_DATA& ai) {
if (xp.parse_int("release", ai.release)) continue;
if (xp.parse_int("app_version", ai.app_version)) continue;
if (xp.parse_str("app_name", ai.app_name, sizeof(ai.app_name))) continue;
if (xp.parse_str("plan_class", ai.plan_class, sizeof(ai.plan_class))) continue;
if (xp.parse_str("symstore", ai.symstore, sizeof(ai.symstore))) continue;
if (xp.parse_str("acct_mgr_url", ai.acct_mgr_url, sizeof(ai.acct_mgr_url))) continue;
if (xp.parse_int("userid", ai.userid)) continue;
Expand Down
6 changes: 5 additions & 1 deletion lib/app_ipc.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,18 @@ class APP_CLIENT_SHM {
#endif

// parsed version of main init file
// If you add anything here, update copy()
// If you add anything here, update
// APP_INIT_DATA::clear(), copy(),
// write_init_data_file(), parse_init_data_file()
// ACTIVE_TASK::init_app_init_data()
//
struct APP_INIT_DATA {
int major_version; // BOINC client version info
int minor_version;
int release;
int app_version;
char app_name[256];
char plan_class[256];
char symstore[256]; // symstore URL (Windows)
char acct_mgr_url[256];
// if client is using account manager, its URL
Expand Down
6 changes: 5 additions & 1 deletion lib/proxy_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,16 @@ struct PROXY_INFO {
// whether above fields are defined

PROXY_INFO() {
clear();
clear();
}
int parse(XML_PARSER&);
int parse_config(XML_PARSER&);
int write(MIOFILE&);
void clear();
// are we using a proxy?
bool using_proxy() {
return socks_server_name[0] || http_server_name[0];
}
};

#endif
Loading