[mpich-commits] r10697 - in mpich2/trunk/src/pm/hydra: include pm/pmiserv tools/bootstrap/persist tools/nameserver ui/mpich ui/utils utils/args utils/sock
balaji at mcs.anl.gov
balaji at mcs.anl.gov
Fri Nov 30 01:48:54 CST 2012
Author: balaji
Date: 2012-11-30 01:48:54 -0600 (Fri, 30 Nov 2012)
New Revision: 10697
Modified:
mpich2/trunk/src/pm/hydra/include/hydra.h
mpich2/trunk/src/pm/hydra/pm/pmiserv/pmip.c
mpich2/trunk/src/pm/hydra/pm/pmiserv/pmip_cb.c
mpich2/trunk/src/pm/hydra/pm/pmiserv/pmip_pmi_v1.c
mpich2/trunk/src/pm/hydra/pm/pmiserv/pmip_pmi_v2.c
mpich2/trunk/src/pm/hydra/pm/pmiserv/pmiserv_cb.c
mpich2/trunk/src/pm/hydra/pm/pmiserv/pmiserv_pmci.c
mpich2/trunk/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v1.c
mpich2/trunk/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v2.c
mpich2/trunk/src/pm/hydra/tools/bootstrap/persist/persist_launch.c
mpich2/trunk/src/pm/hydra/tools/bootstrap/persist/persist_server.c
mpich2/trunk/src/pm/hydra/tools/nameserver/hydra_nameserver.c
mpich2/trunk/src/pm/hydra/ui/mpich/mpiexec.c
mpich2/trunk/src/pm/hydra/ui/utils/uiu.c
mpich2/trunk/src/pm/hydra/utils/args/args.c
mpich2/trunk/src/pm/hydra/utils/sock/sock.c
Log:
Update the HYDU_sock_write function to explicitly take a
block/no-block parameter.
No reviewer.
Modified: mpich2/trunk/src/pm/hydra/include/hydra.h
===================================================================
--- mpich2/trunk/src/pm/hydra/include/hydra.h 2012-11-30 07:48:48 UTC (rev 10696)
+++ mpich2/trunk/src/pm/hydra/include/hydra.h 2012-11-30 07:48:54 UTC (rev 10697)
@@ -533,7 +533,8 @@
HYD_status HYDU_sock_accept(int listen_fd, int *fd);
HYD_status HYDU_sock_read(int fd, void *buf, int maxlen, int *recvd, int *closed,
enum HYDU_sock_comm_flag flag);
-HYD_status HYDU_sock_write(int fd, const void *buf, int maxlen, int *sent, int *closed);
+HYD_status HYDU_sock_write(int fd, const void *buf, int maxlen, int *sent, int *closed,
+ enum HYDU_sock_comm_flag flag);
HYD_status HYDU_sock_forward_stdio(int in, int out, int *closed);
HYD_status HYDU_sock_get_iface_ip(char *iface, char **ip);
HYD_status HYDU_sock_is_local(char *host, int *is_local);
Modified: mpich2/trunk/src/pm/hydra/pm/pmiserv/pmip.c
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/pmiserv/pmip.c 2012-11-30 07:48:48 UTC (rev 10696)
+++ mpich2/trunk/src/pm/hydra/pm/pmiserv/pmip.c 2012-11-30 07:48:54 UTC (rev 10697)
@@ -195,7 +195,7 @@
status = HYDU_sock_write(HYD_pmcd_pmip.upstream.control,
&HYD_pmcd_pmip.local.id, sizeof(HYD_pmcd_pmip.local.id), &sent,
- &closed);
+ &closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to send the proxy ID to the server\n");
if (closed)
goto fn_fail;
@@ -264,14 +264,15 @@
HYD_pmcd_init_header(&hdr);
hdr.cmd = EXIT_STATUS;
status =
- HYDU_sock_write(HYD_pmcd_pmip.upstream.control, &hdr, sizeof(hdr), &sent, &closed);
+ HYDU_sock_write(HYD_pmcd_pmip.upstream.control, &hdr, sizeof(hdr), &sent, &closed,
+ HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to send EXIT_STATUS command upstream\n");
HYDU_ASSERT(!closed, status);
status = HYDU_sock_write(HYD_pmcd_pmip.upstream.control,
HYD_pmcd_pmip.downstream.exit_status,
HYD_pmcd_pmip.local.proxy_process_count * sizeof(int), &sent,
- &closed);
+ &closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to return exit status upstream\n");
HYDU_ASSERT(!closed, status);
Modified: mpich2/trunk/src/pm/hydra/pm/pmiserv/pmip_cb.c
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/pmiserv/pmip_cb.c 2012-11-30 07:48:48 UTC (rev 10696)
+++ mpich2/trunk/src/pm/hydra/pm/pmiserv/pmip_cb.c 2012-11-30 07:48:54 UTC (rev 10697)
@@ -59,12 +59,12 @@
int upstream_sock_closed;
status = HYDU_sock_write(HYD_pmcd_pmip.upstream.control, &hdr, sizeof(hdr), &sent,
- &upstream_sock_closed);
+ &upstream_sock_closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "sock write error\n");
HYDU_ASSERT(!upstream_sock_closed, status);
status = HYDU_sock_write(HYD_pmcd_pmip.upstream.control, buf, recvd, &sent,
- &upstream_sock_closed);
+ &upstream_sock_closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "sock write error\n");
HYDU_ASSERT(!upstream_sock_closed, status);
}
@@ -281,7 +281,7 @@
hdr.cmd = PROCESS_TERMINATED;
hdr.pid = HYD_pmcd_pmip.downstream.pmi_rank[pid];
status = HYDU_sock_write(HYD_pmcd_pmip.upstream.control, &hdr, sizeof(hdr),
- &sent, &closed);
+ &sent, &closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to send PMI header upstream\n");
HYDU_ASSERT(!closed, status);
}
@@ -340,12 +340,14 @@
hdr.pid = fd;
hdr.buflen = strlen(buf);
status =
- HYDU_sock_write(HYD_pmcd_pmip.upstream.control, &hdr, sizeof(hdr), &sent, &closed);
+ HYDU_sock_write(HYD_pmcd_pmip.upstream.control, &hdr, sizeof(hdr), &sent, &closed,
+ HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to send PMI header upstream\n");
HYDU_ASSERT(!closed, status);
status =
- HYDU_sock_write(HYD_pmcd_pmip.upstream.control, buf, hdr.buflen, &sent, &closed);
+ HYDU_sock_write(HYD_pmcd_pmip.upstream.control, buf, hdr.buflen, &sent, &closed,
+ HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to send PMI command upstream\n");
HYDU_ASSERT(!closed, status);
@@ -399,7 +401,7 @@
pmi_cmd);
}
- status = HYDU_sock_write(hdr.pid, buf, hdr.buflen, &sent, &closed);
+ status = HYDU_sock_write(hdr.pid, buf, hdr.buflen, &sent, &closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to forward PMI response to MPI process\n");
if (HYD_pmcd_pmip.user_global.auto_cleanup) {
@@ -727,14 +729,15 @@
HYD_pmcd_init_header(&hdr);
hdr.cmd = PID_LIST;
status =
- HYDU_sock_write(HYD_pmcd_pmip.upstream.control, &hdr, sizeof(hdr), &sent, &closed);
+ HYDU_sock_write(HYD_pmcd_pmip.upstream.control, &hdr, sizeof(hdr), &sent, &closed,
+ HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to send PID_LIST command upstream\n");
HYDU_ASSERT(!closed, status);
status = HYDU_sock_write(HYD_pmcd_pmip.upstream.control,
HYD_pmcd_pmip.downstream.pid,
HYD_pmcd_pmip.local.proxy_process_count * sizeof(int), &sent,
- &closed);
+ &closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to send PID list upstream\n");
HYDU_ASSERT(!closed, status);
@@ -929,7 +932,7 @@
HYDU_ASSERT(!closed, status);
status = HYDU_sock_write(HYD_pmcd_pmip.downstream.in, buf, hdr.buflen, &count,
- &closed);
+ &closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to write to downstream stdin\n");
if (HYD_pmcd_pmip.user_global.auto_cleanup) {
Modified: mpich2/trunk/src/pm/hydra/pm/pmiserv/pmip_pmi_v1.c
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/pmiserv/pmip_pmi_v1.c 2012-11-30 07:48:48 UTC (rev 10696)
+++ mpich2/trunk/src/pm/hydra/pm/pmiserv/pmip_pmi_v1.c 2012-11-30 07:48:54 UTC (rev 10697)
@@ -39,7 +39,8 @@
hdr.buflen = strlen(buf);
hdr.pmi_version = 1;
status =
- HYDU_sock_write(HYD_pmcd_pmip.upstream.control, &hdr, sizeof(hdr), &sent, &closed);
+ HYDU_sock_write(HYD_pmcd_pmip.upstream.control, &hdr, sizeof(hdr), &sent, &closed,
+ HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to send PMI header upstream\n");
HYDU_ASSERT(!closed, status);
@@ -47,7 +48,8 @@
HYDU_dump(stdout, "forwarding command (%s) upstream\n", buf);
}
- status = HYDU_sock_write(HYD_pmcd_pmip.upstream.control, buf, hdr.buflen, &sent, &closed);
+ status = HYDU_sock_write(HYD_pmcd_pmip.upstream.control, buf, hdr.buflen, &sent, &closed,
+ HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to send PMI command upstream\n");
HYDU_ASSERT(!closed, status);
@@ -72,7 +74,7 @@
HYDU_dump(stdout, "PMI response: %s", cmd);
}
- status = HYDU_sock_write(fd, cmd, strlen(cmd), &sent, &closed);
+ status = HYDU_sock_write(fd, cmd, strlen(cmd), &sent, &closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "error writing PMI line\n");
/* FIXME: We cannot abort when we are not able to send data
* downstream. The upper layer needs to handle this based on
Modified: mpich2/trunk/src/pm/hydra/pm/pmiserv/pmip_pmi_v2.c
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/pmiserv/pmip_pmi_v2.c 2012-11-30 07:48:48 UTC (rev 10696)
+++ mpich2/trunk/src/pm/hydra/pm/pmiserv/pmip_pmi_v2.c 2012-11-30 07:48:54 UTC (rev 10697)
@@ -43,7 +43,8 @@
hdr.buflen = strlen(buf);
hdr.pmi_version = 2;
status =
- HYDU_sock_write(HYD_pmcd_pmip.upstream.control, &hdr, sizeof(hdr), &sent, &closed);
+ HYDU_sock_write(HYD_pmcd_pmip.upstream.control, &hdr, sizeof(hdr), &sent, &closed,
+ HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to send PMI header upstream\n");
HYDU_ASSERT(!closed, status);
@@ -51,7 +52,8 @@
HYDU_dump(stdout, "forwarding command (%s) upstream\n", buf);
}
- status = HYDU_sock_write(HYD_pmcd_pmip.upstream.control, buf, hdr.buflen, &sent, &closed);
+ status = HYDU_sock_write(HYD_pmcd_pmip.upstream.control, buf, hdr.buflen, &sent, &closed,
+ HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to send PMI command upstream\n");
HYDU_ASSERT(!closed, status);
@@ -72,7 +74,7 @@
HYDU_FUNC_ENTER();
HYDU_snprintf(cmdlen, 7, "%6u", (unsigned) strlen(cmd));
- status = HYDU_sock_write(fd, cmdlen, 6, &sent, &closed);
+ status = HYDU_sock_write(fd, cmdlen, 6, &sent, &closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "error writing PMI line\n");
/* FIXME: We cannot abort when we are not able to send data
* downstream. The upper layer needs to handle this based on
@@ -83,7 +85,7 @@
HYDU_dump(stdout, "PMI response: %s\n", cmd);
}
- status = HYDU_sock_write(fd, cmd, strlen(cmd), &sent, &closed);
+ status = HYDU_sock_write(fd, cmd, strlen(cmd), &sent, &closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "error writing PMI line\n");
HYDU_ASSERT(!closed, status);
Modified: mpich2/trunk/src/pm/hydra/pm/pmiserv/pmiserv_cb.c
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/pmiserv/pmiserv_cb.c 2012-11-30 07:48:48 UTC (rev 10696)
+++ mpich2/trunk/src/pm/hydra/pm/pmiserv/pmiserv_cb.c 2012-11-30 07:48:54 UTC (rev 10697)
@@ -165,7 +165,8 @@
hdr.cmd = SIGNAL;
hdr.signum = signum;
- status = HYDU_sock_write(proxy->control_fd, &hdr, sizeof(hdr), &sent, &closed);
+ status = HYDU_sock_write(proxy->control_fd, &hdr, sizeof(hdr), &sent, &closed,
+ HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to write data to proxy\n");
HYDU_ASSERT(!closed, status);
@@ -309,12 +310,14 @@
hdr.buflen = count;
- HYDU_sock_write(proxy->control_fd, &hdr, sizeof(hdr), &count, &closed);
+ HYDU_sock_write(proxy->control_fd, &hdr, sizeof(hdr), &count, &closed,
+ HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "error writing to control socket\n");
HYDU_ASSERT(!closed, status);
if (hdr.buflen) {
- HYDU_sock_write(proxy->control_fd, buf, hdr.buflen, &count, &closed);
+ HYDU_sock_write(proxy->control_fd, buf, hdr.buflen, &count, &closed,
+ HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "error writing to control socket\n");
HYDU_ASSERT(!closed, status);
@@ -479,7 +482,8 @@
HYD_pmcd_init_header(&hdr);
hdr.cmd = PROC_INFO;
- status = HYDU_sock_write(proxy->control_fd, &hdr, sizeof(hdr), &sent, &closed);
+ status = HYDU_sock_write(proxy->control_fd, &hdr, sizeof(hdr), &sent, &closed,
+ HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to write data to proxy\n");
HYDU_ASSERT(!closed, status);
@@ -556,7 +560,8 @@
else {
hdr.cmd = STDIN;
hdr.buflen = 0;
- HYDU_sock_write(proxy->control_fd, &hdr, sizeof(hdr), &count, &closed);
+ HYDU_sock_write(proxy->control_fd, &hdr, sizeof(hdr), &count, &closed,
+ HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "error writing to control socket\n");
HYDU_ASSERT(!closed, status);
}
Modified: mpich2/trunk/src/pm/hydra/pm/pmiserv/pmiserv_pmci.c
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/pmiserv/pmiserv_pmci.c 2012-11-30 07:48:48 UTC (rev 10696)
+++ mpich2/trunk/src/pm/hydra/pm/pmiserv/pmiserv_pmci.c 2012-11-30 07:48:54 UTC (rev 10697)
@@ -26,7 +26,8 @@
/* Send the command to all proxies */
for (proxy = pg->proxy_list; proxy; proxy = proxy->next) {
- status = HYDU_sock_write(proxy->control_fd, &hdr, sizeof(hdr), &sent, &closed);
+ status = HYDU_sock_write(proxy->control_fd, &hdr, sizeof(hdr), &sent, &closed,
+ HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to send checkpoint message\n");
HYDU_ASSERT(!closed, status);
}
Modified: mpich2/trunk/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v1.c
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v1.c 2012-11-30 07:48:48 UTC (rev 10696)
+++ mpich2/trunk/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v1.c 2012-11-30 07:48:54 UTC (rev 10697)
@@ -24,7 +24,7 @@
hdr.pid = pid;
hdr.pmi_version = 1;
hdr.buflen = strlen(cmd);
- status = HYDU_sock_write(fd, &hdr, sizeof(hdr), &sent, &closed);
+ status = HYDU_sock_write(fd, &hdr, sizeof(hdr), &sent, &closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to send PMI_RESPONSE header to proxy\n");
HYDU_ASSERT(!closed, status);
@@ -32,7 +32,7 @@
HYDU_dump(stdout, "PMI response to fd %d pid %d: %s", fd, pid, cmd);
}
- status = HYDU_sock_write(fd, cmd, strlen(cmd), &sent, &closed);
+ status = HYDU_sock_write(fd, cmd, strlen(cmd), &sent, &closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to send response to command\n");
HYDU_ASSERT(!closed, status);
Modified: mpich2/trunk/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v2.c
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v2.c 2012-11-30 07:48:48 UTC (rev 10696)
+++ mpich2/trunk/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v2.c 2012-11-30 07:48:54 UTC (rev 10697)
@@ -33,12 +33,12 @@
hdr.pid = pid;
hdr.pmi_version = 2;
hdr.buflen = 6 + strlen(cmd);
- status = HYDU_sock_write(fd, &hdr, sizeof(hdr), &sent, &closed);
+ status = HYDU_sock_write(fd, &hdr, sizeof(hdr), &sent, &closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to send PMI_RESPONSE header to proxy\n");
HYDU_ASSERT(!closed, status);
HYDU_snprintf(cmdlen, 7, "%6u", (unsigned) strlen(cmd));
- status = HYDU_sock_write(fd, cmdlen, 6, &sent, &closed);
+ status = HYDU_sock_write(fd, cmdlen, 6, &sent, &closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "error writing PMI line\n");
HYDU_ASSERT(!closed, status);
@@ -46,7 +46,7 @@
HYDU_dump(stdout, "PMI response to fd %d pid %d: %s\n", fd, pid, cmd);
}
- status = HYDU_sock_write(fd, cmd, strlen(cmd), &sent, &closed);
+ status = HYDU_sock_write(fd, cmd, strlen(cmd), &sent, &closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "error writing PMI line\n");
HYDU_ASSERT(!closed, status);
Modified: mpich2/trunk/src/pm/hydra/tools/bootstrap/persist/persist_launch.c
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bootstrap/persist/persist_launch.c 2012-11-30 07:48:48 UTC (rev 10696)
+++ mpich2/trunk/src/pm/hydra/tools/bootstrap/persist/persist_launch.c 2012-11-30 07:48:54 UTC (rev 10697)
@@ -31,13 +31,15 @@
HYDU_ASSERT(!closed, status);
if (hdr.io_type == HYDT_PERSIST_STDOUT) {
- HYDU_sock_write(STDOUT_FILENO, buf, hdr.buflen, &sent, &closed);
+ HYDU_sock_write(STDOUT_FILENO, buf, hdr.buflen, &sent, &closed,
+ HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "stdout forwarding error\n");
HYDU_ASSERT(!closed, status);
HYDU_ASSERT(sent == hdr.buflen, status);
}
else {
- HYDU_sock_write(STDERR_FILENO, buf, hdr.buflen, &sent, &closed);
+ HYDU_sock_write(STDERR_FILENO, buf, hdr.buflen, &sent, &closed,
+ HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "stderr forwarding error\n");
HYDU_ASSERT(!closed, status);
HYDU_ASSERT(sent == hdr.buflen, status);
Modified: mpich2/trunk/src/pm/hydra/tools/bootstrap/persist/persist_server.c
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bootstrap/persist/persist_server.c 2012-11-30 07:48:48 UTC (rev 10696)
+++ mpich2/trunk/src/pm/hydra/tools/bootstrap/persist/persist_server.c 2012-11-30 07:48:54 UTC (rev 10697)
@@ -86,12 +86,14 @@
hdr.io_type = HYDT_PERSIST_STDOUT;
hdr.buflen = count;
- status = HYDU_sock_write(private.client_fd, &hdr, sizeof(hdr), &sent, &closed);
+ status = HYDU_sock_write(private.client_fd, &hdr, sizeof(hdr), &sent, &closed,
+ HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "error sending header to client\n");
HYDU_ASSERT(!closed, status);
if (hdr.buflen) {
- status = HYDU_sock_write(private.client_fd, buf, count, &sent, &closed);
+ status = HYDU_sock_write(private.client_fd, buf, count, &sent, &closed,
+ HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "error sending stdout to client\n");
HYDU_ASSERT(!closed, status);
}
@@ -115,12 +117,14 @@
hdr.io_type = HYDT_PERSIST_STDOUT;
hdr.buflen = count;
- status = HYDU_sock_write(private.client_fd, &hdr, sizeof(hdr), &sent, &closed);
+ status = HYDU_sock_write(private.client_fd, &hdr, sizeof(hdr), &sent, &closed,
+ HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "error sending header to client\n");
HYDU_ASSERT(!closed, status);
if (hdr.buflen) {
- status = HYDU_sock_write(private.client_fd, buf, count, &sent, &closed);
+ status = HYDU_sock_write(private.client_fd, buf, count, &sent, &closed,
+ HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "error sending stdout to client\n");
HYDU_ASSERT(!closed, status);
}
Modified: mpich2/trunk/src/pm/hydra/tools/nameserver/hydra_nameserver.c
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/nameserver/hydra_nameserver.c 2012-11-30 07:48:48 UTC (rev 10696)
+++ mpich2/trunk/src/pm/hydra/tools/nameserver/hydra_nameserver.c 2012-11-30 07:48:54 UTC (rev 10697)
@@ -101,12 +101,12 @@
HYDU_FUNC_ENTER();
- status = HYDU_sock_write(fd, &len, sizeof(int), &sent, &closed);
+ status = HYDU_sock_write(fd, &len, sizeof(int), &sent, &closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "error sending publish info\n");
HYDU_ASSERT(!closed, status);
if (len) {
- status = HYDU_sock_write(fd, str, len, &sent, &closed);
+ status = HYDU_sock_write(fd, str, len, &sent, &closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "error sending publish info\n");
HYDU_ASSERT(!closed, status);
}
Modified: mpich2/trunk/src/pm/hydra/ui/mpich/mpiexec.c
===================================================================
--- mpich2/trunk/src/pm/hydra/ui/mpich/mpiexec.c 2012-11-30 07:48:48 UTC (rev 10696)
+++ mpich2/trunk/src/pm/hydra/ui/mpich/mpiexec.c 2012-11-30 07:48:54 UTC (rev 10697)
@@ -42,7 +42,8 @@
#endif /* HAVE_ALARM */
cmd.type = HYD_CKPOINT;
- HYDU_sock_write(HYD_server_info.cmd_pipe[1], &cmd, sizeof(cmd), &sent, &closed);
+ HYDU_sock_write(HYD_server_info.cmd_pipe[1], &cmd, sizeof(cmd), &sent, &closed,
+ HYDU_SOCK_COMM_MSGWAIT);
goto fn_exit;
}
@@ -61,7 +62,8 @@
HYDU_dump(stdout, "Press Ctrl-C again to force abort\n");
}
- HYDU_sock_write(HYD_server_info.cmd_pipe[1], &cmd, sizeof(cmd), &sent, &closed);
+ HYDU_sock_write(HYD_server_info.cmd_pipe[1], &cmd, sizeof(cmd), &sent, &closed,
+ HYDU_SOCK_COMM_MSGWAIT);
fn_exit:
HYDU_FUNC_EXIT();
Modified: mpich2/trunk/src/pm/hydra/ui/utils/uiu.c
===================================================================
--- mpich2/trunk/src/pm/hydra/ui/utils/uiu.c 2012-11-30 07:48:48 UTC (rev 10696)
+++ mpich2/trunk/src/pm/hydra/ui/utils/uiu.c 2012-11-30 07:48:54 UTC (rev 10697)
@@ -304,7 +304,7 @@
}
if (HYD_ui_info.prepend_pattern == NULL) {
- status = HYDU_sock_write(fd, buf, buflen, &sent, &closed);
+ status = HYDU_sock_write(fd, buf, buflen, &sent, &closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to write data to stdout/stderr\n");
HYDU_ASSERT(!closed, status);
}
@@ -318,10 +318,11 @@
if (buf[i] == '\n' || i == buflen - 1) {
if (prepend[0] != '\0') { /* sock_write barfs on maxlen==0 */
status = HYDU_sock_write(fd, (const void *) prepend,
- strlen(prepend), &sent, &closed);
+ strlen(prepend), &sent, &closed,
+ HYDU_SOCK_COMM_MSGWAIT);
}
status = HYDU_sock_write(fd, (const void *) &buf[mark], i - mark + 1,
- &sent, &closed);
+ &sent, &closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to write data to stdout/stderr\n");
HYDU_ASSERT(!closed, status);
mark = i + 1;
Modified: mpich2/trunk/src/pm/hydra/utils/args/args.c
===================================================================
--- mpich2/trunk/src/pm/hydra/utils/args/args.c 2012-11-30 07:48:48 UTC (rev 10696)
+++ mpich2/trunk/src/pm/hydra/utils/args/args.c 2012-11-30 07:48:54 UTC (rev 10697)
@@ -402,7 +402,8 @@
/* Check how many arguments we have */
list_len = HYDU_strlist_lastidx(strlist);
- status = HYDU_sock_write(fd, &list_len, sizeof(int), &sent, &closed);
+ status =
+ HYDU_sock_write(fd, &list_len, sizeof(int), &sent, &closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to write data to proxy\n");
HYDU_ASSERT(!closed, status);
@@ -410,11 +411,12 @@
for (i = 0; strlist[i]; i++) {
len = strlen(strlist[i]) + 1;
- status = HYDU_sock_write(fd, &len, sizeof(int), &sent, &closed);
+ status =
+ HYDU_sock_write(fd, &len, sizeof(int), &sent, &closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to write data to proxy\n");
HYDU_ASSERT(!closed, status);
- status = HYDU_sock_write(fd, strlist[i], len, &sent, &closed);
+ status = HYDU_sock_write(fd, strlist[i], len, &sent, &closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to write data to proxy\n");
HYDU_ASSERT(!closed, status);
}
Modified: mpich2/trunk/src/pm/hydra/utils/sock/sock.c
===================================================================
--- mpich2/trunk/src/pm/hydra/utils/sock/sock.c 2012-11-30 07:48:48 UTC (rev 10696)
+++ mpich2/trunk/src/pm/hydra/utils/sock/sock.c 2012-11-30 07:48:54 UTC (rev 10697)
@@ -250,9 +250,9 @@
*recvd += tmp;
}
- if (flag != HYDU_SOCK_COMM_MSGWAIT || *recvd == maxlen)
+ if (flag == HYDU_SOCK_COMM_NONE || *recvd == maxlen)
break;
- };
+ }
fn_exit:
HYDU_FUNC_EXIT();
@@ -262,7 +262,8 @@
goto fn_exit;
}
-HYD_status HYDU_sock_write(int fd, const void *buf, int maxlen, int *sent, int *closed)
+HYD_status HYDU_sock_write(int fd, const void *buf, int maxlen, int *sent, int *closed,
+ enum HYDU_sock_comm_flag flag)
{
int tmp;
HYD_status status = HYD_SUCCESS;
@@ -274,19 +275,28 @@
*sent = 0;
*closed = 0;
while (1) {
- do {
- tmp = write(fd, (char *) buf + *sent, maxlen - *sent);
- } while (tmp < 0 && (errno == EINTR || errno == EAGAIN));
-
- if (tmp < 0 || tmp == 0) {
- *closed = 1;
- goto fn_exit;
+ tmp = write(fd, (char *) buf + *sent, maxlen - *sent);
+ if (tmp <= 0) {
+ if (errno == EAGAIN) {
+ if (flag == HYDU_SOCK_COMM_NONE)
+ goto fn_exit;
+ else
+ continue;
+ }
+ else if (errno == ECONNRESET) {
+ *closed = 1;
+ goto fn_exit;
+ }
+ HYDU_ERR_SETANDJUMP(status, HYD_SOCK_ERROR, "write error (%s)\n",
+ HYDU_strerror(errno));
}
- *sent += tmp;
+ else {
+ *sent += tmp;
+ }
- if (*sent == maxlen)
+ if (flag == HYDU_SOCK_COMM_NONE || *sent == maxlen)
break;
- };
+ }
fn_exit:
HYDU_FUNC_EXIT();
@@ -403,7 +413,7 @@
/* there is data in the buffer, send it out first */
status =
HYDU_sock_write(out, fwd_hash->buf + fwd_hash->buf_offset, fwd_hash->buf_count,
- &count, closed);
+ &count, closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "write error\n");
if (!*closed) {
@@ -417,7 +427,7 @@
while (*closed && fwd_hash->buf_count) {
status =
HYDU_sock_write(out, fwd_hash->buf + fwd_hash->buf_offset, fwd_hash->buf_count,
- &count, closed);
+ &count, closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "write error\n");
if (!*closed) {
More information about the commits
mailing list