Skip to content

Commit fd38904

Browse files
committed
Add missing tool rendezvous file
Should be a session-level rendezvous file whose name is just pmix.host.tool Signed-off-by: Ralph Castain <[email protected]> (cherry picked from commit c33cc2a)
1 parent 6543698 commit fd38904

File tree

2 files changed

+43
-3
lines changed

2 files changed

+43
-3
lines changed

src/mca/ptl/tcp/ptl_tcp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ typedef struct {
4848
struct sockaddr_storage connection;
4949
char *session_filename;
5050
char *nspace_filename;
51+
char *pid_filename;
5152
char *system_filename;
5253
char *rendezvous_filename;
5354
int wait_to_connect;

src/mca/ptl/tcp/ptl_tcp_component.c

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ static pmix_status_t setup_fork(const pmix_proc_t *proc, char ***env);
117117
.disable_ipv6_family = true,
118118
.session_filename = NULL,
119119
.nspace_filename = NULL,
120+
.pid_filename = NULL,
120121
.system_filename = NULL,
121122
.rendezvous_filename = NULL,
122123
.wait_to_connect = 4,
@@ -295,6 +296,10 @@ pmix_status_t component_close(void)
295296
unlink(mca_ptl_tcp_component.nspace_filename);
296297
free(mca_ptl_tcp_component.nspace_filename);
297298
}
299+
if (NULL != mca_ptl_tcp_component.pid_filename) {
300+
unlink(mca_ptl_tcp_component.pid_filename);
301+
free(mca_ptl_tcp_component.pid_filename);
302+
}
298303
if (NULL != mca_ptl_tcp_component.rendezvous_filename) {
299304
unlink(mca_ptl_tcp_component.rendezvous_filename);
300305
free(mca_ptl_tcp_component.rendezvous_filename);
@@ -745,10 +750,10 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo,
745750
FILE *fp;
746751
pid_t mypid;
747752

748-
/* first output to a file based on pid */
753+
/* first output to a std file */
749754
mypid = getpid();
750-
if (0 > asprintf(&mca_ptl_tcp_component.session_filename, "%s/pmix.%s.tool.%d",
751-
mca_ptl_tcp_component.session_tmpdir, myhost, mypid)) {
755+
if (0 > asprintf(&mca_ptl_tcp_component.session_filename, "%s/pmix.%s.tool",
756+
mca_ptl_tcp_component.session_tmpdir, myhost)) {
752757
CLOSE_THE_SOCKET(lt->socket);
753758
goto sockerror;
754759
}
@@ -779,6 +784,40 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo,
779784
goto sockerror;
780785
}
781786

787+
/* now output to a file based on pid */
788+
mypid = getpid();
789+
if (0 > asprintf(&mca_ptl_tcp_component.pid_filename, "%s/pmix.%s.tool.%d",
790+
mca_ptl_tcp_component.session_tmpdir, myhost, mypid)) {
791+
CLOSE_THE_SOCKET(lt->socket);
792+
goto sockerror;
793+
}
794+
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
795+
"WRITING TOOL FILE %s",
796+
mca_ptl_tcp_component.pid_filename);
797+
fp = fopen(mca_ptl_tcp_component.pid_filename, "w");
798+
if (NULL == fp) {
799+
pmix_output(0, "Impossible to open the file %s in write mode\n", mca_ptl_tcp_component.pid_filename);
800+
PMIX_ERROR_LOG(PMIX_ERR_FILE_OPEN_FAILURE);
801+
CLOSE_THE_SOCKET(lt->socket);
802+
free(mca_ptl_tcp_component.pid_filename);
803+
mca_ptl_tcp_component.pid_filename = NULL;
804+
goto sockerror;
805+
}
806+
807+
/* output my URI */
808+
fprintf(fp, "%s\n", lt->uri);
809+
/* add a flag that indicates we accept v2.1 protocols */
810+
fprintf(fp, "%s\n", PMIX_VERSION);
811+
fclose(fp);
812+
/* set the file mode */
813+
if (0 != chmod(mca_ptl_tcp_component.pid_filename, S_IRUSR | S_IWUSR | S_IRGRP)) {
814+
PMIX_ERROR_LOG(PMIX_ERR_FILE_OPEN_FAILURE);
815+
CLOSE_THE_SOCKET(lt->socket);
816+
free(mca_ptl_tcp_component.pid_filename);
817+
mca_ptl_tcp_component.pid_filename = NULL;
818+
goto sockerror;
819+
}
820+
782821
/* now output it into a file based on my nspace */
783822

784823
if (0 > asprintf(&mca_ptl_tcp_component.nspace_filename, "%s/pmix.%s.tool.%s",

0 commit comments

Comments
 (0)