1 /*
2  * Copyright (C) by Argonne National Laboratory
3  *     See COPYRIGHT in top-level directory
4  */
5 
6 #include "pmip.h"
7 #include "bsci.h"
8 #include "topo.h"
9 #include "demux.h"
10 #include "hydra.h"
11 
12 
HYD_pmcd_pmip_send_signal(int sig)13 void HYD_pmcd_pmip_send_signal(int sig)
14 {
15     int i, pgid;
16 
17     /* Send the kill signal to all processes */
18     for (i = 0; i < HYD_pmcd_pmip.local.proxy_process_count; i++)
19         if (HYD_pmcd_pmip.downstream.pid[i] != -1) {
20 #if defined(HAVE_GETPGID) && defined(HAVE_SETSID)
21             /* If we are able to get the process group ID, and the
22              * child process has its own process group ID, send a
23              * signal to the entire process group */
24             pgid = getpgid(HYD_pmcd_pmip.downstream.pid[i]);
25             killpg(pgid, sig);
26 #else
27             kill(HYD_pmcd_pmip.downstream.pid[i], sig);
28 #endif
29         }
30 
31     HYD_pmcd_pmip.downstream.forced_cleanup = 1;
32 }
33 
control_port_fn(char * arg,char *** argv)34 static HYD_status control_port_fn(char *arg, char ***argv)
35 {
36     char *port = NULL, *name;
37     HYD_status status = HYD_SUCCESS;
38 
39     HYDU_ERR_CHKANDJUMP(status, HYD_pmcd_pmip.upstream.server_name, HYD_INTERNAL_ERROR,
40                         "duplicate control port setting\n");
41 
42     port = MPL_strdup(**argv);
43     HYDU_ERR_CHKANDJUMP(status, NULL == port, HYD_INTERNAL_ERROR, "port not provided\n");
44     name = strtok(port, ":");
45     HYD_pmcd_pmip.upstream.server_name = name ? MPL_strdup(name) : NULL;
46     HYD_pmcd_pmip.upstream.server_port = strtol(strtok(NULL, ":"), NULL, 10);
47 
48     (*argv)++;
49 
50   fn_exit:
51     MPL_free(port);
52     return status;
53 
54   fn_fail:
55     goto fn_exit;
56 }
57 
proxy_id_fn(char * arg,char *** argv)58 static HYD_status proxy_id_fn(char *arg, char ***argv)
59 {
60     HYD_status status = HYD_SUCCESS;
61 
62     status = HYDU_set_int(arg, &HYD_pmcd_pmip.local.id, atoi(**argv));
63 
64     (*argv)++;
65 
66     return status;
67 }
68 
pgid_fn(char * arg,char *** argv)69 static HYD_status pgid_fn(char *arg, char ***argv)
70 {
71     HYD_status status = HYD_SUCCESS;
72 
73     status = HYDU_set_int(arg, &HYD_pmcd_pmip.local.pgid, atoi(**argv));
74 
75     (*argv)++;
76 
77     return status;
78 }
79 
debug_fn(char * arg,char *** argv)80 static HYD_status debug_fn(char *arg, char ***argv)
81 {
82     return HYDU_set_int(arg, &HYD_pmcd_pmip.user_global.debug, 1);
83 }
84 
usize_fn(char * arg,char *** argv)85 static HYD_status usize_fn(char *arg, char ***argv)
86 {
87     HYD_status status = HYD_SUCCESS;
88 
89     HYD_pmcd_pmip.user_global.usize = atoi(**argv);
90 
91     (*argv)++;
92 
93     return status;
94 }
95 
pmi_port_fn(char * arg,char *** argv)96 static HYD_status pmi_port_fn(char *arg, char ***argv)
97 {
98     HYD_status status = HYD_SUCCESS;
99 
100     HYD_pmcd_pmip.user_global.pmi_port = atoi(**argv);
101 
102     (*argv)++;
103 
104     return status;
105 }
106 
gpus_per_proc_fn(char * arg,char *** argv)107 static HYD_status gpus_per_proc_fn(char *arg, char ***argv)
108 {
109     HYD_status status = HYD_SUCCESS;
110 
111     HYD_pmcd_pmip.user_global.gpus_per_proc = atoi(**argv);
112 
113     (*argv)++;
114 
115     return status;
116 }
117 
rmk_fn(char * arg,char *** argv)118 static HYD_status rmk_fn(char *arg, char ***argv)
119 {
120     HYD_status status = HYD_SUCCESS;
121 
122     status = HYDU_set_str(arg, &HYD_pmcd_pmip.user_global.rmk, **argv);
123 
124     (*argv)++;
125 
126     return status;
127 }
128 
launcher_fn(char * arg,char *** argv)129 static HYD_status launcher_fn(char *arg, char ***argv)
130 {
131     HYD_status status = HYD_SUCCESS;
132 
133     status = HYDU_set_str(arg, &HYD_pmcd_pmip.user_global.launcher, **argv);
134 
135     (*argv)++;
136 
137     return status;
138 }
139 
launcher_exec_fn(char * arg,char *** argv)140 static HYD_status launcher_exec_fn(char *arg, char ***argv)
141 {
142     HYD_status status = HYD_SUCCESS;
143 
144     status = HYDU_set_str(arg, &HYD_pmcd_pmip.user_global.launcher_exec, **argv);
145 
146     (*argv)++;
147 
148     return status;
149 }
150 
demux_fn(char * arg,char *** argv)151 static HYD_status demux_fn(char *arg, char ***argv)
152 {
153     HYD_status status = HYD_SUCCESS;
154 
155     status = HYDU_set_str(arg, &HYD_pmcd_pmip.user_global.demux, **argv);
156 
157     (*argv)++;
158 
159     return status;
160 }
161 
iface_fn(char * arg,char *** argv)162 static HYD_status iface_fn(char *arg, char ***argv)
163 {
164     HYD_status status = HYD_SUCCESS;
165 
166     status = HYDU_set_str(arg, &HYD_pmcd_pmip.user_global.iface, **argv);
167 
168     (*argv)++;
169 
170     return status;
171 }
172 
auto_cleanup_fn(char * arg,char *** argv)173 static HYD_status auto_cleanup_fn(char *arg, char ***argv)
174 {
175     HYD_status status = HYD_SUCCESS;
176 
177     status = HYDU_set_int(arg, &HYD_pmcd_pmip.user_global.auto_cleanup, atoi(**argv));
178 
179     (*argv)++;
180 
181     return status;
182 }
183 
retries_fn(char * arg,char *** argv)184 static HYD_status retries_fn(char *arg, char ***argv)
185 {
186     HYD_status status = HYD_SUCCESS;
187 
188     status = HYDU_set_int(arg, &HYD_pmcd_pmip.local.retries, atoi(**argv));
189 
190     (*argv)++;
191 
192     return status;
193 }
194 
pmi_kvsname_fn(char * arg,char *** argv)195 static HYD_status pmi_kvsname_fn(char *arg, char ***argv)
196 {
197     MPL_snprintf(HYD_pmcd_pmip.local.kvs->kvsname, PMI_MAXKVSLEN, "%s", **argv);
198     (*argv)++;
199 
200     return HYD_SUCCESS;
201 }
202 
pmi_spawner_kvsname_fn(char * arg,char *** argv)203 static HYD_status pmi_spawner_kvsname_fn(char *arg, char ***argv)
204 {
205     HYD_status status = HYD_SUCCESS;
206 
207     HYDU_MALLOC_OR_JUMP(HYD_pmcd_pmip.local.spawner_kvsname, char *, PMI_MAXKVSLEN, status);
208 
209     MPL_snprintf(HYD_pmcd_pmip.local.spawner_kvsname, PMI_MAXKVSLEN, "%s", **argv);
210     (*argv)++;
211 
212   fn_exit:
213     return status;
214 
215   fn_fail:
216     goto fn_exit;
217 }
218 
pmi_process_mapping_fn(char * arg,char *** argv)219 static HYD_status pmi_process_mapping_fn(char *arg, char ***argv)
220 {
221     HYD_status status = HYD_SUCCESS;
222 
223     status = HYDU_set_str(arg, &HYD_pmcd_pmip.system_global.pmi_process_mapping, **argv);
224 
225     (*argv)++;
226 
227     return status;
228 }
229 
binding_fn(char * arg,char *** argv)230 static HYD_status binding_fn(char *arg, char ***argv)
231 {
232     HYD_status status = HYD_SUCCESS;
233 
234     status = HYDU_set_str(arg, &HYD_pmcd_pmip.user_global.binding, **argv);
235 
236     (*argv)++;
237 
238     return status;
239 }
240 
mapping_fn(char * arg,char *** argv)241 static HYD_status mapping_fn(char *arg, char ***argv)
242 {
243     HYD_status status = HYD_SUCCESS;
244 
245     status = HYDU_set_str(arg, &HYD_pmcd_pmip.user_global.mapping, **argv);
246 
247     (*argv)++;
248 
249     return status;
250 }
251 
membind_fn(char * arg,char *** argv)252 static HYD_status membind_fn(char *arg, char ***argv)
253 {
254     HYD_status status = HYD_SUCCESS;
255 
256     status = HYDU_set_str(arg, &HYD_pmcd_pmip.user_global.membind, **argv);
257 
258     (*argv)++;
259 
260     return status;
261 }
262 
topolib_fn(char * arg,char *** argv)263 static HYD_status topolib_fn(char *arg, char ***argv)
264 {
265     HYD_status status = HYD_SUCCESS;
266 
267     status = HYDU_set_str(arg, &HYD_pmcd_pmip.user_global.topolib, **argv);
268 
269     (*argv)++;
270 
271     return status;
272 }
273 
topo_debug_fn(char * arg,char *** argv)274 static HYD_status topo_debug_fn(char *arg, char ***argv)
275 {
276     return HYDU_set_int(arg, &HYDT_topo_info.debug, 1);
277 }
278 
global_env_fn(char * arg,char *** argv)279 static HYD_status global_env_fn(char *arg, char ***argv)
280 {
281     int i, count;
282     char *str;
283     HYD_status status = HYD_SUCCESS;
284 
285     count = atoi(**argv);
286     for (i = 0; i < count; i++) {
287         (*argv)++;
288         str = **argv;
289 
290         /* Environment variables are quoted; remove them */
291         if (*str == '\'') {
292             str++;
293             str[strlen(str) - 1] = 0;
294         }
295 
296         if (!strcmp(arg, "global-inherited-env"))
297             HYDU_append_env_str_to_list(str, &HYD_pmcd_pmip.user_global.global_env.inherited);
298         else if (!strcmp(arg, "global-system-env"))
299             HYDU_append_env_str_to_list(str, &HYD_pmcd_pmip.user_global.global_env.system);
300         else if (!strcmp(arg, "global-user-env"))
301             HYDU_append_env_str_to_list(str, &HYD_pmcd_pmip.user_global.global_env.user);
302     }
303     (*argv)++;
304 
305     HYDU_FUNC_EXIT();
306     return status;
307 }
308 
genv_prop_fn(char * arg,char *** argv)309 static HYD_status genv_prop_fn(char *arg, char ***argv)
310 {
311     HYD_status status = HYD_SUCCESS;
312 
313     status = HYDU_set_str(arg, &HYD_pmcd_pmip.user_global.global_env.prop, **argv);
314 
315     (*argv)++;
316 
317     return status;
318 }
319 
global_core_map_fn(char * arg,char *** argv)320 static HYD_status global_core_map_fn(char *arg, char ***argv)
321 {
322     char *map, *tmp;
323     HYD_status status = HYD_SUCCESS;
324 
325     /* Split the core map into three different segments */
326     map = MPL_strdup(**argv);
327     HYDU_ASSERT(map, status);
328 
329     tmp = strtok(map, ",");
330     HYDU_ASSERT(tmp, status);
331     HYD_pmcd_pmip.system_global.global_core_map.local_filler = atoi(tmp);
332 
333     tmp = strtok(NULL, ",");
334     HYDU_ASSERT(tmp, status);
335     HYD_pmcd_pmip.system_global.global_core_map.local_count = atoi(tmp);
336 
337     tmp = strtok(NULL, ",");
338     HYDU_ASSERT(tmp, status);
339     HYD_pmcd_pmip.system_global.global_core_map.global_count = atoi(tmp);
340 
341     MPL_free(map);
342 
343     (*argv)++;
344 
345   fn_exit:
346     HYDU_FUNC_EXIT();
347     return status;
348 
349   fn_fail:
350     goto fn_exit;
351 }
352 
pmi_id_map_fn(char * arg,char *** argv)353 static HYD_status pmi_id_map_fn(char *arg, char ***argv)
354 {
355     char *map, *tmp;
356     HYD_status status = HYD_SUCCESS;
357 
358     /* Split the core map into three different segments */
359     map = MPL_strdup(**argv);
360     HYDU_ASSERT(map, status);
361 
362     tmp = strtok(map, ",");
363     HYDU_ASSERT(tmp, status);
364     HYD_pmcd_pmip.system_global.pmi_id_map.filler_start = atoi(tmp);
365 
366     tmp = strtok(NULL, ",");
367     HYDU_ASSERT(tmp, status);
368     HYD_pmcd_pmip.system_global.pmi_id_map.non_filler_start = atoi(tmp);
369 
370     MPL_free(map);
371 
372     (*argv)++;
373 
374   fn_exit:
375     HYDU_FUNC_EXIT();
376     return status;
377 
378   fn_fail:
379     goto fn_exit;
380 }
381 
global_process_count_fn(char * arg,char *** argv)382 static HYD_status global_process_count_fn(char *arg, char ***argv)
383 {
384     HYD_status status = HYD_SUCCESS;
385 
386     status = HYDU_set_int(arg, &HYD_pmcd_pmip.system_global.global_process_count, atoi(**argv));
387 
388     (*argv)++;
389 
390     return status;
391 }
392 
version_fn(char * arg,char *** argv)393 static HYD_status version_fn(char *arg, char ***argv)
394 {
395     HYD_status status = HYD_SUCCESS;
396 
397     if (strcmp(**argv, HYDRA_VERSION)) {
398         HYDU_ERR_SETANDJUMP(status, HYD_INTERNAL_ERROR,
399                             "UI version string does not match proxy version\n");
400     }
401     (*argv)++;
402 
403   fn_exit:
404     HYDU_FUNC_EXIT();
405     return status;
406 
407   fn_fail:
408     goto fn_exit;
409 }
410 
iface_ip_env_name_fn(char * arg,char *** argv)411 static HYD_status iface_ip_env_name_fn(char *arg, char ***argv)
412 {
413     HYD_status status = HYD_SUCCESS;
414 
415     status = HYDU_set_str(arg, &HYD_pmcd_pmip.local.iface_ip_env_name, **argv);
416 
417     (*argv)++;
418 
419     return status;
420 }
421 
hostname_fn(char * arg,char *** argv)422 static HYD_status hostname_fn(char *arg, char ***argv)
423 {
424     HYD_status status = HYD_SUCCESS;
425 
426     status = HYDU_set_str(arg, &HYD_pmcd_pmip.local.hostname, **argv);
427 
428     (*argv)++;
429 
430     return status;
431 }
432 
proxy_core_count_fn(char * arg,char *** argv)433 static HYD_status proxy_core_count_fn(char *arg, char ***argv)
434 {
435     HYD_status status = HYD_SUCCESS;
436 
437     status = HYDU_set_int(arg, &HYD_pmcd_pmip.local.proxy_core_count, atoi(**argv));
438 
439     (*argv)++;
440 
441     return status;
442 }
443 
exec_fn(char * arg,char *** argv)444 static HYD_status exec_fn(char *arg, char ***argv)
445 {
446     struct HYD_exec *exec = NULL;
447     HYD_status status = HYD_SUCCESS;
448 
449     if (HYD_pmcd_pmip.exec_list == NULL) {
450         status = HYDU_alloc_exec(&HYD_pmcd_pmip.exec_list);
451         HYDU_ERR_POP(status, "unable to allocate proxy exec\n");
452     } else {
453         for (exec = HYD_pmcd_pmip.exec_list; exec->next; exec = exec->next);
454         status = HYDU_alloc_exec(&exec->next);
455         HYDU_ERR_POP(status, "unable to allocate proxy exec\n");
456     }
457 
458   fn_exit:
459     HYDU_FUNC_EXIT();
460     return status;
461 
462   fn_fail:
463     goto fn_exit;
464 }
465 
exec_appnum_fn(char * arg,char *** argv)466 static HYD_status exec_appnum_fn(char *arg, char ***argv)
467 {
468     struct HYD_exec *exec = NULL;
469     HYD_status status = HYD_SUCCESS;
470 
471     for (exec = HYD_pmcd_pmip.exec_list; exec->next; exec = exec->next);
472     status = HYDU_set_int(arg, &exec->appnum, atoi(**argv));
473 
474     (*argv)++;
475 
476     return status;
477 }
478 
exec_proc_count_fn(char * arg,char *** argv)479 static HYD_status exec_proc_count_fn(char *arg, char ***argv)
480 {
481     struct HYD_exec *exec = NULL;
482     HYD_status status = HYD_SUCCESS;
483 
484     for (exec = HYD_pmcd_pmip.exec_list; exec->next; exec = exec->next);
485     status = HYDU_set_int(arg, &exec->proc_count, atoi(**argv));
486 
487     (*argv)++;
488 
489     return status;
490 }
491 
exec_local_env_fn(char * arg,char *** argv)492 static HYD_status exec_local_env_fn(char *arg, char ***argv)
493 {
494     struct HYD_exec *exec = NULL;
495     int i, count;
496     char *str;
497     HYD_status status = HYD_SUCCESS;
498 
499     if (**argv == NULL)
500         HYDU_ERR_SETANDJUMP(status, HYD_INTERNAL_ERROR, "NULL argument to exec local env\n");
501 
502     for (exec = HYD_pmcd_pmip.exec_list; exec->next; exec = exec->next);
503 
504     count = atoi(**argv);
505     for (i = 0; i < count; i++) {
506         (*argv)++;
507         str = **argv;
508 
509         /* Environment variables are quoted; remove them */
510         if (*str == '\'') {
511             str++;
512             str[strlen(str) - 1] = 0;
513         }
514         HYDU_append_env_str_to_list(str, &exec->user_env);
515     }
516     (*argv)++;
517 
518   fn_exit:
519     HYDU_FUNC_EXIT();
520     return status;
521 
522   fn_fail:
523     goto fn_exit;
524 }
525 
exec_env_prop_fn(char * arg,char *** argv)526 static HYD_status exec_env_prop_fn(char *arg, char ***argv)
527 {
528     struct HYD_exec *exec = NULL;
529     HYD_status status = HYD_SUCCESS;
530 
531     for (exec = HYD_pmcd_pmip.exec_list; exec->next; exec = exec->next);
532 
533     status = HYDU_set_str(arg, &exec->env_prop, **argv);
534 
535     (*argv)++;
536 
537     return status;
538 }
539 
exec_wdir_fn(char * arg,char *** argv)540 static HYD_status exec_wdir_fn(char *arg, char ***argv)
541 {
542     struct HYD_exec *exec = NULL;
543     HYD_status status = HYD_SUCCESS;
544 
545     for (exec = HYD_pmcd_pmip.exec_list; exec->next; exec = exec->next);
546 
547     status = HYDU_set_str(arg, &exec->wdir, **argv);
548 
549     (*argv)++;
550 
551     return status;
552 }
553 
exec_args_fn(char * arg,char *** argv)554 static HYD_status exec_args_fn(char *arg, char ***argv)
555 {
556     long int i, count;
557     struct HYD_exec *exec = NULL;
558     HYD_status status = HYD_SUCCESS;
559 
560     if (**argv == NULL)
561         HYDU_ERR_SETANDJUMP(status, HYD_INTERNAL_ERROR, "NULL argument to exec args\n");
562 
563     for (exec = HYD_pmcd_pmip.exec_list; exec->next; exec = exec->next);
564 
565     errno = 0;
566     count = strtol(**argv, NULL, 10);
567     if (errno != 0)
568         HYDU_ERR_SETANDJUMP(status, HYD_INTERNAL_ERROR, "Exec arg not convertible to integer\n");
569     for (i = 0; i < count; i++) {
570         (*argv)++;
571         exec->exec[i] = MPL_strdup(**argv);
572     }
573     exec->exec[i] = NULL;
574     (*argv)++;
575 
576   fn_exit:
577     HYDU_FUNC_EXIT();
578     return status;
579 
580   fn_fail:
581     goto fn_exit;
582 }
583 
584 struct HYD_arg_match_table HYD_pmcd_pmip_match_table[] = {
585     /* Proxy parameters */
586     {"control-port", control_port_fn, NULL},
587     {"proxy-id", proxy_id_fn, NULL},
588     {"pgid", pgid_fn, NULL},
589     {"debug", debug_fn, NULL},
590     {"usize", usize_fn, NULL},
591     {"pmi-port", pmi_port_fn, NULL},
592     {"gpus-per-proc", gpus_per_proc_fn, NULL},
593     {"rmk", rmk_fn, NULL},
594     {"launcher", launcher_fn, NULL},
595     {"launcher-exec", launcher_exec_fn, NULL},
596     {"demux", demux_fn, NULL},
597     {"iface", iface_fn, NULL},
598     {"auto-cleanup", auto_cleanup_fn, NULL},
599     {"retries", retries_fn, NULL},
600 
601     /* Executable parameters */
602     {"pmi-kvsname", pmi_kvsname_fn, NULL},
603     {"pmi-spawner-kvsname", pmi_spawner_kvsname_fn, NULL},
604     {"pmi-process-mapping", pmi_process_mapping_fn, NULL},
605     {"topolib", topolib_fn, NULL},
606     {"binding", binding_fn, NULL},
607     {"mapping", mapping_fn, NULL},
608     {"membind", membind_fn, NULL},
609     {"topo-debug", topo_debug_fn, NULL},
610     {"global-inherited-env", global_env_fn, NULL},
611     {"global-system-env", global_env_fn, NULL},
612     {"global-user-env", global_env_fn, NULL},
613     {"genv-prop", genv_prop_fn, NULL},
614     {"global-core-map", global_core_map_fn, NULL},
615     {"pmi-id-map", pmi_id_map_fn, NULL},
616     {"global-process-count", global_process_count_fn, NULL},
617     {"version", version_fn, NULL},
618     {"iface-ip-env-name", iface_ip_env_name_fn, NULL},
619     {"hostname", hostname_fn, NULL},
620     {"proxy-core-count", proxy_core_count_fn, NULL},
621     {"exec", exec_fn, NULL},
622     {"exec-appnum", exec_appnum_fn, NULL},
623     {"exec-proc-count", exec_proc_count_fn, NULL},
624     {"exec-local-env", exec_local_env_fn, NULL},
625     {"exec-env-prop", exec_env_prop_fn, NULL},
626     {"exec-wdir", exec_wdir_fn, NULL},
627     {"exec-args", exec_args_fn, NULL}
628 };
629 
HYD_pmcd_pmip_get_params(char ** t_argv)630 HYD_status HYD_pmcd_pmip_get_params(char **t_argv)
631 {
632     char **argv = t_argv;
633     static char dbg_prefix[2 * MAX_HOSTNAME_LEN];
634     HYD_status status = HYD_SUCCESS;
635 
636     HYDU_FUNC_ENTER();
637 
638     argv++;
639     do {
640         /* Get the proxy arguments  */
641         status = HYDU_parse_array(&argv, HYD_pmcd_pmip_match_table);
642         HYDU_ERR_POP(status, "error parsing input array\n");
643 
644         /* No more arguments left */
645         if (!(*argv))
646             break;
647     } while (1);
648 
649     /* Verify the arguments we got */
650     if (HYD_pmcd_pmip.upstream.server_name == NULL)
651         HYDU_ERR_SETANDJUMP(status, HYD_INTERNAL_ERROR, "server name not available\n");
652 
653     if (HYD_pmcd_pmip.upstream.server_port == -1)
654         HYDU_ERR_SETANDJUMP(status, HYD_INTERNAL_ERROR, "server port not available\n");
655 
656     if (HYD_pmcd_pmip.user_global.demux == NULL)
657         HYDU_ERR_SETANDJUMP(status, HYD_INTERNAL_ERROR, "demux engine not available\n");
658 
659     if (HYD_pmcd_pmip.user_global.debug == -1)
660         HYD_pmcd_pmip.user_global.debug = 0;
661 
662     if (HYDT_topo_info.debug == -1)
663         HYDT_topo_info.debug = 0;
664 
665     status = HYDT_bsci_init(HYD_pmcd_pmip.user_global.rmk,
666                             HYD_pmcd_pmip.user_global.launcher,
667                             HYD_pmcd_pmip.user_global.launcher_exec,
668                             0 /* disable x */ , HYD_pmcd_pmip.user_global.debug);
669     HYDU_ERR_POP(status, "proxy unable to initialize bootstrap server\n");
670 
671     if (HYD_pmcd_pmip.local.id == -1) {
672         /* We didn't get a proxy ID during launch; query the launcher
673          * for it. */
674         status = HYDT_bsci_query_proxy_id(&HYD_pmcd_pmip.local.id);
675         HYDU_ERR_POP(status, "unable to query launcher for proxy ID\n");
676     }
677 
678     if (HYD_pmcd_pmip.local.id == -1)
679         HYDU_ERR_SETANDJUMP(status, HYD_INTERNAL_ERROR, "proxy ID not available\n");
680 
681     if (HYD_pmcd_pmip.local.pgid == -1)
682         HYDU_ERR_SETANDJUMP(status, HYD_INTERNAL_ERROR, "PG ID not available\n");
683 
684     if (HYD_pmcd_pmip.local.retries == -1)
685         HYD_pmcd_pmip.local.retries = 0;
686 
687     HYDU_dbg_finalize();
688     MPL_snprintf(dbg_prefix, 2 * MAX_HOSTNAME_LEN, "proxy:%d:%d",
689                  HYD_pmcd_pmip.local.pgid, HYD_pmcd_pmip.local.id);
690     status = HYDU_dbg_init((const char *) dbg_prefix);
691     HYDU_ERR_POP(status, "unable to initialization debugging\n");
692 
693   fn_exit:
694     HYDU_FUNC_EXIT();
695     return status;
696 
697   fn_fail:
698     goto fn_exit;
699 }
700