Skip to content

Commit b5e3c37

Browse files
Merge pull request #6216 from BoySanic/wrapper-fix
Add --passthrough_child arg to wrapper app
2 parents d4ed06d + 5f555bb commit b5e3c37

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

samples/wrapper/wrapper.cpp

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,6 +1183,7 @@ void usage() {
11831183
" --trickle X\n"
11841184
" --version\n"
11851185
" --use_tstp\n"
1186+
" --passthrough_child\n"
11861187
);
11871188
boinc_finish(EXIT_INIT_FAILURE);
11881189
}
@@ -1196,7 +1197,9 @@ int main(int argc, char** argv) {
11961197
// total CPU time at last checkpoint
11971198
char buf[256];
11981199
bool is_sporadic = false;
1199-
1200+
bool passthrough_child = false;
1201+
int child_arg_count = 0;
1202+
char** child_args;
12001203
// Log banner
12011204
//
12021205
fprintf(stderr, "%s wrapper (%d.%d.%d): starting\n",
@@ -1224,7 +1227,16 @@ int main(int argc, char** argv) {
12241227
#endif
12251228
} else if (!strcmp(argv[j], "--use_tstp")) {
12261229
use_tstp = true;
1227-
} else {
1230+
} else if (!strcmp(argv[j], "--passthrough_child")) {
1231+
passthrough_child = true;
1232+
child_arg_count = (argc - (j-1));
1233+
child_args = (char**)malloc(sizeof(char*) * child_arg_count);
1234+
for (int k = j; k < argc; k++) {
1235+
1236+
child_args[k] = argv[k];
1237+
}
1238+
j = argc - 1;
1239+
} else if (!passthrough_child){
12281240
fprintf(stderr, "Unrecognized option %s\n", argv[j]);
12291241
usage();
12301242
}
@@ -1313,7 +1325,12 @@ int main(int argc, char** argv) {
13131325
double cpu_time = 0;
13141326

13151327
task.starting_cpu = checkpoint_cpu_time;
1316-
retval = task.run(argc, argv);
1328+
if(passthrough_child){
1329+
retval = task.run(child_arg_count, child_args);
1330+
}else{
1331+
retval = task.run(argc, argv);
1332+
}
1333+
13171334
if (retval) {
13181335
boinc_finish(retval);
13191336
}

0 commit comments

Comments
 (0)