@@ -342,11 +342,7 @@ static int close_open_file_descriptors(int write_fd, orte_iof_base_io_conf_t opt
342
342
return ORTE_SUCCESS ;
343
343
}
344
344
345
- static int do_child ( orte_proc_t * child ,
346
- char * app , char * * argv ,
347
- char * * environ_copy ,
348
- orte_job_t * jobdat , int write_fd ,
349
- orte_iof_base_io_conf_t opts )
345
+ static int do_child (orte_odls_spawn_caddy_t * cd , int write_fd )
350
346
{
351
347
int i , rc ;
352
348
sigset_t sigs ;
@@ -355,7 +351,7 @@ static int do_child( orte_proc_t *child,
355
351
/* Setup the pipe to be close-on-exec */
356
352
opal_fd_set_cloexec (write_fd );
357
353
358
- if (NULL != child ) {
354
+ if (NULL != cd -> child ) {
359
355
/* setup stdout/stderr so that any error messages that we
360
356
may print out will get displayed back at orterun.
361
357
@@ -369,20 +365,19 @@ static int do_child( orte_proc_t *child,
369
365
always outputs a nice, single message indicating what
370
366
happened
371
367
*/
372
- if (ORTE_SUCCESS != (i = orte_iof_base_setup_child (& opts ,
373
- & environ_copy ))) {
368
+ if (ORTE_SUCCESS != (i = orte_iof_base_setup_child (& cd -> opts , & cd -> env ))) {
374
369
ORTE_ERROR_LOG (i );
375
370
send_error_show_help (write_fd , 1 ,
376
371
"help-orte-odls-alps.txt" ,
377
372
"iof setup failed" ,
378
- orte_process_info .nodename , app );
373
+ orte_process_info .nodename , cd -> app -> app );
379
374
/* Does not return */
380
375
}
381
376
382
377
/* now set any child-level controls such as binding */
383
- orte_rtc .set (jobdat , child , & environ_copy , write_fd );
378
+ orte_rtc .set (cd -> jdata , cd -> child , & cd -> env , write_fd );
384
379
385
- } else if (!ORTE_FLAG_TEST (jobdat , ORTE_JOB_FLAG_FORWARD_OUTPUT )) {
380
+ } else if (!ORTE_FLAG_TEST (cd -> jdata , ORTE_JOB_FLAG_FORWARD_OUTPUT )) {
386
381
/* tie stdin/out/err/internal to /dev/null */
387
382
int fdnull ;
388
383
for (i = 0 ; i < 3 ; i ++ ) {
@@ -393,24 +388,24 @@ static int do_child( orte_proc_t *child,
393
388
close (fdnull );
394
389
}
395
390
fdnull = open ("/dev/null" , O_RDONLY , 0 );
396
- if (fdnull > opts .p_internal [1 ]) {
397
- dup2 (fdnull , opts .p_internal [1 ]);
391
+ if (fdnull > cd -> opts .p_internal [1 ]) {
392
+ dup2 (fdnull , cd -> opts .p_internal [1 ]);
398
393
}
399
394
close (fdnull );
400
395
}
401
396
402
- if (ORTE_SUCCESS != close_open_file_descriptors (write_fd , opts )) {
397
+ if (ORTE_SUCCESS != close_open_file_descriptors (write_fd , cd -> opts )) {
403
398
send_error_show_help (write_fd , 1 , "help-orte-odls-alps.txt" ,
404
399
"close fds" ,
405
- orte_process_info .nodename , app ,
400
+ orte_process_info .nodename , cd -> app -> app ,
406
401
__FILE__ , __LINE__ );
407
402
}
408
403
409
404
410
- if (argv == NULL ) {
411
- argv = malloc (sizeof (char * )* 2 );
412
- argv [0 ] = strdup (app );
413
- argv [1 ] = NULL ;
405
+ if (cd -> argv == NULL ) {
406
+ cd -> argv = malloc (sizeof (char * )* 2 );
407
+ cd -> argv [0 ] = strdup (cd -> app -> app );
408
+ cd -> argv [1 ] = NULL ;
414
409
}
415
410
416
411
/* Set signal handlers back to the default. Do this close to
@@ -437,19 +432,19 @@ static int do_child( orte_proc_t *child,
437
432
438
433
if (10 < opal_output_get_verbosity (orte_odls_base_framework .framework_output )) {
439
434
int jout ;
440
- opal_output (0 , "%s STARTING %s" , ORTE_NAME_PRINT (ORTE_PROC_MY_NAME ), app );
441
- for (jout = 0 ; NULL != argv [jout ]; jout ++ ) {
442
- opal_output (0 , "%s\tARGV[%d]: %s" , ORTE_NAME_PRINT (ORTE_PROC_MY_NAME ), jout , argv [jout ]);
435
+ opal_output (0 , "%s STARTING %s" , ORTE_NAME_PRINT (ORTE_PROC_MY_NAME ), cd -> app -> app );
436
+ for (jout = 0 ; NULL != cd -> argv [jout ]; jout ++ ) {
437
+ opal_output (0 , "%s\tARGV[%d]: %s" , ORTE_NAME_PRINT (ORTE_PROC_MY_NAME ), jout , cd -> argv [jout ]);
443
438
}
444
- for (jout = 0 ; NULL != environ_copy [jout ]; jout ++ ) {
445
- opal_output (0 , "%s\tENVIRON[%d]: %s" , ORTE_NAME_PRINT (ORTE_PROC_MY_NAME ), jout , environ_copy [jout ]);
439
+ for (jout = 0 ; NULL != cd -> env [jout ]; jout ++ ) {
440
+ opal_output (0 , "%s\tENVIRON[%d]: %s" , ORTE_NAME_PRINT (ORTE_PROC_MY_NAME ), jout , cd -> env [jout ]);
446
441
}
447
442
}
448
443
449
- execve (app , argv , environ_copy );
444
+ execve (cd -> app -> app , cd -> argv , cd -> env );
450
445
send_error_show_help (write_fd , 1 ,
451
446
"help-orte-odls-alps.txt" , "execve error" ,
452
- orte_process_info .nodename , app , strerror (errno ));
447
+ orte_process_info .nodename , cd -> app -> app , strerror (errno ));
453
448
/* Does not return */
454
449
}
455
450
@@ -729,4 +724,3 @@ static int orte_odls_alps_restart_proc(orte_proc_t *child)
729
724
}
730
725
return rc ;
731
726
}
732
-
0 commit comments