OSSP CVS Repository

ossp - Check-in [2661]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 2661
Date: 2002-Oct-24 17:21:13 (local)
2002-Oct-24 15:21:13 (UTC)
User:rse
Branch:
Comment: Internally switch from "errno_shield {...}" to "pth_shield {...}" and from "return_errno(..)" to "return pth_error(...)" in order to make the internal error handling a little bit more consistent.
Tickets:
Inspections:
Files:
ossp-pkg/pth/ChangeLog      1.579 -> 1.580     5 inserted, 0 deleted
ossp-pkg/pth/pth.m4      1.9 -> 1.10     8 inserted, 8 deleted
ossp-pkg/pth/pth_attr.c      1.16 -> 1.17     22 inserted, 22 deleted
ossp-pkg/pth/pth_cancel.c      1.25 -> 1.26     7 inserted, 7 deleted
ossp-pkg/pth/pth_clean.c      1.16 -> 1.17     2 inserted, 2 deleted
ossp-pkg/pth/pth_data.c      1.28 -> 1.29     9 inserted, 9 deleted
ossp-pkg/pth/pth_debug.c      1.27 -> 1.28     1 inserted, 1 deleted
ossp-pkg/pth/pth_errno.c      1.23 -> 1.24     8 inserted, 8 deleted
ossp-pkg/pth/pth_event.c      1.58 -> 1.59     13 inserted, 13 deleted
ossp-pkg/pth/pth_ext.c      1.10 -> 1.11     2 inserted, 2 deleted
ossp-pkg/pth/pth_fork.c      1.13 -> 1.14     1 inserted, 1 deleted
ossp-pkg/pth/pth_high.c      1.90 -> 1.91     47 inserted, 47 deleted
ossp-pkg/pth/pth_lib.c      1.52 -> 1.53     27 inserted, 27 deleted
ossp-pkg/pth/pth_mctx.c      1.56 -> 1.57     1 inserted, 1 deleted
ossp-pkg/pth/pth_msg.c      1.24 -> 1.25     6 inserted, 6 deleted
ossp-pkg/pth/pth_ring.c      1.22 -> 1.23     1 inserted, 1 deleted
ossp-pkg/pth/pth_sync.c      1.36 -> 1.37     24 inserted, 24 deleted
ossp-pkg/pth/pth_tcb.c      1.38 -> 1.39     1 inserted, 1 deleted
ossp-pkg/pth/pthread.c      1.60 -> 1.61     95 inserted, 95 deleted

ossp-pkg/pth/ChangeLog 1.579 -> 1.580

--- ChangeLog    2002/10/24 14:01:37     1.579
+++ ChangeLog    2002/10/24 15:21:13     1.580
@@ -21,6 +21,11 @@
 
   Changes between 1.4.1 and 1.5.0 (27-Jan-2002 to xx-Oct-2002)
 
+   *) Internally switch from "errno_shield {...}" to "pth_shield {...}"
+      and from "return_errno(..)" to "return pth_error(...)" in order to
+      make the internal error handling a little bit more consistent.
+      [Ralf S. Engelschall]
+
    *) Cleaned and speeded up the pth_exit() processing.
       [Ralf S. Engelschall]
 


ossp-pkg/pth/pth.m4 1.9 -> 1.10

--- pth.m4       2002/01/30 12:54:24     1.9
+++ pth.m4       2002/10/24 15:21:13     1.10
@@ -40,7 +40,7 @@
 dnl ##
 dnl
 dnl #   auxilliary macros
