OSSP CVS Repository

ossp - Difference in ossp-pkg/pth/pth_high.c versions 1.90 and 1.91
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/pth/pth_high.c 1.90 -> 1.91

--- pth_high.c   2002/10/24 09:07:51     1.90
+++ pth_high.c   2002/10/24 15:21:13     1.91
@@ -46,9 +46,9 @@
 
     /* consistency checks for POSIX conformance */
     if (rqtp == NULL)
-        return_errno(-1, EFAULT);
+        return pth_error(-1, EFAULT);
     if (rqtp->tv_nsec < 0 || rqtp->tv_nsec > (1000*1000000))
-        return_errno(-1, EINVAL);
+        return pth_error(-1, EINVAL);
 
     /* short-circuit */
     if (rqtp->tv_sec == 0 && rqtp->tv_nsec == 0)
@@ -152,7 +152,7 @@
     int sig;
 
     if (set == NULL || sigp == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
 
     /* check whether signal is already pending */
     if (sigpending(&pending) < 0)
@@ -173,7 +173,7 @@
     if (ev_extra != NULL) {
         pth_event_isolate(ev);
         if (!pth_event_occurred(ev))
-            return_errno(EINTR, EINTR);
+            return pth_error(EINTR, EINTR);
     }
 
     /* nothing to do, scheduler has already set *sigp for us */
@@ -299,12 +299,12 @@
 
     /* POSIX compliance */
     if (nfd < 0 || nfd > FD_SETSIZE)
-        return_errno(-1, EINVAL);
+        return pth_error(-1, EINVAL);
 
     /* first deal with the special situation of a plain microsecond delay */
     if (nfd == 0 && rfds == NULL && wfds == NULL && efds == NULL && timeout != NULL) {
         if (timeout->tv_sec < 0 || timeout->tv_usec < 0)
-            return_errno(-1, EINVAL);
+            return pth_error(-1, EINVAL);
         if (timeout->tv_sec == 0 && timeout->tv_usec < 500000) {
             /* very small delays are acceptable to be performed directly */
             while (   pth_sc(select)(0, NULL, NULL, NULL, timeout) < 0
@@ -320,7 +320,7 @@
             if (ev_extra != NULL) {
                 pth_event_isolate(ev);
                 if (!pth_event_occurred(ev))
-                    return_errno(-1, EINTR);
+                    return pth_error(-1, EINTR);
             }
         }
         /* POSIX compliance */
@@ -401,7 +401,7 @@
         }
     }
     if (ev_extra != NULL && !selected)
-        return_errno(-1, EINTR);
+        return pth_error(-1, EINTR);
     return rc;
 }
 
@@ -427,7 +427,7 @@
 
     /* poll(2) semantics */
     if (pfd == NULL)
-        return_errno(-1, EFAULT);
+        return pth_error(-1, EFAULT);
 
     /* convert timeout number into a timeval structure */
     ptv = &tv;
@@ -446,7 +446,7 @@
         ptv->tv_usec = (timeout % 1000) * 1000;
     }
     else
-        return_errno(-1, EINVAL);
+        return pth_error(-1, EINVAL);
 
     /* create fd sets and determine max fd */
     maxfd = -1;
@@ -455,7 +455,7 @@
     FD_ZERO(&efds);
     for(i = 0; i < nfd; i++) {
         if (!pth_util_fd_valid(pfd[i].fd))
-            return_errno(-1, EBADF);
+            return pth_error(-1, EBADF);
         if (pfd[i].events & (POLLIN|POLLRDNORM))
             FD_SET(pfd[i].fd, &rfds);
         /* see select(2): "the only exceptional condition detectable
@@ -472,7 +472,7 @@
             maxfd = pfd[i].fd;
     }
     if (maxfd == -1)
-        return_errno(-1, EINVAL);
+        return pth_error(-1, EINVAL);
 
     /* examine fd sets */
     rc = pth_select_ev(maxfd+1, &rfds, &wfds, &efds, ptv, ev_extra);
@@ -546,7 +546,7 @@
 
     /* POSIX compliance */
     if (!pth_util_fd_valid(s))
-        return_errno(-1, EBADF);
+        return pth_error(-1, EBADF);
 
     /* force filedescriptor into non-blocking mode */
     fdmode = pth_fdmode(s, PTH_FDMODE_NONBLOCK);
@@ -557,7 +557,7 @@
         ;
 
     /* restore filedescriptor mode */
-    errno_shield { pth_fdmode(s, fdmode); }
+    pth_shield { pth_fdmode(s, fdmode); }
 
     /* if it is still on progress wait until socket is really writeable */
     if (rv == -1 && errno == EINPROGRESS && fdmode != PTH_FDMODE_NONBLOCK) {
@@ -568,14 +568,14 @@
         if (ev_extra != NULL) {
             pth_event_isolate(ev);
             if (!pth_event_occurred(ev))
-                return_errno(-1, EINTR);
+                return pth_error(-1, EINTR);
         }
         errlen = sizeof(err);
         if (getsockopt(s, SOL_SOCKET, SO_ERROR, (void *)&err, &errlen) == -1)
             return -1;
         if (err == 0)
             return 0;
-        return_errno(rv, err);
+        return pth_error(rv, err);
     }
 
     pth_debug2("pth_connect_ev: leave to thread \"%s\"", pth_current->name);
@@ -601,7 +601,7 @@
 
     /* POSIX compliance */
     if (!pth_util_fd_valid(s))
-        return_errno(-1, EBADF);
+        return pth_error(-1, EBADF);
 
     /* force filedescriptor into non-blocking mode */
     fdmode = pth_fdmode(s, PTH_FDMODE_NONBLOCK);
@@ -624,13 +624,13 @@
             pth_event_isolate(ev);
             if (!pth_event_occurred(ev)) {
                 pth_fdmode(s, fdmode);
-                return_errno(-1, EINTR);
+                return pth_error(-1, EINTR);
             }
         }
     }
 
     /* restore filedescriptor mode */
