root/mpich2/trunk/src/pm/hydra/bootstrap/fork/fork_launch.c @ 4601

Revision 4601, 1.7 KB (checked in by balaji, 6 months ago)

Rename global symbols to avoid namespace conflicts.

Reviewed by goodell.

Line 
1/* -*- Mode: C; c-basic-offset:4 ; -*- */
2/*
3 *  (C) 2008 by Argonne National Laboratory.
4 *      See COPYRIGHT in top-level directory.
5 */
6
7#include "hydra_utils.h"
8#include "bsci.h"
9#include "bscu.h"
10#include "fork.h"
11
12HYD_Status HYD_BSCD_fork_launch_procs(char **global_args, char *partition_id_str,
13                                      struct HYD_Partition *partition_list)
14{
15    struct HYD_Partition *partition;
16    char *client_arg[HYD_NUM_TMP_STRINGS];
17    int i, arg, process_id;
18    HYD_Status status = HYD_SUCCESS;
19
20    HYDU_FUNC_ENTER();
21
22    process_id = 0;
23    FORALL_ACTIVE_PARTITIONS(partition, partition_list) {
24        /* Setup the executable arguments */
25        arg = 0;
26
27        for (i = 0; global_args[i]; i++)
28            client_arg[arg++] = HYDU_strdup(global_args[i]);
29
30        if (partition_id_str) {
31            client_arg[arg++] = HYDU_strdup(partition_id_str);
32            client_arg[arg++] = HYDU_int_to_str(partition->base->partition_id);
33        }
34
35        client_arg[arg++] = NULL;
36
37        if (HYD_BSCI_info.debug) {
38            HYDU_Dump("Launching process: ");
39            HYDU_print_strlist(client_arg);
40        }
41
42        /* The stdin pointer will be some value for process_id 0; for
43         * everyone else, it's NULL. */
44        status = HYDU_create_process(client_arg, NULL,
45                                     (process_id == 0 ? &partition->base->in : NULL),
46                                     &partition->base->out, &partition->base->err,
47                                     &partition->base->pid, -1);
48        HYDU_ERR_POP(status, "create process returned error\n");
49
50        HYDU_free_strlist(client_arg);
51
52        process_id++;
53    }
54
55  fn_exit:
56    HYDU_FUNC_EXIT();
57    return status;
58
59  fn_fail:
60    goto fn_exit;
61}
Note: See TracBrowser for help on using the browser.