changeset 4533:0870207843e2 7u0

. Merge from BSD repository.
author Greg Lewis <glewis@eyesbeyond.com>
date Sun, 11 Sep 2011 10:51:01 -0700
parents 25b0dd211578 5e932f1534d8
children b3baa445c53f b0641c559aa1
files
diffstat 2 files changed, 32 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/transport/socket/socketTransport.c	Sun Sep 11 10:48:54 2011 -0700
+++ b/src/share/transport/socket/socketTransport.c	Sun Sep 11 10:51:01 2011 -0700
@@ -585,8 +585,6 @@
     while (nbytes < len) {
         int res = dbgsysRecv(f, buf + nbytes, len - nbytes, 0);
         if (res < 0) {
-	    if (errno == EINTR)
-		continue;
             return res;
         } else if (res == 0) {
             break; /* eof, return nbytes which is less than len */
@@ -603,8 +601,6 @@
     while (nbytes < len) {
         int res = dbgsysSend(f, buf + nbytes, len - nbytes, 0);
         if (res < 0) {
-	    if (errno == EINTR)
-		continue;
             return res;
         } else if (res == 0) {
             break; /* eof, return nbytes which is less than len */
--- a/src/solaris/transport/socket/socket_md.c	Sun Sep 11 10:48:54 2011 -0700
+++ b/src/solaris/transport/socket/socket_md.c	Sun Sep 11 10:51:01 2011 -0700
@@ -52,7 +52,7 @@
 int
 dbgsysConnect(int fd, struct sockaddr *name, int namelen) {
     int rv = connect(fd, name, namelen);
-    if (rv < 0 && errno == EINPROGRESS) {
+    if (rv < 0 && (errno == EINPROGRESS || errno == EINTR)) {
         return DBG_EINPROGRESS;
     } else {
         return rv;
@@ -79,7 +79,7 @@
         if (rv >= 0) {
             return rv;
         }
-        if (errno != ECONNABORTED) {
+        if (errno != ECONNABORTED && errno != EINTR) {
             return rv;
         }
     }
@@ -88,23 +88,43 @@
 int
 dbgsysRecvFrom(int fd, char *buf, int nBytes,
                   int flags, struct sockaddr *from, int *fromlen) {
-    return recvfrom(fd, buf, nBytes, flags, from, fromlen);
+    int rv;
+    do {
+        rv = recvfrom(fd, buf, nBytes, flags, from, fromlen);
+    } while (rv == -1 && errno == EINTR);
+
+    return rv;
 }
 
 int
 dbgsysSendTo(int fd, char *buf, int len,
                 int flags, struct sockaddr *to, int tolen) {
-    return sendto(fd, buf, len, flags, to, tolen);
+    int rv;
+    do {
+        rv = sendto(fd, buf, len, flags, to, tolen);
+    } while (rv == -1 && errno == EINTR);
+
+    return rv;
 }
 
 int
 dbgsysRecv(int fd, char *buf, int nBytes, int flags) {
-    return recv(fd, buf, nBytes, flags);
+    int rv;
+    do {
+        rv = recv(fd, buf, nBytes, flags);
+    } while (rv == -1 && errno == EINTR);
+
+    return rv;
 }
 
 int
 dbgsysSend(int fd, char *buf, int nBytes, int flags) {
-    return send(fd, buf, nBytes, flags);
+    int rv;
+    do {
+        rv = send(fd, buf, nBytes, flags);
+    } while (rv == -1 && errno == EINTR);
+
+    return rv;
 }
 
 struct hostent *
@@ -123,7 +143,12 @@
 }
 
 int dbgsysSocketClose(int fd) {
-    return close(fd);
+    int rv;
+    do {
+        rv = close(fd);
+    } while (rv == -1 && errno == EINTR);
+
+    return rv;
 }
 
 int