|
Lines 130-135
Link Here
|
| 130 |
pid_t poe_pid; /* Process id for main poe process */ |
130 |
pid_t poe_pid; /* Process id for main poe process */ |
| 131 |
pid_t task0_pid; /* Process id for app. task 0 */ |
131 |
pid_t task0_pid; /* Process id for app. task 0 */ |
| 132 |
int debugging; /* Job is being debugged */ |
132 |
int debugging; /* Job is being debugged */ |
|
|
133 |
char *sdm_debugdir; /* Directory path for SDM debugger */ |
| 134 |
char *sdm_debugname; /* Pathname to the top level debugger */ |
| 135 |
char **sdm_debugargs; /* Array of debugger args */ |
| 136 |
char **sdm_envp; /* Environment variables for SDM */ |
| 137 |
int sdm_debug_arg_count; /* Number of debugger args */ |
| 133 |
int stdin_fd; /* STDIN pipe/file descriptor */ |
138 |
int stdin_fd; /* STDIN pipe/file descriptor */ |
| 134 |
int stdout_fd; /* STDOUT pipe/file descriptor */ |
139 |
int stdout_fd; /* STDOUT pipe/file descriptor */ |
| 135 |
int stderr_fd; /* STDERR pipe/file descriptor */ |
140 |
int stderr_fd; /* STDERR pipe/file descriptor */ |
|
Lines 1302-1349
Link Here
|
| 1302 |
char queue_id_str[12]; |
1307 |
char queue_id_str[12]; |
| 1303 |
char jobid_str[12]; |
1308 |
char jobid_str[12]; |
| 1304 |
|
1309 |
|
| 1305 |
if (debug_mode) { |
|
|
| 1306 |
/* |
| 1307 |
* If this is a debug session then we need to start the top level SDM process |
| 1308 |
* at this point. The child SDM processes have already been created by the |
| 1309 |
* fork/exec of the poe process (which in the debug case is 'poe sdm ...') above. |
| 1310 |
*/ |
| 1311 |
pid_t sdm_pid; |
| 1312 |
char *debugger; |
| 1313 |
int len; |
| 1314 |
char **argv; |
| 1315 |
|
| 1316 |
sdm_pid = fork(); |
| 1317 |
if (sdm_pid == 0) { |
| 1318 |
TRACE_DETAIL("+++ Ready to invoke top level SDM\n"); |
| 1319 |
argv = create_debug_parmlist(debugname, debug_arg_count, debug_args, argp); |
| 1320 |
len = strlen(debugdir) + strlen(debugname) + 2; |
| 1321 |
debugger = (char *) malloc(len); |
| 1322 |
malloc_check(debugger, __FUNCTION__, __LINE__); |
| 1323 |
strcpy(debugger, debugdir); |
| 1324 |
strcat(debugger, "/"); |
| 1325 |
strcat(debugger, debugname); |
| 1326 |
sleep(5); |
| 1327 |
status = execve(debugger, argv, envp); |
| 1328 |
print_message(ERROR_MESSAGE, "%s failed to execute, status %s\n", argv[0], strerror(errno)); |
| 1329 |
post_submitjob_error(trans_id, jobid, "Exec failed"); |
| 1330 |
TRACE_EXIT; |
| 1331 |
exit(1); |
| 1332 |
} |
| 1333 |
else { |
| 1334 |
if (sdm_pid == -1) { |
| 1335 |
post_submitjob_error(trans_id, jobid, "Fork for top level SDMfailed"); |
| 1336 |
return PROXY_RES_OK; |
| 1337 |
} |
| 1338 |
else { |
| 1339 |
/* |
| 1340 |
* This is the parent leg of the fork for invoking the top level SDM. |
| 1341 |
* No explicit processing required here. All we care about is |
| 1342 |
* eventually catching the SDM exit status so we don't create a zonbie. |
| 1343 |
*/ |
| 1344 |
} |
| 1345 |
} |
| 1346 |
} |
| 1347 |
if (!job->stdout_redirect) { |
1310 |
if (!job->stdout_redirect) { |
| 1348 |
close(stdout_pipe[1]); |
1311 |
close(stdout_pipe[1]); |
| 1349 |
} |
1312 |
} |
|
Lines 1360-1365
Link Here
|
| 1360 |
job->submit_time = time(NULL); |
1323 |
job->submit_time = time(NULL); |
| 1361 |
job->proxy_jobid = generate_id(); |
1324 |
job->proxy_jobid = generate_id(); |
| 1362 |
job->debugging = debug_mode; |
1325 |
job->debugging = debug_mode; |
|
|
1326 |
if (debug_mode) { |
| 1327 |
job->debugging = debug_mode; |
| 1328 |
job->sdm_envp = envp; |
| 1329 |
job->sdm_debugdir = debugdir; |
| 1330 |
job->sdm_debugname = debugname; |
| 1331 |
job->sdm_debugargs = debug_args; |
| 1332 |
job->sdm_debug_arg_count = debug_arg_count; |
| 1333 |
} |
| 1363 |
TRACE_DETAIL_V("+++ Created poe process pid %d for jobid %d\n", job->poe_pid, |
1334 |
TRACE_DETAIL_V("+++ Created poe process pid %d for jobid %d\n", job->poe_pid, |
| 1364 |
job->proxy_jobid); |
1335 |
job->proxy_jobid); |
| 1365 |
/* |
1336 |
/* |
|
Lines 1783-1788
Link Here
|
| 1783 |
if (!job->stdout_redirect && !job->discovered_job) { |
1754 |
if (!job->stdout_redirect && !job->discovered_job) { |
| 1784 |
RegisterFileHandler(job->stdout_fd, READ_FILE_HANDLER, stdout_handler, job); |
1755 |
RegisterFileHandler(job->stdout_fd, READ_FILE_HANDLER, stdout_handler, job); |
| 1785 |
} |
1756 |
} |
|
|
1757 |
if (job->debugging) { |
| 1758 |
/* |
| 1759 |
* If this is a debug session then we need to start the top level SDM process |
| 1760 |
* at this point. The child SDM processes have already been created by the |
| 1761 |
* fork/exec of the poe process (which in the debug case is 'poe sdm ...') above. |
| 1762 |
*/ |
| 1763 |
pid_t sdm_pid; |
| 1764 |
char *debugger; |
| 1765 |
int len; |
| 1766 |
char **argv; |
| 1767 |
|
| 1768 |
sdm_pid = fork(); |
| 1769 |
if (sdm_pid == 0) { |
| 1770 |
TRACE_DETAIL("+++ Ready to invoke top level SDM\n"); |
| 1771 |
argv = create_debug_parmlist(job->sdm_debugname, job->sdm_debug_arg_count, job->sdm_debugargs, argv); |
| 1772 |
len = strlen(job->sdm_debugdir) + strlen(job->sdm_debugname) + 2; |
| 1773 |
debugger = (char *) malloc(len); |
| 1774 |
malloc_check(debugger, __FUNCTION__, __LINE__); |
| 1775 |
strcpy(debugger, job->sdm_debugdir); |
| 1776 |
strcat(debugger, "/"); |
| 1777 |
strcat(debugger, job->sdm_debugname); |
| 1778 |
sleep(5); |
| 1779 |
status = execve(debugger, argv, job->sdm_envp); |
| 1780 |
print_message(ERROR_MESSAGE, "%s failed to execute, status %s\n", argv[0], strerror(errno)); |
| 1781 |
TRACE_EXIT; |
| 1782 |
exit(1); |
| 1783 |
} |
| 1784 |
else { |
| 1785 |
if (sdm_pid == -1) { |
| 1786 |
return PROXY_RES_OK; |
| 1787 |
} |
| 1788 |
else { |
| 1789 |
/* |
| 1790 |
* This is the parent leg of the fork for invoking the top level SDM. |
| 1791 |
* No explicit processing required here. All we care about is |
| 1792 |
* eventually catching the SDM exit status so we don't create a zonbie. |
| 1793 |
*/ |
| 1794 |
} |
| 1795 |
} |
| 1796 |
} |
| 1786 |
/* |
1797 |
/* |
| 1787 |
* The startup thread exits at this point, so clear the reference in |
1798 |
* The startup thread exits at this point, so clear the reference in |
| 1788 |
* the job info |
1799 |
* the job info |
|
Lines 3069-3080
Link Here
|
| 3069 |
int n; |
3080 |
int n; |
| 3070 |
int i; |
3081 |
int i; |
| 3071 |
|
3082 |
|
| 3072 |
argv = (char **) malloc((debug_args_count + 3) * sizeof(char *)); |
3083 |
argv = (char **) malloc((debug_args_count + 4) * sizeof(char *)); |
| 3073 |
malloc_check(argv, __FUNCTION__, __LINE__); |
3084 |
malloc_check(argv, __FUNCTION__, __LINE__); |
| 3074 |
n = 0; |
3085 |
n = 0; |
| 3075 |
argv[n++] = debugname; |
3086 |
argv[n++] = debugname; |
| 3076 |
if (trace_sdm) { |
3087 |
if (trace_sdm) { |
| 3077 |
argv[n++] = "--debug"; |
3088 |
argv[n++] = "--debug"; |
|
|
3089 |
argv[n++] = "--master"; |
| 3078 |
} |
3090 |
} |
| 3079 |
for (i = 0; i < debug_args_count; i++) { |
3091 |
for (i = 0; i < debug_args_count; i++) { |
| 3080 |
argv[n++] = debug_args[i]; |
3092 |
argv[n++] = debug_args[i]; |