Commit 0329d8fc authored by Oliver Behnke's avatar Oliver Behnke

Merge branch 'master' into drupal-eah-albert

parents 3d040388 06ed2cf4
......@@ -44,7 +44,6 @@
android:layout_height="0dip"
android:padding="5dp"
android:clickable="true"
android:focusable="true"
android:layout_margin="5dp"
android:background="@drawable/shape_button_blue"
android:textColor="@color/white_smoke"
......
......@@ -21,8 +21,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:clickable="true"
android:focusable="true">
android:clickable="true">
<RelativeLayout
android:layout_width="60dp"
......
......@@ -50,7 +50,6 @@
android:layout_height="wrap_content"
android:padding="5dp"
android:clickable="true"
android:focusable="true"
android:layout_margin="5dp"
android:background="@drawable/shape_button_blue"
android:textColor="@color/white_smoke"
......@@ -64,7 +63,6 @@
android:layout_height="wrap_content"
android:padding="5dp"
android:clickable="true"
android:focusable="true"
android:layout_margin="5dp"
android:background="@drawable/shape_button_red"
android:textColor="@color/white_smoke"
......
......@@ -22,7 +22,6 @@
android:layout_height="match_parent"
android:orientation="vertical"
android:clickable="true"
android:focusable="true"
android:padding="5dp">
<LinearLayout
......
......@@ -163,7 +163,6 @@
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:clickable="true"
android:focusable="true"
android:textColor="@color/dark_blue"/>
</LinearLayout>
......
......@@ -21,8 +21,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:clickable="true"
android:focusable="true">
android:clickable="true">
<RelativeLayout
android:id="@+id/icon_background"
......
......@@ -22,7 +22,6 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:clickable="true"
android:focusable="true"
android:background="@drawable/shape_light_blue_background_wo_stroke">
<RelativeLayout
......
......@@ -25,7 +25,6 @@
android:id="@+id/tasksList"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:focusable="true"></ListView>
android:clickable="true"></ListView>
</LinearLayout>
......@@ -208,7 +208,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
android:contentDescription="@drawable/resumetask"
android:src="@drawable/resumetask"
android:layout_marginTop="5dp"/>
......@@ -218,7 +217,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
android:contentDescription="@drawable/aborttask"
android:src="@drawable/aborttask"
android:layout_marginTop="5dp"
......
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2017 University of California
// Copyright (C) 2019 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
......@@ -46,8 +46,10 @@ static int win=0;
static int checkparentcounter=0;
#ifdef __APPLE__
static bool need_show = false;
// Set to true to draw both directly to window and also to offscreen buffer
bool debugSharedOffscreenBuffer = false;
#endif
bool fullscreen;
......@@ -119,7 +121,7 @@ static void maybe_render() {
if (throttled_app_render(new_width, new_height, dtime())) {
#ifdef __APPLE__
if (UseSharedOffscreenBuffer()) {
if (UseSharedOffscreenBuffer() && !debugSharedOffscreenBuffer) {
return; // Don't waste cycles drawing to hidden window on screen
}
#endif
......
// Berkeley Open Infrastructure for Network Computing
// http://boinc.berkeley.edu
// Copyright (C) 2017 University of California
// Copyright (C) 2019 University of California
//
// This is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
......@@ -285,7 +285,6 @@ kern_return_t _MGSDisplayFrame(mach_port_t server_port, int32_t frame_index, uin
{
if(clientPortNames[i])
{
// print_to_log_file("BOINCSCR: about to call _MGCDisplayFrame with iosurface_port %d, IOSurfaceGetID %d and frameIndex %d", (int)iosurface_port, IOSurfaceGetID(ioSurfaceBuffers[index]), (int)index);
_MGCDisplayFrame(clientPortNames[i], index, iosurface_port);
}
}
......@@ -293,24 +292,31 @@ kern_return_t _MGSDisplayFrame(mach_port_t server_port, int32_t frame_index, uin
@end
// OpenGL apps built under Xcode 11 apparently use window dimensions based
// on the number of backing store pixels. That is, they double the window
// dimensiona for Retina displays (which have two pixels per point.) But
// OpenGL apps built under earlier versions of Xcode don't.
// Catalina assumes OpenGL apps work as built under Xcode 11, so it displays
// older builds at half width and height, unless we compensate in our code.
// This code is part of my attempt to ensure that BOINC graphics apps built on
// all versions of Xcode work proprly on different versions of OS X. See also
// [BOINC_Saver_ModuleView initWithFrame:] in clientscr/Mac_Saver_ModuleCiew.m
//
void MacPassOffscreenBufferToScreenSaver() {
NSOpenGLContext * myContext = [ NSOpenGLContext currentContext ];
NSView *myView = [ myContext view ];
GLsizei w = myView.bounds.size.width;
GLsizei h = myView.bounds.size.height;
int viewportRect[4];
GLsizei w, h;
GLuint name, namef;
glGetIntegerv(GL_VIEWPORT, (GLint*)viewportRect);
w = viewportRect[2];
h = viewportRect[3];
if (!myserverController) {
myserverController = [[[ServerController alloc] init] retain];
}
if (!ioSurfaceBuffers[0]) {
NSOpenGLContext * myContext = [ NSOpenGLContext currentContext ];
NSView *myView = [ myContext view ];
GLsizei w = myView.bounds.size.width;
GLsizei h = myView.bounds.size.height;
// Set up all of our iosurface buffers
for(int i = 0; i < NUM_IOSURFACE_BUFFERS; i++) {
ioSurfaceBuffers[i] = IOSurfaceCreate((CFDictionaryRef)@{
......
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2017 University of California
// Copyright (C) 2019 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
......@@ -30,6 +30,7 @@ extern void MacPassOffscreenBufferToScreenSaver(void);
extern void BringAppToFront(void);
extern void HideThisApp(void);
extern bool UseSharedOffscreenBuffer(void);
extern bool debugSharedOffscreenBuffer;
extern void print_to_log_file(const char *format, ...);
......
......@@ -1082,7 +1082,7 @@ int ACTIVE_TASK::handle_upload_files() {
"Can't find uploadable file %s", p
);
}
snprintf(path, sizeof(path), "%s/%s", slot_dir, buf);
snprintf(path, sizeof(path), "%.*s/%.*s", DIR_LEN, slot_dir, FILE_LEN, buf);
delete_project_owned_file(path, true); // delete the link file
}
}
......
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
// Copyright (C) 2019 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
......@@ -173,6 +173,8 @@ struct ACTIVE_TASK {
double finish_file_time;
// time when we saw finish file in slot dir.
// Used to kill apps that hang after writing finished file
int graphics_pid;
// PID of running graphics app (Mac)
void set_task_state(int, const char*);
inline int task_state() {
......@@ -302,6 +304,7 @@ public:
active_tasks_v active_tasks;
ACTIVE_TASK* lookup_pid(int);
ACTIVE_TASK* lookup_result(RESULT*);
ACTIVE_TASK* lookup_slot(int);
void init();
bool poll();
void suspend_all(int reason);
......
......@@ -542,7 +542,7 @@ void ACTIVE_TASK::handle_exited_app(int stat) {
snprintf(err_msg, sizeof(err_msg),
"process exited with code %d (0x%x, %d)",
result->exit_status, result->exit_status,
(-1<<8)|result->exit_status
(~0xff)|result->exit_status
);
gstate.report_result_error(*result, err_msg);
} else {
......@@ -1554,7 +1554,7 @@ void ACTIVE_TASK_SET::get_msgs() {
}
if (atp->get_app_status_msg()) {
if (old_time != atp->checkpoint_cpu_time) {
char buf[256];
char buf[512];
sprintf(buf, "%s checkpointed", atp->result->name);
if (atp->overdue_checkpoint) {
gstate.request_schedule_cpus(buf);
......
......@@ -351,7 +351,7 @@ static int create_dirs_for_logical_name(
static void prepend_prefix(APP_VERSION* avp, char* in, char* out, int len) {
if (strlen(avp->file_prefix)) {
snprintf(out, len, "%s/%s", avp->file_prefix, in);
snprintf(out, len, "%.16s/%.200s", avp->file_prefix, in);
} else {
strlcpy(out, in, len);
}
......@@ -467,7 +467,7 @@ int ACTIVE_TASK::link_user_files() {
}
int ACTIVE_TASK::copy_output_files() {
char slotfile[256], projfile[256], open_name[256];
char slotfile[MAXPATHLEN], projfile[256], open_name[256];
unsigned int i;
for (i=0; i<result->output_files.size(); i++) {
FILE_REF& fref = result->output_files[i];
......@@ -476,7 +476,7 @@ int ACTIVE_TASK::copy_output_files() {
prepend_prefix(
app_version, fref.open_name, open_name, sizeof(open_name)
);
snprintf(slotfile, sizeof(slotfile), "%s/%s", slot_dir, open_name);
snprintf(slotfile, sizeof(slotfile), "%.*s/%.*s", DIR_LEN, slot_dir, FILE_LEN, open_name);
get_pathname(fip, projfile, sizeof(projfile));
int retval = boinc_rename(slotfile, projfile);
// the rename fails if the output file isn't there.
......@@ -1108,7 +1108,7 @@ int ACTIVE_TASK::start(bool test) {
if (test) {
strcpy(buf, exec_path);
} else {
snprintf(buf, sizeof(buf), "../../%s", exec_path);
snprintf(buf, sizeof(buf), "../../%.1024s", exec_path);
}
if (g_use_sandbox) {
char switcher_path[MAXPATHLEN];
......@@ -1167,7 +1167,7 @@ error:
//
gstate.input_files_available(result, true);
char err_msg[4096];
snprintf(err_msg, sizeof(err_msg), "couldn't start app: %s", buf);
snprintf(err_msg, sizeof(err_msg), "couldn't start app: %.256s", buf);
gstate.report_result_error(*result, err_msg);
if (log_flags.task_debug) {
msg_printf(wup->project, MSG_INFO,
......
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
// Copyright (C) 2019 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
......@@ -93,7 +93,10 @@ Commands:\n\
--read_cc_config\n\
--read_global_prefs_override\n\
--run_benchmarks\n\
--set_gpu_mode mode duration set GPU run mode for given duration\n\
--run_graphics_app id op run, test or stop graphics app\n\
op = run | runfullscreen | stop | test\n\
id = slot # for run or runfullscreen, process ID for stop or test\n\
--set_gpu_mode mode duration set GPU run mode for given duration\n\
mode = always | auto | never\n\
--set_host_info product_name\n\
--set_network_mode mode duration set network mode for given duration\n\
......@@ -423,7 +426,7 @@ int main(int argc, char** argv) {
}
} else if (!strcmp(cmd, "--set_host_info")) {
HOST_INFO h;
memset(&h, 0, sizeof(h));
h.clear();
char* pn = next_arg(argc, argv, i);
safe_strcpy(h.product_name, pn);
retval = rpc.set_host_info(h);
......@@ -542,6 +545,18 @@ int main(int argc, char** argv) {
retval = rpc.acct_mgr_rpc("", "", "");
} else if (!strcmp(cmd, "--run_benchmarks")) {
retval = rpc.run_benchmarks();
} else if (!strcmp(cmd, "--run_graphics_app")) {
int slot = 0;
if (!strcmp(argv[3], "test") || (!strcmp(argv[3], "stop"))) {
i = atoi(argv[2]);
} else {
slot = atoi(argv[2]);
i = 0;
}
retval = rpc.run_graphics_app(slot, i, argv[3]);
if (strcmp(argv[3], "stop") & !retval) {
printf("pid: %d\n", i);
}
} else if (!strcmp(cmd, "--get_project_config")) {
char* gpc_url = next_arg(argc, argv,i);
retval = rpc.get_project_config(string(gpc_url));
......
......@@ -55,7 +55,7 @@ void show_message(
PROJ_AM *p, char* msg, int priority, bool is_html, const char* link
) {
const char* x;
char message[1024], event_msg[1024], evt_message[2048];
char message[1024], event_msg[2048], evt_message[2048];
double t = dtime();
char* time_string = time_to_string(t);
......@@ -78,7 +78,7 @@ void show_message(
snprintf(event_msg, sizeof(event_msg), "[error] %s", message);
break;
case MSG_SCHEDULER_ALERT:
snprintf(event_msg, sizeof(event_msg), "%s: %s",
snprintf(event_msg, sizeof(event_msg), "%.64s: %s",
_("Message from server"), message
);
break;
......
......@@ -226,8 +226,14 @@ struct DAILY_STATS {
double host_expavg_credit;
double day;
void clear();
DAILY_STATS() {clear();}
DAILY_STATS(int){}
void clear() {
static const DAILY_STATS x(0);
*this = x;
}
DAILY_STATS() {
clear();
}
int parse(FILE*);
};
bool operator < (const DAILY_STATS&, const DAILY_STATS&);
......@@ -273,7 +279,14 @@ struct APP {
bool ignore;
#endif
APP() {memset(this, 0, sizeof(APP));}
APP(int){}
void clear() {
static const APP x(0);
*this = x;
}
APP(){
clear();
}
int parse(XML_PARSER&);
int write(MIOFILE&);
};
......
......@@ -1227,7 +1227,7 @@ bool CLIENT_STATE::enforce_run_list(vector<RESULT*>& run_list) {
// and prune those that can't be assigned
//
assign_coprocs(run_list);
bool scheduled_mt = false;
//bool scheduled_mt = false;
// prune jobs that don't fit in RAM or that exceed CPU usage limits.
// Mark the rest as SCHEDULED
......@@ -1337,9 +1337,11 @@ bool CLIENT_STATE::enforce_run_list(vector<RESULT*>& run_list) {
continue;
}
#if 0
if (rp->avp->avg_ncpus > 1) {
scheduled_mt = true;
}
#endif
ncpus_used += rp->avp->avg_ncpus;
atp->next_scheduler_state = CPU_SCHED_SCHEDULED;
ram_left -= wss;
......
......@@ -358,10 +358,6 @@ int CLIENT_STATE::parse_account_files() {
return 0;
}
void DAILY_STATS::clear() {
memset(this, 0, sizeof(DAILY_STATS));
}
int DAILY_STATS::parse(FILE* in) {
MIOFILE mf;
XML_PARSER xp(&mf);
......
......@@ -304,11 +304,8 @@ int CLIENT_STATE::latest_version(APP* app, char* platform) {
// Find the ACTIVE_TASK in the current set with the matching PID
//
ACTIVE_TASK* ACTIVE_TASK_SET::lookup_pid(int pid) {
unsigned int i;
ACTIVE_TASK* atp;
for (i=0; i<active_tasks.size(); i++) {
atp = active_tasks[i];
for (unsigned int i=0; i<active_tasks.size(); i++) {
ACTIVE_TASK *atp = active_tasks[i];
if (atp->pid == pid) return atp;
}
return NULL;
......@@ -317,11 +314,8 @@ ACTIVE_TASK* ACTIVE_TASK_SET::lookup_pid(int pid) {
// Find the ACTIVE_TASK in the current set with the matching result
//
ACTIVE_TASK* ACTIVE_TASK_SET::lookup_result(RESULT* result) {
unsigned int i;
ACTIVE_TASK* atp;
for (i=0; i<active_tasks.size(); i++) {
atp = active_tasks[i];
for (unsigned int i=0; i<active_tasks.size(); i++) {
ACTIVE_TASK *atp = active_tasks[i];
if (atp->result == result) {
return atp;
}
......@@ -329,6 +323,16 @@ ACTIVE_TASK* ACTIVE_TASK_SET::lookup_result(RESULT* result) {
return NULL;
}
ACTIVE_TASK* ACTIVE_TASK_SET::lookup_slot(int slot) {
for (unsigned int i=0; i<active_tasks.size(); i++) {
ACTIVE_TASK *atp = active_tasks[i];
if (atp->slot == slot) {
return atp;
}
}
return NULL;
}
#ifndef SIM
// on startup, see if any active tasks have a finished file
// i.e. they finished as the client was shutting down
......
......@@ -175,7 +175,6 @@ int cpu_benchmarks(BENCHMARK_DESC* bdp) {
double vax_mips, int_loops=0, int_time=0, fp_time;
bdp->error_str[0] = '\0';
host_info.clear_host_info();
#if defined(ANDROID) && defined(__arm__)
// check for FP accelerator: VFP, Neon, or none;
......
......@@ -192,7 +192,7 @@ int FILE_INFO::verify_file(
// see if we need to unzip it
//
if (download_gzipped && !boinc_file_exists(pathname)) {
char gzpath[MAXPATHLEN];
char gzpath[MAXPATHLEN+16];
snprintf(gzpath, sizeof(gzpath), "%s.gz", pathname);
if (boinc_file_exists(gzpath) ) {
if (allow_async && nbytes > ASYNC_FILE_THRESHOLD) {
......@@ -417,7 +417,7 @@ bool CLIENT_STATE::create_and_delete_pers_file_xfers() {
// If this was a compressed download, rename .gzt to .gz
//
if (fip->download_gzipped) {
char path[MAXPATHLEN], from_path[MAXPATHLEN], to_path[MAXPATHLEN];
char path[MAXPATHLEN], from_path[MAXPATHLEN+16], to_path[MAXPATHLEN+16];
get_pathname(fip, path, sizeof(path));
snprintf(from_path, sizeof(from_path), "%s.gzt", path);
snprintf(to_path, sizeof(to_path), "%s.gz", path);
......
......@@ -98,7 +98,7 @@ static void write_rss_feed_descs(MIOFILE& fout, vector<RSS_FEED>& feeds) {
}
static void write_project_feed_list(PROJ_AM* p) {
char buf[256];
char buf[MAXPATHLEN];
project_feed_list_file_name(p, buf, sizeof(buf));
FILE* f = fopen(buf, "w");
if (!f) return;
......@@ -619,7 +619,7 @@ void NOTICES::write(int seqno, GUI_RPC_CONN& grc, bool public_only) {
void RSS_FEED::feed_file_name(char* path, int len) {
char buf[256];
escape_project_url(url_base, buf);
snprintf(path, len, NOTICES_DIR"/%s.xml", buf);
snprintf(path, len, NOTICES_DIR"/%.128s.xml", buf);
}
void RSS_FEED::archive_file_name(char* path, int len) {
......
......@@ -465,7 +465,7 @@ bool CLIENT_STATE::scheduler_rpc_poll() {
p = next_project_sched_rpc_pending();
if (p) {
if (log_flags.sched_op_debug) {
msg_printf(p, MSG_INFO, "sched RPC pending: %s",
msg_printf(p, MSG_INFO, "[sched_op] sched RPC pending: %s",
rpc_reason_string(p->sched_rpc_pending)
);
}
......@@ -664,7 +664,7 @@ int CLIENT_STATE::handle_scheduler_reply(
if (log_flags.sched_op_debug && sr.request_delay) {
msg_printf(project, MSG_INFO,
"Project requested delay of %.0f seconds", sr.request_delay
"[sched_op] Project requested delay of %.0f seconds", sr.request_delay
);
}
......@@ -690,7 +690,7 @@ int CLIENT_STATE::handle_scheduler_reply(
if (gstate.acct_mgr_info.using_am() && p && q && !strcmp(p, q)) {
if (log_flags.sched_op_debug) {
msg_printf(project, MSG_INFO,
"ignoring prefs from project; using prefs from AM"
"[sched_op] ignoring prefs from project; using prefs from AM"
);
}
} else if (!global_prefs.host_specific || sr.scheduler_version >= 507) {
......@@ -707,7 +707,7 @@ int CLIENT_STATE::handle_scheduler_reply(
} else {
if (log_flags.sched_op_debug) {
msg_printf(project, MSG_INFO,
"ignoring prefs from old server; we have host-specific prefs"
"[sched_op] ignoring prefs from old server; we have host-specific prefs"
);
}
}
......@@ -1187,7 +1187,7 @@ void CLIENT_STATE::check_project_timeout() {
PROJECT* p = projects[i];
if (p->possibly_backed_off && now > p->min_rpc_time) {
p->possibly_backed_off = false;
char buf[256];
char buf[1024];
snprintf(buf, sizeof(buf), "Backoff ended for %s", p->get_project_name());
request_work_fetch(buf);
}
......
......@@ -243,7 +243,7 @@ void delete_old_slot_dirs() {
// Clean these up here. (We must do this before deleting the
// INIT_DATA_FILE, if any, from each slot directory.)
//
snprintf(init_data_path, sizeof(init_data_path), "%s/%s", path, INIT_DATA_FILE);
snprintf(init_data_path, sizeof(init_data_path), "%.*s/%.*s", DIR_LEN, path, FILE_LEN, INIT_DATA_FILE);
shmem_seg_name = ftok(init_data_path, 1);
if (shmem_seg_name != -1) {
destroy_shmem(shmem_seg_name);
......
......@@ -34,7 +34,7 @@ class FILE_XFER : public HTTP_OP {
public:
FILE_INFO* fip;
char pathname[256];
char header[4096];
char header[8192];
bool file_size_query;
bool is_upload;
double starting_size;
......
......@@ -201,7 +201,7 @@ void COPROCS::correlate_gpus(
IGNORE_GPU_INSTANCE &ignore_gpu_instance
) {
unsigned int i;
char buf[256], buf2[256];
char buf[256], buf2[1024];
nvidia.correlate(use_all, ignore_gpu_instance[PROC_TYPE_NVIDIA_GPU]);
ati.correlate(use_all, ignore_gpu_instance[PROC_TYPE_AMD_GPU]);
......@@ -502,7 +502,7 @@ int COPROCS::read_coproc_info_file(vector<string> &warnings) {
} else {
my_nvidia_gpu.device_num = (int)nvidia_gpus.size();
my_nvidia_gpu.pci_info = my_nvidia_gpu.pci_infos[0];
memset(&my_nvidia_gpu.pci_infos[0], 0, sizeof(struct PCI_INFO));
my_nvidia_gpu.pci_infos[0].clear();
nvidia_gpus.push_back(my_nvidia_gpu);
}
continue;
......@@ -519,10 +519,10 @@ int COPROCS::read_coproc_info_file(vector<string> &warnings) {
}
if (xp.match_tag("ati_opencl")) {
memset(&ati_opencl, 0, sizeof(ati_opencl));
ati_opencl.clear();
retval = ati_opencl.parse(xp, "/ati_opencl");
if (retval) {
memset(&ati_opencl, 0, sizeof(ati_opencl));
ati_opencl.clear();
} else {
ati_opencl.is_used = COPROC_IGNORED;
ati_opencls.push_back(ati_opencl);
......@@ -531,10 +531,10 @@ int COPROCS::read_coproc_info_file(vector<string> &warnings) {
}
if (xp.match_tag("nvidia_opencl")) {