-AC_DEFUN(_AC_PTH_ERROR, [dnl
+AC_DEFUN(_AC_pth_error, [dnl
 AC_MSG_RESULT([*FAILED*])
 define(_ac_pth_line,dnl
 "+------------------------------------------------------------------------+")
@@ -208,7 +208,7 @@
     _AC_PTH_VERBOSE([    o type: $_pth_type])
     if test ".$_pth_version" = .; then
         if test ".$with_pth" != .yes; then
-             _AC_PTH_ERROR([dnl
+             _AC_pth_error([dnl
              Unable to locate GNU Pth under $with_pth.
              Please specify the correct path to either a GNU Pth installation tree
              (use --with-pth=DIR if you used --prefix=DIR for installing GNU Pth in
@@ -216,7 +216,7 @@
              path to a pth-X.Y.Z/ directory; but make sure the package is already
              built, i.e., the "configure; make" step was already performed there).])
         else
-             _AC_PTH_ERROR([dnl
+             _AC_pth_error([dnl
              Unable to locate GNU Pth in any system-wide location (see \$PATH).
              Please specify the correct path to either a GNU Pth installation tree
              (use --with-pth=DIR if you used --prefix=DIR for installing GNU Pth in
@@ -256,7 +256,7 @@
         fi
     fi
     if test ".$_ok" = .0; then
-        _AC_PTH_ERROR([dnl
+        _AC_pth_error([dnl
         Found Pth version $_pth_version, but required at least version $_req_version.
         Upgrade Pth under $_pth_location to $_req_version or higher first, please.])
     fi
@@ -303,7 +303,7 @@
         _AC_PTH_VERBOSE([    o pre-processor test])
         AC_TRY_CPP(_code1, _ok=yes, _ok=no)
         if test ".$_ok" != .yes; then
-            _AC_PTH_ERROR([dnl
+            _AC_pth_error([dnl
             Found GNU Pth $_pth_version under $_pth_location, but
             was unable to perform a sanity pre-processor check. This means
             the GNU Pth header pth.h was not found.
@@ -315,7 +315,7 @@
         _AC_PTH_VERBOSE([    o link check])
         AC_TRY_LINK(_code1, _code2, _ok=yes, _ok=no)
         if test ".$_ok" != .yes; then
-            _AC_PTH_ERROR([dnl
+            _AC_pth_error([dnl
             Found GNU Pth $_pth_version under $_pth_location, but
             was unable to perform a sanity linker check. This means
             the GNU Pth library libpth.a was not found.
@@ -330,7 +330,7 @@
         AC_TRY_RUN(_code1 _code2, _ok=`cat conftestval`, _ok=no, _ok=no)
         if test ".$_ok" != .yes; then
             if test ".$_ok" = .no; then
-                _AC_PTH_ERROR([dnl
+                _AC_pth_error([dnl
                 Found GNU Pth $_pth_version under $_pth_location, but
                 was unable to perform a sanity execution check. This usually
                 means that the GNU Pth shared library libpth.so is present
@@ -345,7 +345,7 @@
                 >> LIBS="$LIBS"
                 See config.log for possibly more details.])
             else
-                _AC_PTH_ERROR([dnl
+                _AC_pth_error([dnl
                 Found GNU Pth $_pth_version under $_pth_location, but
                 was unable to perform a sanity run-time check. This usually
                 means that the GNU Pth library failed to work and possibly


ossp-pkg/pth/pth_attr.c 1.16 -> 1.17

--- pth_attr.c   2002/01/27 11:03:40     1.16
+++ pth_attr.c   2002/10/24 15:21:13     1.17
@@ -51,9 +51,9 @@
     pth_attr_t a;
 
     if (t == NULL)
-        return_errno(FALSE, EINVAL);
+        return pth_error((pth_attr_t)NULL, EINVAL);
     if ((a = (pth_attr_t)malloc(sizeof(struct pth_attr_st))) == NULL)
-        return_errno(NULL, ENOMEM);
+        return pth_error((pth_attr_t)NULL, ENOMEM);
     a->a_tid = t;
     return a;
 }
@@ -63,7 +63,7 @@
     pth_attr_t a;
 
     if ((a = (pth_attr_t)malloc(sizeof(struct pth_attr_st))) == NULL)
-        return_errno(NULL, ENOMEM);
+        return pth_error((pth_attr_t)NULL, ENOMEM);
     a->a_tid = NULL;
     pth_attr_init(a);
     return a;
@@ -72,7 +72,7 @@
 int pth_attr_destroy(pth_attr_t a)
 {
     if (a == NULL)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     free(a);
     return TRUE;
 }
@@ -80,9 +80,9 @@
 int pth_attr_init(pth_attr_t a)
 {
     if (a == NULL)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     if (a->a_tid != NULL)
-        return_errno(FALSE, EPERM);
+        return pth_error(FALSE, EPERM);
     a->a_prio = PTH_PRIO_STD;
     pth_util_cpystrn(a->a_name, "unknown", PTH_TCB_NAMELEN);
     a->a_joinable = TRUE;
@@ -117,7 +117,7 @@
 intern int pth_attr_ctrl(int cmd, pth_attr_t a, int op, va_list ap)
 {
     if (a == NULL)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     switch (op) {
         case PTH_ATTR_PRIO: {
             /* priority */
@@ -182,7 +182,7 @@
             unsigned int val, *src, *dst;
             if (cmd == PTH_ATTR_SET) {
                 if (a->a_tid != NULL)
-                    return_errno(FALSE, EPERM);
+                    return pth_error(FALSE, EPERM);
                 src = &val; val = va_arg(ap, unsigned int);
                 dst = &a->a_stacksize;
             }
@@ -198,7 +198,7 @@
             char *val, **src, **dst;
             if (cmd == PTH_ATTR_SET) {
                 if (a->a_tid != NULL)
-                    return_errno(FALSE, EPERM);
+                    return pth_error(FALSE, EPERM);
                 src = &val; val = va_arg(ap, char *);
                 dst = &a->a_stackaddr;
             }
@@ -212,7 +212,7 @@
         case PTH_ATTR_TIME_SPAWN: {
             pth_time_t *dst;
             if (cmd == PTH_ATTR_SET)
-                return_errno(FALSE, EPERM);
+                return pth_error(FALSE, EPERM);
             dst = va_arg(ap, pth_time_t *);
             if (a->a_tid != NULL)
                 pth_time_set(dst, &a->a_tid->spawned);
@@ -223,7 +223,7 @@
         case PTH_ATTR_TIME_LAST: {
             pth_time_t *dst;
             if (cmd == PTH_ATTR_SET)
-                return_errno(FALSE, EPERM);
+                return pth_error(FALSE, EPERM);
             dst = va_arg(ap, pth_time_t *);
             if (a->a_tid != NULL)
                 pth_time_set(dst, &a->a_tid->lastran);
@@ -234,7 +234,7 @@
         case PTH_ATTR_TIME_RAN: {
             pth_time_t *dst;
             if (cmd == PTH_ATTR_SET)
-                return_errno(FALSE, EPERM);
+                return pth_error(FALSE, EPERM);
             dst = va_arg(ap, pth_time_t *);
             if (a->a_tid != NULL)
                 pth_time_set(dst, &a->a_tid->running);
@@ -245,9 +245,9 @@
         case PTH_ATTR_START_FUNC: {
             void *(**dst)(void *);
             if (cmd == PTH_ATTR_SET)
-                return_errno(FALSE, EPERM);
+                return pth_error(FALSE, EPERM);
             if (a->a_tid == NULL)
-                return_errno(FALSE, EACCES);
+                return pth_error(FALSE, EACCES);
             dst = (void *(**)(void *))va_arg(ap, void *);
             *dst = a->a_tid->start_func;
             break;
@@ -255,9 +255,9 @@
         case PTH_ATTR_START_ARG: {
             void **dst;
             if (cmd == PTH_ATTR_SET)
-                return_errno(FALSE, EPERM);
+                return pth_error(FALSE, EPERM);
             if (a->a_tid == NULL)
-                return_errno(FALSE, EACCES);
+                return pth_error(FALSE, EACCES);
             dst = va_arg(ap, void **);
             *dst = a->a_tid->start_arg;
             break;
@@ -265,9 +265,9 @@
         case PTH_ATTR_STATE: {
             pth_state_t *dst;
             if (cmd == PTH_ATTR_SET)
-                return_errno(FALSE, EPERM);
+                return pth_error(FALSE, EPERM);
             if (a->a_tid == NULL)
-                return_errno(FALSE, EACCES);
+                return pth_error(FALSE, EACCES);
             dst = va_arg(ap, pth_state_t *);
             *dst = a->a_tid->state;
             break;
@@ -275,9 +275,9 @@
         case PTH_ATTR_EVENTS: {
             pth_event_t *dst;
             if (cmd == PTH_ATTR_SET)
-                return_errno(FALSE, EPERM);
+                return pth_error(FALSE, EPERM);
             if (a->a_tid == NULL)
-                return_errno(FALSE, EACCES);
+                return pth_error(FALSE, EACCES);
             dst = va_arg(ap, pth_event_t *);
             *dst = a->a_tid->events;
             break;
@@ -285,13 +285,13 @@
         case PTH_ATTR_BOUND: {
             int *dst;
             if (cmd == PTH_ATTR_SET)
-                return_errno(FALSE, EPERM);
+                return pth_error(FALSE, EPERM);
             dst = va_arg(ap, int *);
             *dst = (a->a_tid != NULL ? TRUE : FALSE);
             break;
         }
         default:
-            return_errno(FALSE, EINVAL);
+            return pth_error(FALSE, EINVAL);
     }
     return TRUE;
 }


ossp-pkg/pth/pth_cancel.c 1.25 -> 1.26

--- pth_cancel.c 2002/01/27 11:03:40     1.25
+++ pth_cancel.c 2002/10/24 15:21:13     1.26
@@ -56,15 +56,15 @@
     pth_pqueue_t *q;
 
     if (thread == NULL)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
 
     /* the current thread cannot be cancelled */
     if (thread == pth_current)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
 
     /* the thread has to be at least still alive */
     if (thread->state == PTH_STATE_DEAD)
-        return_errno(FALSE, EPERM);
+        return pth_error(FALSE, EPERM);
 
     /* now mark the thread as cancelled */
     thread->cancelreq = TRUE;
@@ -81,9 +81,9 @@
             default:                q = NULL;
         }
         if (q == NULL)
-            return_errno(FALSE, ESRCH);
+            return pth_error(FALSE, ESRCH);
         if (!pth_pqueue_contains(q, thread))
-            return_errno(FALSE, ESRCH);
+            return pth_error(FALSE, ESRCH);
         pth_pqueue_delete(q, thread);
 
         /* execute cleanups */
@@ -108,11 +108,11 @@
 int pth_abort(pth_t thread)
 {
     if (thread == NULL)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
 
     /* the current thread cannot be aborted */
     if (thread == pth_current)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
 
     if (thread->state == PTH_STATE_DEAD && thread->joinable) {
         /* if thread is already terminated, just join it */


ossp-pkg/pth/pth_clean.c 1.16 -> 1.17

--- pth_clean.c  2002/01/27 11:03:40     1.16
+++ pth_clean.c  2002/10/24 15:21:13     1.17
@@ -44,9 +44,9 @@
     pth_cleanup_t *cleanup;
 
     if (func == NULL)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     if ((cleanup = (pth_cleanup_t *)malloc(sizeof(pth_cleanup_t))) == NULL)
-        return_errno(FALSE, ENOMEM);
+        return pth_error(FALSE, ENOMEM);
     cleanup->func = func;
     cleanup->arg  = arg;
     cleanup->next = pth_current->cleanups;


ossp-pkg/pth/pth_data.c 1.28 -> 1.29

--- pth_data.c   2002/01/27 11:03:40     1.28
+++ pth_data.c   2002/10/24 15:21:13     1.29
@@ -43,15 +43,15 @@
             return TRUE;
         }
     }
-    return_errno(FALSE, EAGAIN);
+    return pth_error(FALSE, EAGAIN);
 }
 
 int pth_key_delete(pth_key_t key)
 {
     if (key >= PTH_KEY_MAX)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     if (!pth_keytab[key].used)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     pth_keytab[key].used = FALSE;
     return TRUE;
 }
@@ -59,13 +59,13 @@
 int pth_key_setdata(pth_key_t key, const void *value)
 {
     if (key >= PTH_KEY_MAX)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     if (!pth_keytab[key].used)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     if (pth_current->data_value == NULL) {
         pth_current->data_value = (const void **)calloc(1, sizeof(void *)*PTH_KEY_MAX);
         if (pth_current->data_value == NULL)
-            return_errno(FALSE, ENOMEM);
+            return pth_error(FALSE, ENOMEM);
     }
     if (pth_current->data_value[key] == NULL) {
         if (value != NULL)
@@ -82,11 +82,11 @@
 void *pth_key_getdata(pth_key_t key)
 {
     if (key >= PTH_KEY_MAX)
-        return_errno(NULL, EINVAL);
+        return pth_error((void *)NULL, EINVAL);
     if (!pth_keytab[key].used)
-        return_errno(NULL, EINVAL);
+        return pth_error((void *)NULL, EINVAL);
     if (pth_current->data_value == NULL)
-        return NULL;
+        return (void *)NULL;
     return (void *)pth_current->data_value[key];
 }
 


ossp-pkg/pth/pth_debug.c 1.27 -> 1.28

--- pth_debug.c  2002/10/15 20:34:22     1.27
+++ pth_debug.c  2002/10/24 15:21:13     1.28
@@ -58,7 +58,7 @@
     static char str[1024];
     size_t n;
 
-    errno_shield {
+    pth_shield {
         va_start(ap, fmt);
         if (file != NULL)
             pth_snprintf(str, sizeof(str), "%d:%s:%04d: ", (int)getpid(), file, line);


ossp-pkg/pth/pth_errno.c 1.23 -> 1.24

--- pth_errno.c  2002/01/27 11:03:40     1.23
+++ pth_errno.c  2002/10/24 15:21:13     1.24
@@ -30,7 +30,7 @@
 #if cpp
 
 /* enclose errno in a block */
-#define errno_shield \
+#define pth_shield \
         for ( pth_errno_storage = errno, \
               pth_errno_flag = TRUE; \
               pth_errno_flag; \
@@ -39,14 +39,14 @@
 
 /* return plus setting an errno value */
 #if defined(PTH_DEBUG)
-#define return_errno(return_val,errno_val) \
-        do { errno = (errno_val); \
-             pth_debug4("return 0x%lx with errno %d(\"%s\")", \
-                        (unsigned long)(return_val), (errno), strerror((errno))); \
-             return (return_val); } while (0)
+#define pth_error(return_val,errno_val) \
+        (errno = (errno_val), \
+        pth_debug4("return 0x%lx with errno %d(\"%s\")", \
+                   (unsigned long)(return_val), (errno), strerror((errno))), \
+        (return_val))
 #else
-#define return_errno(return_val,errno_val) \
-        do { errno = (errno_val); return (return_val); } while (0)
+#define pth_error(return_val,errno_val) \
+        (errno = (errno_val), (return_val))
 #endif
 
 #endif /* cpp */


ossp-pkg/pth/pth_event.c 1.58 -> 1.59

--- pth_event.c  2002/01/27 13:15:28     1.58
+++ pth_event.c  2002/10/24 15:21:13     1.59
@@ -92,7 +92,7 @@
         ev = (pth_event_t)malloc(sizeof(struct pth_event_st));
     }
     if (ev == NULL)
-        return NULL; /* errno is already set */
+        return pth_error((pth_event_t)NULL, errno);
 
     /* create new event ring out of event or insert into existing ring */
     if (spec & PTH_MODE_CHAIN) {
@@ -115,7 +115,7 @@
         /* filedescriptor event */
         int fd = va_arg(ap, int);
         if (!pth_util_fd_valid(fd))
-            return_errno(NULL, EBADF);
+            return pth_error((pth_event_t)NULL, EBADF);
         ev->ev_type = PTH_EVENT_FD;
         ev->ev_goal = (int)(spec & (PTH_UNTIL_FD_READABLE|\
                                     PTH_UNTIL_FD_WRITEABLE|\
@@ -201,7 +201,7 @@
         ev->ev_args.FUNC.tv    = va_arg(ap, pth_time_t);
     }
     else
-        return_errno(NULL, EINVAL);
+        return pth_error((pth_event_t)NULL, EINVAL);
 
     va_end(ap);
 
@@ -213,7 +213,7 @@
 unsigned long pth_event_typeof(pth_event_t ev)
 {
     if (ev == NULL)
-        return_errno(0, EINVAL);
+        return pth_error(0, EINVAL);
     return (ev->ev_type | ev->ev_goal);
 }
 
@@ -223,7 +223,7 @@
     va_list ap;
 
     if (ev == NULL)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     va_start(ap, ev);
 
     /* extract event specific ingredients */
@@ -274,7 +274,7 @@
         *tv   = ev->ev_args.FUNC.tv;
     }
     else
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     va_end(ap);
     return TRUE;
 }
@@ -289,7 +289,7 @@
     va_list ap;
 
     if (evf == NULL)
-        return_errno(NULL, EINVAL);
+        return pth_error((pth_event_t)NULL, EINVAL);
 
     /* open ring */
     va_start(ap, evf);
@@ -318,7 +318,7 @@
     pth_event_t ring;
 
     if (ev == NULL)
-        return_errno(NULL, EINVAL);
+        return pth_error((pth_event_t)NULL, EINVAL);
     ring = NULL;
     if (!(ev->ev_next == ev && ev->ev_prev == ev)) {
         ring = ev->ev_next;
@@ -334,7 +334,7 @@
 int pth_event_occurred(pth_event_t ev)
 {
     if (ev == NULL)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     return ev->ev_occurred;
 }
 
@@ -342,14 +342,14 @@
 pth_event_t pth_event_walk(pth_event_t ev, unsigned int direction)
 {
     if (ev == NULL)
-        return_errno(NULL, EINVAL);
+        return pth_error((pth_event_t)NULL, EINVAL);
     do {
         if (direction & PTH_WALK_NEXT)
             ev = ev->ev_next;
         else if (direction & PTH_WALK_PREV)
             ev = ev->ev_prev;
         else
-            return_errno(NULL, EINVAL);
+            return pth_error((pth_event_t)NULL, EINVAL);
     } while ((direction & PTH_UNTIL_OCCURRED) && !(ev->ev_occurred));
     return ev;
 }
@@ -361,7 +361,7 @@
     pth_event_t evn;
 
     if (ev == NULL)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     if (mode == PTH_FREE_THIS) {
         ev->ev_prev->ev_next = ev->ev_next;
         ev->ev_next->ev_prev = ev->ev_prev;
@@ -386,7 +386,7 @@
 
     /* at least a waiting ring is required */
     if (ev_ring == NULL)
-        return_errno(-1, EINVAL);
+        return pth_error(-1, EINVAL);
     pth_debug2("pth_wait: enter from thread \"%s\"", pth_current->name);
 
     /* mark all events in waiting ring as still not occurred */


ossp-pkg/pth/pth_ext.c 1.10 -> 1.11

--- pth_ext.c    2002/01/27 11:03:40     1.10
+++ pth_ext.c    2002/10/24 15:21:13     1.11
@@ -90,14 +90,14 @@
     Sfdisc_t *disc;
 
     if ((disc = (Sfdisc_t *)malloc(sizeof(Sfdisc_t))) == NULL)
-        return NULL;
+        return pth_error((SFdisc_t *)NULL, errno);
     disc->readf   = pth_sfio_read;
     disc->writef  = pth_sfio_write;
     disc->seekf   = pth_sfio_seek;
     disc->exceptf = pth_sfio_except;
     return disc;
 #else
-    return_errno(NULL, ENOSYS);
+    return pth_error((Sfdisc_t *)NULL, ENOSYS);
 #endif /* PTH_EXT_SFIO */
 }
 


ossp-pkg/pth/pth_fork.c 1.13 -> 1.14

--- pth_fork.c   2002/01/27 11:03:40     1.13
+++ pth_fork.c   2002/10/24 15:21:13     1.14
@@ -43,7 +43,7 @@
                     void (*child)(void *), void *arg)
 {
     if (pth_atfork_idx > PTH_ATFORK_MAX-1)
-        return_errno(FALSE, ENOMEM);
+        return pth_error(FALSE, ENOMEM);
     pth_atfork_list[pth_atfork_idx].prepare = prepare;
     pth_atfork_list[pth_atfork_idx].parent  = parent;
     pth_atfork_list[pth_atfork_idx].child   = child;


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;


ossp-pkg/pth/pth_lib.c 1.52 -> 1.53

--- pth_lib.c    2002/10/24 14:01:37     1.52
+++ pth_lib.c    2002/10/24 15:21:13     1.53
@@ -63,7 +63,7 @@
     /* support for implicit initialization calls
        and to prevent multiple explict initialization, too */
     if (pth_initialized)
-        return_errno(FALSE, EPERM);
+        return pth_error(FALSE, EPERM);
     else
         pth_initialized = TRUE;
 
@@ -91,7 +91,7 @@
     pth_attr_set(t_attr, PTH_ATTR_STACK_ADDR,   NULL);
     pth_sched = pth_spawn(t_attr, pth_scheduler, NULL);
     if (pth_sched == NULL) {
-        errno_shield {
+        pth_shield {
             pth_attr_destroy(t_attr);
             pth_scheduler_kill();
         }
@@ -107,7 +107,7 @@
     pth_attr_set(t_attr, PTH_ATTR_STACK_ADDR,   NULL);
     pth_main = pth_spawn(t_attr, (void *(*)(void *))(-1), NULL);
     if (pth_main == NULL) {
-        errno_shield {
+        pth_shield {
             pth_attr_destroy(t_attr);
             pth_scheduler_kill();
         }
@@ -134,7 +134,7 @@
 int pth_kill(void)
 {
     if (pth_current != pth_main)
-        return_errno(FALSE, EPERM);
+        return pth_error(FALSE, EPERM);
     pth_debug1("pth_kill: enter");
     pth_thread_cleanup(pth_main);
     pth_scheduler_kill();
@@ -192,7 +192,7 @@
         rc = -1;
     va_end(ap);
     if (rc == -1)
-        return_errno(-1, EINVAL);
+        return pth_error(-1, EINVAL);
     return rc;
 }
 
@@ -221,7 +221,7 @@
 
     /* consistency */
     if (func == NULL)
-        return_errno(NULL, EINVAL);
+        return pth_error((pth_t)NULL, EINVAL);
 
     /* support the special case of main() */
     if (func == (void *(*)(void *))(-1))
@@ -231,7 +231,7 @@
     stacksize = (attr == PTH_ATTR_DEFAULT ? 64*1024 : attr->a_stacksize);
     stackaddr = (attr == PTH_ATTR_DEFAULT ? NULL    : attr->a_stackaddr);
     if ((t = pth_tcb_alloc(stacksize, stackaddr)) == NULL)
-        return NULL;
+        return pth_error((pth_t)NULL, errno);
 
     /* configure remaining attributes */
     if (attr != PTH_ATTR_DEFAULT) {
@@ -299,8 +299,8 @@
     if (t->stacksize > 0) { /* the "main thread" (indicated by == 0) is special! */
         if (!pth_mctx_set(&t->mctx, pth_spawn_trampoline,
                           t->stack, ((char *)t->stack+t->stacksize))) {
-            errno_shield { pth_tcb_free(t); }
-            return NULL;
+            pth_shield { pth_tcb_free(t); }
+            return pth_error((pth_t)NULL, errno);
         }
     }
 
@@ -330,7 +330,7 @@
     struct sigaction sa;
 
     if (t == NULL || t == pth_current || (sig < 0 || sig > PTH_NSIG))
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     if (sig == 0)
         /* just test whether thread exists */
         return pth_thread_exists(t);
@@ -357,7 +357,7 @@
             if (!pth_pqueue_contains(&pth_WQ, t))
                 if (!pth_pqueue_contains(&pth_SQ, t))
                     if (!pth_pqueue_contains(&pth_DQ, t))
-                        return_errno(FALSE, ESRCH); /* not found */
+                        return pth_error(FALSE, ESRCH); /* not found */
     return TRUE;
 }
 
@@ -458,11 +458,11 @@
 
     pth_debug2("pth_join: joining thread \"%s\"", tid == NULL ? "-ANY-" : tid->name);
     if (tid == pth_current)
-        return_errno(FALSE, EDEADLK);
+        return pth_error(FALSE, EDEADLK);
     if (tid != NULL && !tid->joinable)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     if (pth_ctrl(PTH_CTRL_GETTHREADS) == 1)
-        return_errno(FALSE, EDEADLK);
+        return pth_error(FALSE, EDEADLK);
     if (tid == NULL)
         tid = pth_pqueue_head(&pth_DQ);
     if (tid == NULL || (tid != NULL && tid->state != PTH_STATE_DEAD)) {
@@ -472,7 +472,7 @@
     if (tid == NULL)
         tid = pth_pqueue_head(&pth_DQ);
     if (tid == NULL || (tid != NULL && tid->state != PTH_STATE_DEAD))
-        return_errno(FALSE, EIO);
+        return pth_error(FALSE, EIO);
     if (value != NULL)
         *value = tid->join_arg;
     pth_pqueue_delete(&pth_DQ, tid);
@@ -495,7 +495,7 @@
             default:               q = NULL;
         }
         if (q == NULL || !pth_pqueue_contains(q, to))
-            return_errno(FALSE, EINVAL);
+            return pth_error(FALSE, EINVAL);
     }
 
     /* give a favored thread maximum priority in his queue */
@@ -521,9 +521,9 @@
     pth_pqueue_t *q;
 
     if (t == NULL)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     if (t == pth_sched || t == pth_current)
-        return_errno(FALSE, EPERM);
+        return pth_error(FALSE, EPERM);
     switch (t->state) {
         case PTH_STATE_NEW:     q = &pth_NQ; break;
         case PTH_STATE_READY:   q = &pth_RQ; break;
@@ -531,9 +531,9 @@
         default:                q = NULL;
     }
     if (q == NULL)
-        return_errno(FALSE, EPERM);
+        return pth_error(FALSE, EPERM);
     if (!pth_pqueue_contains(q, t))
-        return_errno(FALSE, ESRCH);
+        return pth_error(FALSE, ESRCH);
     pth_pqueue_delete(q, t);
     pth_pqueue_insert(&pth_SQ, PTH_PRIO_STD, t);
     pth_debug2("pth_suspend: suspend thread \"%s\"\n", t->name);
@@ -546,11 +546,11 @@
     pth_pqueue_t *q;
 
     if (t == NULL)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     if (t == pth_sched || t == pth_current)
-        return_errno(FALSE, EPERM);
+        return pth_error(FALSE, EPERM);
     if (!pth_pqueue_contains(&pth_SQ, t))
-        return_errno(FALSE, EPERM);
+        return pth_error(FALSE, EPERM);
     pth_pqueue_delete(&pth_SQ, t);
     switch (t->state) {
         case PTH_STATE_NEW:     q = &pth_NQ; break;
@@ -569,7 +569,7 @@
     int fdmode;
     int oldmode;
 
-    /* retrieve old mode (usually cheap) */
+    /* retrieve old mode (usually a very cheap operation) */
     if ((fdmode = fcntl(fd, F_GETFL, NULL)) == -1)
         oldmode = PTH_FDMODE_ERROR;
     else if (fdmode & O_NONBLOCKING)
@@ -577,7 +577,7 @@
     else
         oldmode = PTH_FDMODE_BLOCK;
 
-    /* set new mode (usually expensive) */
+    /* set new mode (usually a more expensive operation) */
     if (oldmode == PTH_FDMODE_BLOCK && newmode == PTH_FDMODE_NONBLOCK)
         fcntl(fd, F_SETFL, (fdmode | O_NONBLOCKING));
     if (oldmode == PTH_FDMODE_NONBLOCK && newmode == PTH_FDMODE_BLOCK)
@@ -595,7 +595,7 @@
     static pth_key_t ev_key = PTH_KEY_INIT;
 
     if (pth_time_cmp(&naptime, PTH_TIME_ZERO) == 0)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     pth_time_set(&until, PTH_TIME_NOW);
     pth_time_add(&until, &naptime);
     ev = pth_event(PTH_EVENT_TIME|PTH_MODE_STATIC, &ev_key, until);
@@ -607,7 +607,7 @@
 int pth_once(pth_once_t *oncectrl, void (*constructor)(void *), void *arg)
 {
     if (oncectrl == NULL || constructor == NULL)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     if (*oncectrl != TRUE)
         constructor(arg);
     *oncectrl = TRUE;


ossp-pkg/pth/pth_mctx.c 1.56 -> 1.57

--- pth_mctx.c   2002/01/27 11:03:40     1.56
+++ pth_mctx.c   2002/10/24 15:21:14     1.57
@@ -315,7 +315,7 @@
         return FALSE;
     sigaltstack(NULL, &ss);
     if (!(ss.ss_flags & SS_DISABLE))
-        return_errno(FALSE, EIO);
+        return pth_error(FALSE, EIO);
     if (!(oss.ss_flags & SS_DISABLE))
         sigaltstack(&oss, NULL);
 #elif PTH_MCTX_STK(ss)


ossp-pkg/pth/pth_msg.c 1.24 -> 1.25

--- pth_msg.c    2002/10/24 09:39:01     1.24
+++ pth_msg.c    2002/10/24 15:21:14     1.25
@@ -50,7 +50,7 @@
 
     /* allocate message port structure */
     if ((mp = (pth_msgport_t)malloc(sizeof(struct pth_msgport_st))) == NULL)
-        return_errno(NULL, ENOMEM);
+        return pth_error((pth_msgport_t)NULL, ENOMEM);
 
     /* initialize structure */
     mp->mp_name  = name;
@@ -92,7 +92,7 @@
 
     /* check input */
     if (name == NULL)
-        return_errno(NULL, EINVAL);
+        return pth_error((pth_msgport_t)NULL, EINVAL);
 
     /* iterate over message ports */
     mp = mpf = (pth_msgport_t)pth_ring_first(&pth_msgport);
@@ -112,7 +112,7 @@
 int pth_msgport_pending(pth_msgport_t mp)
 {
     if (mp == NULL)
-        return_errno(-1, EINVAL);
+        return pth_error(-1, EINVAL);
     return pth_ring_elements(&mp->mp_queue);
 }
 
@@ -120,7 +120,7 @@
 int pth_msgport_put(pth_msgport_t mp, pth_message_t *m)
 {
     if (mp == NULL)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     pth_ring_append(&mp->mp_queue, (pth_ringnode_t *)m);
     return TRUE;
 }
@@ -131,7 +131,7 @@
     pth_message_t *m;
 
     if (mp == NULL)
-        return_errno(NULL, EINVAL);
+        return pth_error((pth_message_t *)NULL, EINVAL);
     m = (pth_message_t *)pth_ring_pop(&mp->mp_queue);
     return m;
 }
@@ -140,7 +140,7 @@
 int pth_msgport_reply(pth_message_t *m)
 {
     if (m == NULL)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     return pth_msgport_put(m->m_replyport, m);
 }
 


ossp-pkg/pth/pth_ring.c 1.22 -> 1.23

--- pth_ring.c   2002/10/15 20:34:23     1.22
+++ pth_ring.c   2002/10/24 15:21:14     1.23
@@ -228,7 +228,7 @@
     int rc;
 
     if (r == NULL || rns == NULL)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     rc = FALSE;
     rn = r->r_hook;
     if (rn != NULL) {


ossp-pkg/pth/pth_sync.c 1.36 -> 1.37

--- pth_sync.c   2002/01/27 11:03:41     1.36
+++ pth_sync.c   2002/10/24 15:21:14     1.37
@@ -35,7 +35,7 @@
 int pth_mutex_init(pth_mutex_t *mutex)
 {
     if (mutex == NULL)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     mutex->mx_state = PTH_MUTEX_INITIALIZED;
     mutex->mx_owner = NULL;
     mutex->mx_count = 0;
@@ -51,9 +51,9 @@
 
     /* consistency checks */
     if (mutex == NULL)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     if (!(mutex->mx_state & PTH_MUTEX_INITIALIZED))
-        return_errno(FALSE, EDEADLK);
+        return pth_error(FALSE, EDEADLK);
 
     /* still not locked, so simply acquire mutex? */
     if (!(mutex->mx_state & PTH_MUTEX_LOCKED)) {
@@ -75,7 +75,7 @@
 
     /* should we just tryonly? */
     if (tryonly)
-        return_errno(FALSE, EBUSY);
+        return pth_error(FALSE, EBUSY);
 
     /* else wait for mutex to become unlocked.. */
     pth_debug1("pth_mutex_acquire: wait until mutex is unlocked");
@@ -87,7 +87,7 @@
         if (ev_extra != NULL) {
             pth_event_isolate(ev);
             if (!pth_event_occurred(ev))
-                return_errno(FALSE, EINTR);
+                return pth_error(FALSE, EINTR);
         }
         if (!(mutex->mx_state & PTH_MUTEX_LOCKED))
             break;
@@ -106,13 +106,13 @@
 {
     /* consistency checks */
     if (mutex == NULL)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     if (!(mutex->mx_state & PTH_MUTEX_INITIALIZED))
-        return_errno(FALSE, EDEADLK);
+        return pth_error(FALSE, EDEADLK);
     if (!(mutex->mx_state & PTH_MUTEX_LOCKED))
-        return_errno(FALSE, EDEADLK);
+        return pth_error(FALSE, EDEADLK);
     if (mutex->mx_owner != pth_current)
-        return_errno(FALSE, EACCES);
+        return pth_error(FALSE, EACCES);
 
     /* decrement recursion counter and release mutex */
     mutex->mx_count--;
@@ -149,7 +149,7 @@
 int pth_rwlock_init(pth_rwlock_t *rwlock)
 {
     if (rwlock == NULL)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     rwlock->rw_state = PTH_RWLOCK_INITIALIZED;
     rwlock->rw_readers = 0;
     pth_mutex_init(&(rwlock->rw_mutex_rd));
@@ -161,9 +161,9 @@
 {
     /* consistency checks */
     if (rwlock == NULL)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     if (!(rwlock->rw_state & PTH_RWLOCK_INITIALIZED))
-        return_errno(FALSE, EDEADLK);
+        return pth_error(FALSE, EDEADLK);
 
     /* acquire lock */
     if (op == PTH_RWLOCK_RW) {
@@ -180,7 +180,7 @@
         if (rwlock->rw_readers == 1) {
             if (!pth_mutex_acquire(&(rwlock->rw_mutex_rw), tryonly, ev_extra)) {
                 rwlock->rw_readers--;
-                errno_shield { pth_mutex_release(&(rwlock->rw_mutex_rd)); }
+                pth_shield { pth_mutex_release(&(rwlock->rw_mutex_rd)); }
                 return FALSE;
             }
         }
@@ -194,9 +194,9 @@
 {
     /* consistency checks */
     if (rwlock == NULL)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     if (!(rwlock->rw_state & PTH_RWLOCK_INITIALIZED))
-        return_errno(FALSE, EDEADLK);
+        return pth_error(FALSE, EDEADLK);
 
     /* release lock */
     if (rwlock->rw_mode == PTH_RWLOCK_RW) {
@@ -212,7 +212,7 @@
         if (rwlock->rw_readers == 0) {
             if (!pth_mutex_release(&(rwlock->rw_mutex_rw))) {
                 rwlock->rw_readers++;
-                errno_shield { pth_mutex_release(&(rwlock->rw_mutex_rd)); }
+                pth_shield { pth_mutex_release(&(rwlock->rw_mutex_rd)); }
                 return FALSE;
             }
         }
@@ -229,7 +229,7 @@
 int pth_cond_init(pth_cond_t *cond)
 {
     if (cond == NULL)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     cond->cn_state   = PTH_COND_INITIALIZED;
     cond->cn_waiters = 0;
     return TRUE;
@@ -257,9 +257,9 @@
 
     /* consistency checks */
     if (cond == NULL || mutex == NULL)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     if (!(cond->cn_state & PTH_COND_INITIALIZED))
-        return_errno(FALSE, EDEADLK);
+        return pth_error(FALSE, EDEADLK);
 
     /* check whether we can do a short-circuit wait */
     if (    (cond->cn_state & PTH_COND_SIGNALED)
@@ -302,9 +302,9 @@
 {
     /* consistency checks */
     if (cond == NULL)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     if (!(cond->cn_state & PTH_COND_INITIALIZED))
-        return_errno(FALSE, EDEADLK);
+        return pth_error(FALSE, EDEADLK);
 
     /* do something only if there is at least one waiters (POSIX semantics) */
     if (cond->cn_waiters > 0) {
@@ -331,7 +331,7 @@
 int pth_barrier_init(pth_barrier_t *barrier, int threshold)
 {
     if (barrier == NULL || threshold <= 0)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     if (!pth_mutex_init(&(barrier->br_mutex)))
         return FALSE;
     if (!pth_cond_init(&(barrier->br_cond)))
@@ -349,9 +349,9 @@
     int rv;
 
     if (barrier == NULL)
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
     if (!(barrier->br_state & PTH_BARRIER_INITIALIZED))
-        return_errno(FALSE, EINVAL);
+        return pth_error(FALSE, EINVAL);
 
     if (!pth_mutex_acquire(&(barrier->br_mutex), FALSE, NULL))
         return FALSE;


ossp-pkg/pth/pth_tcb.c 1.38 -> 1.39

--- pth_tcb.c    2002/01/30 13:07:08     1.38
+++ pth_tcb.c    2002/10/24 15:21:14     1.39
@@ -116,7 +116,7 @@
             t->stack = (char *)(stackaddr);
         else {
             if ((t->stack = (char *)malloc(stacksize)) == NULL) {
-                errno_shield { free(t); }
+                pth_shield { free(t); }
                 return NULL;
             }
         }


ossp-pkg/pth/pthread.c 1.60 -> 1.61

--- pthread.c    2002/10/23 14:04:00     1.60
+++ pthread.c    2002/10/24 15:21:14     1.61
@@ -80,7 +80,7 @@
 
     pthread_initialize();
     if (attr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if ((na = pth_attr_new()) == NULL)
         return errno;
     (*attr) = (pthread_attr_t)na;
@@ -92,7 +92,7 @@
     pth_attr_t na;
 
     if (attr == NULL || *attr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     na = (pth_attr_t)(*attr);
     pth_attr_destroy(na);
     *attr = NULL;
@@ -102,71 +102,71 @@
 int pthread_attr_setinheritsched(pthread_attr_t *attr, int inheritsched)
 {
     if (attr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* not supported */
-    return_errno(ENOSYS, ENOSYS);
+    return pth_error(ENOSYS, ENOSYS);
 }
 
 int pthread_attr_getinheritsched(const pthread_attr_t *attr, int *inheritsched)
 {
     if (attr == NULL || inheritsched == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* not supported */
-    return_errno(ENOSYS, ENOSYS);
+    return pth_error(ENOSYS, ENOSYS);
 }
 
 int pthread_attr_setschedparam(pthread_attr_t *attr, struct sched_param *schedparam)
 {
     if (attr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* not supported */
-    return_errno(ENOSYS, ENOSYS);
+    return pth_error(ENOSYS, ENOSYS);
 }
 
 int pthread_attr_getschedparam(const pthread_attr_t *attr, struct sched_param *schedparam)
 {
     if (attr == NULL || schedparam == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* not supported */
-    return_errno(ENOSYS, ENOSYS);
+    return pth_error(ENOSYS, ENOSYS);
 }
 
 int pthread_attr_setschedpolicy(pthread_attr_t *attr, int schedpolicy)
 {
     if (attr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* not supported */
-    return_errno(ENOSYS, ENOSYS);
+    return pth_error(ENOSYS, ENOSYS);
 }
 
 int pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *schedpolicy)
 {
     if (attr == NULL || schedpolicy == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* not supported */
-    return_errno(ENOSYS, ENOSYS);
+    return pth_error(ENOSYS, ENOSYS);
 }
 
 int pthread_attr_setscope(pthread_attr_t *attr, int scope)
 {
     if (attr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* not supported */
-    return_errno(ENOSYS, ENOSYS);
+    return pth_error(ENOSYS, ENOSYS);
 }
 
 int pthread_attr_getscope(const pthread_attr_t *attr, int *scope)
 {
     if (attr == NULL || scope == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* not supported */
-    return_errno(ENOSYS, ENOSYS);
+    return pth_error(ENOSYS, ENOSYS);
 }
 
 int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize)
 {
     if (attr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if (!pth_attr_set((pth_attr_t)(*attr), PTH_ATTR_STACK_SIZE, (unsigned int)stacksize))
         return errno;
     return OK;
@@ -175,7 +175,7 @@
 int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize)
 {
     if (attr == NULL || stacksize == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if (!pth_attr_get((pth_attr_t)(*attr), PTH_ATTR_STACK_SIZE, (unsigned int *)stacksize))
         return errno;
     return OK;
@@ -184,7 +184,7 @@
 int pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr)
 {
     if (attr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if (!pth_attr_set((pth_attr_t)(*attr), PTH_ATTR_STACK_ADDR, (char *)stackaddr))
         return errno;
     return OK;
@@ -193,7 +193,7 @@
 int pthread_attr_getstackaddr(const pthread_attr_t *attr, void **stackaddr)
 {
     if (attr == NULL || stackaddr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if (!pth_attr_get((pth_attr_t)(*attr), PTH_ATTR_STACK_ADDR, (char **)stackaddr))
         return errno;
     return OK;
@@ -204,13 +204,13 @@
     int s;
 
     if (attr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if (detachstate == PTHREAD_CREATE_DETACHED)
         s = FALSE;
     else  if (detachstate == PTHREAD_CREATE_JOINABLE)
         s = TRUE;
     else
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if (!pth_attr_set((pth_attr_t)(*attr), PTH_ATTR_JOINABLE, s))
         return errno;
     return OK;
@@ -221,7 +221,7 @@
     int s;
 
     if (attr == NULL || detachstate == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if (!pth_attr_get((pth_attr_t)(*attr), PTH_ATTR_JOINABLE, &s))
         return errno;
     if (s == TRUE)
@@ -234,23 +234,23 @@
 int pthread_attr_setguardsize(pthread_attr_t *attr, int stacksize)
 {
     if (attr == NULL || stacksize < 0)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* not supported */
-    return_errno(ENOSYS, ENOSYS);
+    return pth_error(ENOSYS, ENOSYS);
 }
 
 int pthread_attr_getguardsize(const pthread_attr_t *attr, int *stacksize)
 {
     if (attr == NULL || stacksize == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* not supported */
-    return_errno(ENOSYS, ENOSYS);
+    return pth_error(ENOSYS, ENOSYS);
 }
 
 int pthread_attr_setname_np(pthread_attr_t *attr, char *name)
 {
     if (attr == NULL || name == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if (!pth_attr_set((pth_attr_t)(*attr), PTH_ATTR_NAME, name))
         return errno;
     return OK;
@@ -259,7 +259,7 @@
 int pthread_attr_getname_np(const pthread_attr_t *attr, char **name)
 {
     if (attr == NULL || name == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if (!pth_attr_get((pth_attr_t)(*attr), PTH_ATTR_NAME, name))
         return errno;
     return OK;
@@ -268,7 +268,7 @@
 int pthread_attr_setprio_np(pthread_attr_t *attr, int prio)
 {
     if (attr == NULL || (prio < PTH_PRIO_MIN || prio > PTH_PRIO_MAX))
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if (!pth_attr_set((pth_attr_t)(*attr), PTH_ATTR_PRIO, prio))
         return errno;
     return OK;
@@ -277,7 +277,7 @@
 int pthread_attr_getprio_np(const pthread_attr_t *attr, int *prio)
 {
     if (attr == NULL || prio == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if (!pth_attr_get((pth_attr_t)(*attr), PTH_ATTR_PRIO, prio))
         return errno;
     return OK;
@@ -295,16 +295,16 @@
 
     pthread_initialize();
     if (thread == NULL || start_routine == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if (pth_ctrl(PTH_CTRL_GETTHREADS) >= PTHREAD_THREADS_MAX)
-        return_errno(EAGAIN, EAGAIN);
+        return pth_error(EAGAIN, EAGAIN);
     if (attr != NULL)
         na = (pth_attr_t)(*attr);
     else
         na = PTH_ATTR_DEFAULT;
     *thread = (pthread_t)pth_spawn(na, start_routine, arg);
     if (*thread == NULL)
-        return_errno(EAGAIN, EAGAIN);
+        return pth_error(EAGAIN, EAGAIN);
     return OK;
 }
 
@@ -313,7 +313,7 @@
     pth_attr_t na;
 
     if (thread == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if ((na = pth_attr_of((pth_t)thread)) == NULL)
         return errno;
     if (!pth_attr_set(na, PTH_ATTR_JOINABLE, FALSE))
@@ -363,7 +363,7 @@
 {
     pthread_initialize();
     if (once_control == NULL || init_routine == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if (*once_control != 1)
         init_routine();
     *once_control = 1;
@@ -403,7 +403,7 @@
 int pthread_setconcurrency(int new_level)
 {
     if (new_level < 0)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     pthread_concurrency = new_level;
     return OK;
 }
@@ -515,13 +515,13 @@
 int pthread_setschedparam(pthread_t pthread, int policy, const struct sched_param *param)
 {
     /* not supported */
-    return_errno(ENOSYS, ENOSYS);
+    return pth_error(ENOSYS, ENOSYS);
 }
 
 int pthread_getschedparam(pthread_t pthread, int *policy, struct sched_param *param)
 {
     /* not supported */
-    return_errno(ENOSYS, ENOSYS);
+    return pth_error(ENOSYS, ENOSYS);
 }
 
 /*
@@ -577,7 +577,7 @@
     struct pthread_atfork_st *info;
 
     if (pthread_atfork_idx > PTH_ATFORK_MAX-1)
-        return_errno(ENOMEM, ENOMEM);
+        return pth_error(ENOMEM, ENOMEM);
     info = &pthread_atfork_info[pthread_atfork_idx++];
     info->prepare = prepare;
     info->parent  = parent;
@@ -597,7 +597,7 @@
 {
     pthread_initialize();
     if (attr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* nothing to do for us */
     return OK;
 }
@@ -605,7 +605,7 @@
 int pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
 {
     if (attr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* nothing to do for us */
     return OK;
 }
@@ -613,65 +613,65 @@
 int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *attr, int prioceiling)
 {
     if (attr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* not supported */
-    return_errno(ENOSYS, ENOSYS);
+    return pth_error(ENOSYS, ENOSYS);
 }
 
 int pthread_mutexattr_getprioceiling(pthread_mutexattr_t *attr, int *prioceiling)
 {
     if (attr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* not supported */
-    return_errno(ENOSYS, ENOSYS);
+    return pth_error(ENOSYS, ENOSYS);
 }
 
 int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr, int protocol)
 {
     if (attr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* not supported */
-    return_errno(ENOSYS, ENOSYS);
+    return pth_error(ENOSYS, ENOSYS);
 }
 
 int pthread_mutexattr_getprotocol(pthread_mutexattr_t *attr, int *protocol)
 {
     if (attr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* not supported */
-    return_errno(ENOSYS, ENOSYS);
+    return pth_error(ENOSYS, ENOSYS);
 }
 
 int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared)
 {
     if (attr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* not supported */
-    return_errno(ENOSYS, ENOSYS);
+    return pth_error(ENOSYS, ENOSYS);
 }
 
 int pthread_mutexattr_getpshared(pthread_mutexattr_t *attr, int *pshared)
 {
     if (attr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* not supported */
-    return_errno(ENOSYS, ENOSYS);
+    return pth_error(ENOSYS, ENOSYS);
 }
 
 int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type)
 {
     if (attr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* not supported */
-    return_errno(ENOSYS, ENOSYS);
+    return pth_error(ENOSYS, ENOSYS);
 }
 
 int pthread_mutexattr_gettype(pthread_mutexattr_t *attr, int *type)
 {
     if (attr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* not supported */
-    return_errno(ENOSYS, ENOSYS);
+    return pth_error(ENOSYS, ENOSYS);
 }
 
 /*
@@ -684,7 +684,7 @@
 
     pthread_initialize();
     if (mutex == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if ((m = (pth_mutex_t *)malloc(sizeof(pth_mutex_t))) == NULL)
         return errno;
     if (!pth_mutex_init(m))
@@ -696,7 +696,7 @@
 int pthread_mutex_destroy(pthread_mutex_t *mutex)
 {
     if (mutex == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     free(*mutex);
     *mutex = NULL;
     return OK;
@@ -705,29 +705,29 @@
 int pthread_mutex_setprioceiling(pthread_mutex_t *mutex, int prioceiling, int *old_ceiling)
 {
     if (mutex == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if (*mutex == PTHREAD_MUTEX_INITIALIZER)
         if (pthread_mutex_init(mutex, NULL) != OK)
             return errno;
     /* not supported */
-    return_errno(ENOSYS, ENOSYS);
+    return pth_error(ENOSYS, ENOSYS);
 }
 
 int pthread_mutex_getprioceiling(pthread_mutex_t *mutex, int *prioceiling)
 {
     if (mutex == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if (*mutex == PTHREAD_MUTEX_INITIALIZER)
         if (pthread_mutex_init(mutex, NULL) != OK)
             return errno;
     /* not supported */
-    return_errno(ENOSYS, ENOSYS);
+    return pth_error(ENOSYS, ENOSYS);
 }
 
 int pthread_mutex_lock(pthread_mutex_t *mutex)
 {
     if (mutex == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if (*mutex == PTHREAD_MUTEX_INITIALIZER)
         if (pthread_mutex_init(mutex, NULL) != OK)
             return errno;
@@ -739,7 +739,7 @@
 int pthread_mutex_trylock(pthread_mutex_t *mutex)
 {
     if (mutex == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if (*mutex == PTHREAD_MUTEX_INITIALIZER)
         if (pthread_mutex_init(mutex, NULL) != OK)
             return errno;
@@ -751,7 +751,7 @@
 int pthread_mutex_unlock(pthread_mutex_t *mutex)
 {
     if (mutex == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if (*mutex == PTHREAD_MUTEX_INITIALIZER)
         if (pthread_mutex_init(mutex, NULL) != OK)
             return errno;
@@ -768,7 +768,7 @@
 {
     pthread_initialize();
     if (attr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* nothing to do for us */
     return OK;
 }
@@ -776,7 +776,7 @@
 int pthread_rwlockattr_destroy(pthread_rwlockattr_t *attr)
 {
     if (attr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* nothing to do for us */
     return OK;
 }
@@ -784,17 +784,17 @@
 int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *attr, int pshared)
 {
     if (attr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* not supported */
-    return_errno(ENOSYS, ENOSYS);
+    return pth_error(ENOSYS, ENOSYS);
 }
 
 int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *attr, int *pshared)
 {
     if (attr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* not supported */
-    return_errno(ENOSYS, ENOSYS);
+    return pth_error(ENOSYS, ENOSYS);
 }
 
 /*
@@ -807,7 +807,7 @@
 
     pthread_initialize();
     if (rwlock == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if ((rw = (pth_rwlock_t *)malloc(sizeof(pth_rwlock_t))) == NULL)
         return errno;
     if (!pth_rwlock_init(rw))
@@ -819,7 +819,7 @@
 int pthread_rwlock_destroy(pthread_rwlock_t *rwlock)
 {
     if (rwlock == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     free(*rwlock);
     *rwlock = NULL;
     return OK;
@@ -828,7 +828,7 @@
 int pthread_rwlock_rdlock(pthread_rwlock_t *rwlock)
 {
     if (rwlock == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if (*rwlock == PTHREAD_RWLOCK_INITIALIZER)
         if (pthread_rwlock_init(rwlock, NULL) != OK)
             return errno;
@@ -840,7 +840,7 @@
 int pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock)
 {
     if (rwlock == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if (*rwlock == PTHREAD_RWLOCK_INITIALIZER)
         if (pthread_rwlock_init(rwlock, NULL) != OK)
             return errno;
@@ -852,7 +852,7 @@
 int pthread_rwlock_wrlock(pthread_rwlock_t *rwlock)
 {
     if (rwlock == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if (*rwlock == PTHREAD_RWLOCK_INITIALIZER)
         if (pthread_rwlock_init(rwlock, NULL) != OK)
             return errno;
@@ -864,7 +864,7 @@
 int pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock)
 {
     if (rwlock == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if (*rwlock == PTHREAD_RWLOCK_INITIALIZER)
         if (pthread_rwlock_init(rwlock, NULL) != OK)
             return errno;
@@ -876,7 +876,7 @@
 int pthread_rwlock_unlock(pthread_rwlock_t *rwlock)
 {
     if (rwlock == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if (*rwlock == PTHREAD_RWLOCK_INITIALIZER)
         if (pthread_rwlock_init(rwlock, NULL) != OK)
             return errno;
@@ -893,7 +893,7 @@
 {
     pthread_initialize();
     if (attr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* nothing to do for us */
     return OK;
 }
@@ -901,7 +901,7 @@
 int pthread_condattr_destroy(pthread_condattr_t *attr)
 {
     if (attr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* nothing to do for us */
     return OK;
 }
@@ -909,17 +909,17 @@
 int pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared)
 {
     if (attr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* not supported */
-    return_errno(ENOSYS, ENOSYS);
+    return pth_error(ENOSYS, ENOSYS);
 }
 
 int pthread_condattr_getpshared(pthread_condattr_t *attr, int *pshared)
 {
     if (attr == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     /* not supported */
-    return_errno(ENOSYS, ENOSYS);
+    return pth_error(ENOSYS, ENOSYS);
 }
 
 /*
@@ -932,7 +932,7 @@
 
     pthread_initialize();
     if (cond == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if ((cn = (pth_cond_t *)malloc(sizeof(pth_cond_t))) == NULL)
         return errno;
     if (!pth_cond_init(cn))
@@ -944,7 +944,7 @@
 int pthread_cond_destroy(pthread_cond_t *cond)
 {
     if (cond == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     free(*cond);
     *cond = NULL;
     return OK;
@@ -953,7 +953,7 @@
 int pthread_cond_broadcast(pthread_cond_t *cond)
 {
     if (cond == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if (*cond == PTHREAD_COND_INITIALIZER)
         if (pthread_cond_init(cond, NULL) != OK)
             return errno;
@@ -965,7 +965,7 @@
 int pthread_cond_signal(pthread_cond_t *cond)
 {
     if (cond == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if (*cond == PTHREAD_COND_INITIALIZER)
         if (pthread_cond_init(cond, NULL) != OK)
             return errno;
@@ -977,7 +977,7 @@
 int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
 {
     if (cond == NULL || mutex == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if (*cond == PTHREAD_COND_INITIALIZER)
         if (pthread_cond_init(cond, NULL) != OK)
             return errno;
@@ -996,13 +996,13 @@
     static pth_key_t ev_key = PTH_KEY_INIT;
 
     if (cond == NULL || mutex == NULL || abstime == NULL)
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
 #ifdef __amigaos__
     if (abstime->ts_sec < 0 || abstime->ts_nsec < 0 || abstime->ts_nsec >= 1000000000)
 #else
     if (abstime->tv_sec < 0 || abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)
 #endif
-        return_errno(EINVAL, EINVAL);
+        return pth_error(EINVAL, EINVAL);
     if (*cond == PTHREAD_COND_INITIALIZER)
         if (pthread_cond_init(cond, NULL) != OK)
             return errno;

CVSTrac 2.0.1