This source file includes following definitions.
- orte_iof_tool_recv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 #include "orte_config.h"
24 #include "orte/constants.h"
25
26 #include <errno.h>
27 #ifdef HAVE_UNISTD_H
28 #include <unistd.h>
29 #endif
30 #include <string.h>
31
32 #include "opal/dss/dss.h"
33
34 #include "orte/mca/rml/rml.h"
35 #include "orte/mca/rml/rml_types.h"
36 #include "orte/mca/errmgr/errmgr.h"
37 #include "orte/util/name_fns.h"
38 #include "orte/runtime/orte_globals.h"
39
40 #include "orte/mca/iof/iof.h"
41 #include "orte/mca/iof/base/base.h"
42
43 #include "iof_tool.h"
44
45
46 void orte_iof_tool_recv(int status, orte_process_name_t* sender,
47 opal_buffer_t* buffer, orte_rml_tag_t tag,
48 void* cbdata)
49 {
50 orte_process_name_t origin;
51 unsigned char data[ORTE_IOF_BASE_MSG_MAX];
52 orte_iof_tag_t stream;
53 int32_t count, numbytes;
54 int rc;
55
56
57
58 count = 1;
59 if (ORTE_SUCCESS != (rc = opal_dss.unpack(buffer, &stream, &count, ORTE_IOF_TAG))) {
60 ORTE_ERROR_LOG(rc);
61 goto CLEAN_RETURN;
62 }
63
64
65
66
67 if (ORTE_IOF_CLOSE & stream) {
68 OPAL_OUTPUT_VERBOSE((1, orte_iof_base_framework.framework_output,
69 "%s received CLOSE handshake from remote hnp %s",
70 ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
71 ORTE_NAME_PRINT(sender)));
72 mca_iof_tool_component.closed = true;
73 goto CLEAN_RETURN;
74 }
75
76
77 count = 1;
78 if (ORTE_SUCCESS != (rc = opal_dss.unpack(buffer, &origin, &count, ORTE_NAME))) {
79 ORTE_ERROR_LOG(rc);
80 goto CLEAN_RETURN;
81 }
82
83
84 numbytes=ORTE_IOF_BASE_MSG_MAX;
85 if (ORTE_SUCCESS != (rc = opal_dss.unpack(buffer, data, &numbytes, OPAL_BYTE))) {
86 ORTE_ERROR_LOG(rc);
87 goto CLEAN_RETURN;
88 }
89
90
91 OPAL_OUTPUT_VERBOSE((1, orte_iof_base_framework.framework_output,
92 "%s unpacked %d bytes from remote proc %s",
93 ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), numbytes,
94 ORTE_NAME_PRINT(&origin)));
95
96
97
98
99 if (0 < numbytes) {
100
101 if (ORTE_IOF_STDOUT & stream) {
102 orte_iof_base_write_output(&origin, stream, data, numbytes, orte_iof_base.iof_write_stdout->wev);
103 } else {
104 orte_iof_base_write_output(&origin, stream, data, numbytes, orte_iof_base.iof_write_stderr->wev);
105 }
106 }
107
108 CLEAN_RETURN:
109 return;
110 }