-    errno_shield {
+    pth_shield {
         pth_fdmode(s, fdmode);
         if (rv != -1)
             pth_fdmode(rv, fdmode);
@@ -662,7 +662,7 @@
     if (nbytes == 0)
         return 0;
     if (!pth_util_fd_valid(fd))
-        return_errno(-1, EBADF);
+        return pth_error(-1, EBADF);
 
     /* poll filedescriptor if not already in non-blocking operation */
     if (pth_fdmode(fd, PTH_FDMODE_POLL) == PTH_FDMODE_BLOCK) {
@@ -687,7 +687,7 @@
             if (ev_extra != NULL) {
                 pth_event_isolate(ev);
                 if (!pth_event_occurred(ev))
-                    return_errno(-1, EINTR);
+                    return pth_error(-1, EINTR);
             }
         }
     }
@@ -729,7 +729,7 @@
     if (nbytes == 0)
         return 0;
     if (!pth_util_fd_valid(fd))
-        return_errno(-1, EBADF);
+        return pth_error(-1, EBADF);
 
     /* force filedescriptor into non-blocking mode */
     fdmode = pth_fdmode(fd, PTH_FDMODE_NONBLOCK);
@@ -760,7 +760,7 @@
                     pth_event_isolate(ev);
                     if (!pth_event_occurred(ev)) {
                         pth_fdmode(fd, fdmode);
-                        return_errno(-1, EINTR);
+                        return pth_error(-1, EINTR);
                     }
                 }
             }
@@ -796,7 +796,7 @@
     }
 
     /* restore filedescriptor mode */
-    errno_shield { pth_fdmode(fd, fdmode); }
+    pth_shield { pth_fdmode(fd, fdmode); }
 
     pth_debug2("pth_write_ev: leave to thread \"%s\"", pth_current->name);
     return rv;
@@ -822,9 +822,9 @@
 
     /* POSIX compliance */
     if (iovcnt <= 0 || iovcnt > UIO_MAXIOV)
-        return_errno(-1, EINVAL);
+        return pth_error(-1, EINVAL);
     if (!pth_util_fd_valid(fd))
-        return_errno(-1, EBADF);
+        return pth_error(-1, EBADF);
 
     /* poll filedescriptor if not already in non-blocking operation */
     if (pth_fdmode(fd, PTH_FDMODE_POLL) == PTH_FDMODE_BLOCK) {
@@ -849,7 +849,7 @@
             if (ev_extra != NULL) {
                 pth_event_isolate(ev);
                 if (!pth_event_occurred(ev))
-                    return_errno(-1, EINTR);
+                    return pth_error(-1, EINTR);
             }
         }
     }
@@ -882,11 +882,11 @@
     bytes = 0;
     for (i = 0; i < iovcnt; i++) {
         if (iov[i].iov_len <= 0)
-            return_errno((ssize_t)(-1), EINVAL);
+            return pth_error((ssize_t)(-1), EINVAL);
         bytes += iov[i].iov_len;
     }
     if (bytes <= 0)
-        return_errno((ssize_t)(-1), EINVAL);
+        return pth_error((ssize_t)(-1), EINVAL);
 
     /* allocate a temporary buffer */
     if ((buffer = (char *)malloc(bytes)) == NULL)
@@ -909,7 +909,7 @@
     }
 
     /* remove the temporary buffer */
-    errno_shield { free(buffer); }
+    pth_shield { free(buffer); }
 
     /* return number of read bytes */
     return(rv);
@@ -944,9 +944,9 @@
 
     /* POSIX compliance */
     if (iovcnt <= 0 || iovcnt > UIO_MAXIOV)
-        return_errno(-1, EINVAL);
+        return pth_error(-1, EINVAL);
     if (!pth_util_fd_valid(fd))
-        return_errno(-1, EBADF);
+        return pth_error(-1, EBADF);
 
     /* force filedescriptor into non-blocking mode */
     fdmode = pth_fdmode(fd, PTH_FDMODE_NONBLOCK);
