Skip to content

Commit a4aa759

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 2f0c78e commit a4aa759

File tree

2 files changed

+44
-4
lines changed

2 files changed

+44
-4
lines changed

src/mca/ptl/tcp/ptl_tcp.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* University of Stuttgart. All rights reserved.
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
12-
* Copyright (c) 2016-2018 Intel, Inc. All rights reserved.
12+
* Copyright (c) 2016-2019 Intel, Inc. All rights reserved.
1313
* Copyright (c) 2018 IBM Corporation. All rights reserved.
1414
* $COPYRIGHT$
1515
*
@@ -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
@@ -118,6 +118,7 @@ static pmix_status_t setup_fork(const pmix_proc_t *proc, char ***env);
118118
.disable_ipv6_family = true,
119119
.session_filename = NULL,
120120
.nspace_filename = NULL,
121+
.pid_filename = NULL,
121122
.system_filename = NULL,
122123
.rendezvous_filename = NULL,
123124
.wait_to_connect = 4,
@@ -298,6 +299,10 @@ pmix_status_t component_close(void)
298299
unlink(mca_ptl_tcp_component.nspace_filename);
299300
free(mca_ptl_tcp_component.nspace_filename);
300301
}
302+
if (NULL != mca_ptl_tcp_component.pid_filename) {
303+
unlink(mca_ptl_tcp_component.pid_filename);
304+
free(mca_ptl_tcp_component.pid_filename);
305+
}
301306
if (NULL != mca_ptl_tcp_component.rendezvous_filename) {
302307
unlink(mca_ptl_tcp_component.rendezvous_filename);
303308
free(mca_ptl_tcp_component.rendezvous_filename);
@@ -751,10 +756,10 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo,
751756
FILE *fp;
752757
pid_t mypid;
753758

754-
/* first output to a file based on pid */
759+
/* first output to a std file */
755760
mypid = getpid();
756-
if (0 > asprintf(&mca_ptl_tcp_component.session_filename, "%s/pmix.%s.tool.%d",
757-
mca_ptl_tcp_component.session_tmpdir, myhost, mypid)) {
761+
if (0 > asprintf(&mca_ptl_tcp_component.session_filename, "%s/pmix.%s.tool",
762+
mca_ptl_tcp_component.session_tmpdir, myhost)) {
758763
CLOSE_THE_SOCKET(lt->socket);
759764
goto sockerror;
760765
}
@@ -785,6 +790,40 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo,
785790
goto sockerror;
786791
}
787792

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

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

0 commit comments

Comments
 (0)