@@ -957,7 +957,7 @@
         if (iovcnt > sizeof(tiov_stack)) {
             tiovcnt = (sizeof(struct iovec) * UIO_MAXIOV);
             if ((tiov = (struct iovec *)malloc(tiovcnt)) == NULL)
-                return -1 /* errno is set */;
+                return pth_error(-1, errno);
         }
         else {
             tiovcnt = sizeof(tiov_stack);
@@ -997,7 +997,7 @@
                         pth_fdmode(fd, fdmode);
                         if (iovcnt > sizeof(tiov_stack))
                             free(tiov);
-                        return_errno(-1, EINTR);
+                        return pth_error(-1, EINTR);
                     }
                 }
             }
@@ -1047,7 +1047,7 @@
     }
 
     /* restore filedescriptor mode */
-    errno_shield { pth_fdmode(fd, fdmode); }
+    pth_shield { pth_fdmode(fd, fdmode); }
 
     pth_debug2("pth_writev_ev: leave to thread \"%s\"", pth_current->name);
     return rv;
@@ -1117,11 +1117,11 @@
     bytes = 0;
     for (i = 0; i < iovcnt; i++) {
         if (iov[i].iov_len <= 0)
-            return_errno((ssize_t)(-1), EINVAL);
+            return pth_error((ssize_t)(-1), EINVAL);
         bytes += iov[i].iov_len;
     }
     if (bytes <= 0)
-        return_errno((ssize_t)(-1), EINVAL);
+        return pth_error((ssize_t)(-1), EINVAL);
 
     /* allocate a temporary buffer to hold the data */
     if ((buffer = (char *)malloc(bytes)) == NULL)
@@ -1142,7 +1142,7 @@
     rv = pth_sc(write)(fd, buffer, bytes);
 
     /* remove the temporary buffer */
-    errno_shield { free(buffer); }
+    pth_shield { free(buffer); }
 
     return(rv);
 }
@@ -1173,7 +1173,7 @@
     rc = pth_read(fd, buf, nbytes);
 
     /* restore the old offset situation */
-    errno_shield { lseek(fd, old_offset, SEEK_SET); }
+    pth_shield { lseek(fd, old_offset, SEEK_SET); }
 
     /* unprotect and return result of read */
     pth_mutex_release(&mutex);
@@ -1206,7 +1206,7 @@
     rc = pth_write(fd, buf, nbytes);
 
     /* restore the old offset situation */
-    errno_shield { lseek(fd, old_offset, SEEK_SET); }
+    pth_shield { lseek(fd, old_offset, SEEK_SET); }
 
     /* unprotect and return result of write */
     pth_mutex_release(&mutex);
@@ -1247,7 +1247,7 @@
     if (nbytes == 0)
         return 0;
     if (!pth_util_fd_valid(fd))
-        return_errno(-1, EBADF);
+        return pth_error(-1, EBADF);
 
     /* poll filedescriptor if not already in non-blocking operation */
     if (pth_fdmode(fd, PTH_FDMODE_POLL) == PTH_FDMODE_BLOCK) {
@@ -1256,7 +1256,7 @@
            to avoid unneccessary (and resource consuming because of context
            switches, etc) event handling through the scheduler */
         if (!pth_util_fd_valid(fd))
-            return_errno(-1, EBADF);
+            return pth_error(-1, EBADF);
         FD_ZERO(&fds);
         FD_SET(fd, &fds);
         delay.tv_sec  = 0;
@@ -1274,7 +1274,7 @@
             if (ev_extra != NULL) {
                 pth_event_isolate(ev);
                 if (!pth_event_occurred(ev))
-                    return_errno(-1, EINTR);
+                    return pth_error(-1, EINTR);
             }
         }
     }
@@ -1328,7 +1328,7 @@
     if (nbytes == 0)
         return 0;
     if (!pth_util_fd_valid(fd))
-        return_errno(-1, EBADF);
+        return pth_error(-1, EBADF);
 
     /* force filedescriptor into non-blocking mode */
     fdmode = pth_fdmode(fd, PTH_FDMODE_NONBLOCK);
@@ -1341,7 +1341,7 @@
            switches, etc) event handling through the scheduler */
         if (!pth_util_fd_valid(fd)) {
             pth_fdmode(fd, fdmode);
-            return_errno(-1, EBADF);
+            return pth_error(-1, EBADF);
         }
         FD_ZERO(&fds);
         FD_SET(fd, &fds);
@@ -1363,7 +1363,7 @@
                     pth_event_isolate(ev);
                     if (!pth_event_occurred(ev)) {
                         pth_fdmode(fd, fdmode);
-                        return_errno(-1, EINTR);
+                        return pth_error(-1, EINTR);
                     }
                 }
             }
@@ -1399,7 +1399,7 @@
     }
 
     /* restore filedescriptor mode */
-    errno_shield { pth_fdmode(fd, fdmode); }
+    pth_shield { pth_fdmode(fd, fdmode); }
 
     pth_debug2("pth_sendto_ev: leave to thread \"%s\"", pth_current->name);
     return rv;

CVSTrac 2.0.1