diff -ruN fsupthreads-3.14.orig/include/pthread/signal.h fsupthreads-3.14/include/pthread/signal.h
--- fsupthreads-3.14.orig/include/pthread/signal.h	2000-11-08 08:29:37.000000000 -0500
+++ fsupthreads-3.14/include/pthread/signal.h	2008-06-03 09:52:47.000000000 -0400
@@ -155,11 +155,13 @@
 #ifndef TIMEVAL_TO_TIMESPEC
 #if !defined(__linux__) || !defined(_ASMi386_SIGCONTEXT_H)
 #if !defined(__SI_MAX_SIZE) && !defined(_STRUCT_TIMESPEC)
+#ifndef _TIMESPEC
 struct timespec {
   time_t tv_sec;
   long   tv_nsec;
 };
 #endif
+#endif
 #endif /* !defined(__linux) || !defined(SIGCLD) */
 #endif /* !TIMEVAL_TO_TIMESPEC */
 #else /* CLOCK_REALTIME */
diff -ruN fsupthreads-3.14.orig/include/pthread.h fsupthreads-3.14/include/pthread.h
--- fsupthreads-3.14.orig/include/pthread.h	2000-11-08 08:29:13.000000000 -0500
+++ fsupthreads-3.14/include/pthread.h	2008-06-03 09:53:59.000000000 -0400
@@ -202,7 +202,8 @@
   0,                 /* owner */		\
   1,                 /* flags */		\
   0,                 /* prioceiling */		\
-  PTHREAD_PRIO_NONE  /* protocol */		\
+  PTHREAD_PRIO_NONE, /* protocol */		\
+  0                  /* prev_max_ceiling_prio */\
 }
 #else
 #define PTHREAD_MUTEX_INITIALIZER {		\
@@ -445,6 +446,21 @@
 #define SIGLONGJMP_CONST
 #elif defined (__linux__)
 #define IO_SIZE_T size_t
+#elif defined (SCO5_NP)
+#	define IO_SIZE_T size_t
+#	undef SIGSUSPEND_CONST
+#	undef SIGACTION_CONST
+#	undef SIGPROCMASK_CONST
+#	undef SIGWAIT_CONST
+#	undef LONGJMP_CONST
+#	undef SIGLONGJMP_CONST
+
+#	define SIGSUSPEND_CONST const
+#	define SIGACTION_CONST const
+#	define SIGPROCMASK_CONST const
+#	define SIGWAIT_CONST const
+#	define LONGJMP_CONST
+#	define SIGLONGJMP_CONST
 #elif defined (_M_UNIX)
 #define IO_SIZE_T size_t
 #else
@@ -486,23 +502,23 @@
  
 extern pthread_t pthread_self           _C_PROTOTYPE ((void));
 extern void pthread_init                _C_PROTOTYPE ((void));
-extern int pthread_create               _C_PROTOTYPE((pthread_t *__thread,
-                                                      pthread_attr_t *__attr,
-                                                      pthread_func_t __func,
-                                                      any_t __arg));
+extern int pthread_create               _C_PROTOTYPE((pthread_t *thread,
+                                                      pthread_attr_t *attr,
+                                                      pthread_func_t func,
+                                                      any_t arg));
 extern int pthread_equal                _C_PROTOTYPE((pthread_t __t1,
                                                       pthread_t __t2));
-extern int pthread_detach               _C_PROTOTYPE((pthread_t __thread));
-extern int pthread_join                 _C_PROTOTYPE((pthread_t __thread,
+extern int pthread_detach               _C_PROTOTYPE((pthread_t thread));
+extern int pthread_join                 _C_PROTOTYPE((pthread_t thread,
                                                       any_t *__status));
 extern int sched_yield                  _C_PROTOTYPE((void));
 extern void pthread_exit                _C_PROTOTYPE((any_t __status));
 extern int pthread_attr_init            _C_PROTOTYPE((pthread_attr_t *__attr));
 extern int pthread_attr_destroy         _C_PROTOTYPE((pthread_attr_t *__attr));
-extern int pthread_getschedparam        _C_PROTOTYPE((pthread_t __thread,
+extern int pthread_getschedparam        _C_PROTOTYPE((pthread_t thread,
 						      int *__policy,
                                                       struct sched_param *__param));
-extern int pthread_setschedparam        _C_PROTOTYPE((pthread_t __thread,
+extern int pthread_setschedparam        _C_PROTOTYPE((pthread_t thread,
 						      int __policy,
                                                       struct sched_param *__param));
 extern int pthread_attr_setstacksize    _C_PROTOTYPE((pthread_attr_t *__attr,
@@ -598,9 +614,9 @@
 #undef raise
 #endif
 extern int raise               _C_PROTOTYPE((int __sig));
-extern int pthread_kill        _C_PROTOTYPE((pthread_t __thread,
+extern int pthread_kill        _C_PROTOTYPE((pthread_t thread,
                                              int __sig));
-extern int pthread_cancel      _C_PROTOTYPE((pthread_t __thread));
+extern int pthread_cancel      _C_PROTOTYPE((pthread_t thread));
 extern int pthread_setcancelstate _C_PROTOTYPE((int __state, int *__oldstate));
 extern int pthread_setcanceltype  _C_PROTOTYPE((int __type, int *__oldtype));
 extern void pthread_testcancel _C_PROTOTYPE((void));
diff -ruN fsupthreads-3.14.orig/malloc/Makefile fsupthreads-3.14/malloc/Makefile
--- fsupthreads-3.14.orig/malloc/Makefile	1999-07-26 05:35:41.000000000 -0400
+++ fsupthreads-3.14/malloc/Makefile	2008-06-03 09:52:47.000000000 -0400
@@ -42,8 +42,12 @@
 	then \
 	  $(AR) crv $@ $(objects) ; \
 	  $(RANLIB) $@ ; \
+	elif (test -x `which ranlib`) ; \
+	then \
+	  $(AR) crv $@ $(objects) ; \
+	  `which ranlib` $@ ; \
 	else \
-	  $(AR) crv $@ `lorder *.o | tsort` ; \
+	  $(AR) crv $@ `lorder *.o | grep -v gmalloc.o | tsort` ; \
 	fi
 
 $(objects): $(headers)
diff -ruN fsupthreads-3.14.orig/src/Makefile.SC5 fsupthreads-3.14/src/Makefile.SC5
--- fsupthreads-3.14.orig/src/Makefile.SC5	2000-11-08 08:28:45.000000000 -0500
+++ fsupthreads-3.14/src/Makefile.SC5	2008-06-03 09:52:47.000000000 -0400
@@ -109,8 +109,8 @@
 #INC2 = -I/sim/usr/include
 
 #install directory locations
-INSTALL_INCLUDE = /usr/local/include
-INSTALL_LIBS = /usr/local/lib
+INSTALL_INCLUDE = /usr/include
+INSTALL_LIBS = /usr/lib
 #for Logware
 #INSTALL_INCLUDE = /usr/contrib/include
 #INSTALL_LIBS = /usr/contrib/lib
@@ -177,7 +177,7 @@
 
 #for Gnu C compiler
 CC = gcc -melf -fpic
-CCAS = /usr/progressive/bin/gcc -melf -fpic
+CCAS = gcc -melf -fpic
 SOFLAGS = -G
 #COMP_ASM = $(CC) $(INC1) $(INC2) $(FBSD_ASM_INC) $(CFLAGS) -c $*.S
 COMP_ASM = $(CCAS) $(INC1) $(INC2) $(FBSD_ASM_INC) $(CFLAGS) -c $*.S
diff -ruN fsupthreads-3.14.orig/src/io.c fsupthreads-3.14/src/io.c
--- fsupthreads-3.14.orig/src/io.c	2000-11-08 08:28:43.000000000 -0500
+++ fsupthreads-3.14/src/io.c	2008-06-03 09:52:47.000000000 -0400
@@ -101,12 +101,12 @@
 
 #if !defined(__FreeBSD__) && !defined(SVR4)
 
-#ifndef _M_UNIX
-
 #ifndef FASYNC
 #define FASYNC 0
 #endif
 
+#ifndef _M_UNIX
+
 /*------------------------------------------------------------*/
 /*
  * pthread_fds_set_async - set file descriptors to async IO
@@ -1113,10 +1113,12 @@
   mode = fcntl(fd, F_GETFL, 0);
   if (fcntl(fd, F_SETFL, (mode | O_NDELAY | FASYNC)) < 0)
     return (-1);
+#ifdef F_SETOWN
   if (fcntl(fd, F_SETOWN, getpid()) < 0) {
     fcntl (fd, F_SETFL, mode);
     return(-1);
   }
+#endif
 
   while (TRUE) {
 #ifdef DEBUG
@@ -1185,10 +1187,13 @@
   mode = fcntl(fd, F_GETFL, 0);
   if (fcntl(fd, F_SETFL, (mode | O_NDELAY | FASYNC)) < 0)
     return (-1);
+
+#ifdef F_SETOWN
   if (fcntl(fd, F_SETOWN, getpid()) < 0) {
     fcntl (fd, F_SETFL, mode);
     return(-1);
   }
+#endif
 
   while (TRUE) {
 #ifdef DEBUG
@@ -1255,10 +1260,13 @@
   mode = fcntl(fd, F_GETFL, 0);
   if (fcntl(fd, F_SETFL, (mode | O_NDELAY | FASYNC)) < 0)
     return (-1);
+
+#ifdef F_SETOWN
   if (fcntl(fd, F_SETOWN, getpid()) < 0) {
     fcntl (fd, F_SETFL, mode);
     return(-1);
   }
+#endif
 
   while (TRUE) {
 #ifdef DEBUG
@@ -1325,10 +1333,13 @@
   mode = fcntl(fd, F_GETFL, 0);
   if (fcntl(fd, F_SETFL, (mode | O_NDELAY | FASYNC)) < 0)
     return (-1);
+
+#ifdef F_SETOWN
   if (fcntl(fd, F_SETOWN, getpid()) < 0) {
     fcntl (fd, F_SETFL, mode);
     return(-1);
   }
+#endif
 
   while (TRUE) {
 #ifdef DEBUG
@@ -2015,10 +2026,13 @@
   mode = fcntl(s, F_GETFL, 0);
   if (fcntl(s, F_SETFL, (mode | O_NDELAY | FASYNC)) < 0)
     return (-1);
+
+#ifdef F_SETOWN
   if (fcntl(s, F_SETOWN, getpid()) < 0) {
     fcntl (s, F_SETFL, mode);
     return(-1);
   }
+#endif
 
   while (TRUE) {
 #ifdef DEBUG
@@ -2175,7 +2189,11 @@
      socklen_t *fromlen;
 #else /* !__linux__ */
      int s;
+#  ifdef SCO5
+     void *buf;
+#  else
      char *buf;
+#  endif
      int len;
      int flags;
      struct sockaddr *from;
@@ -2193,6 +2211,9 @@
 #ifdef DEBUG
   int retry = 0;
 #endif
+#ifdef USE_POLL
+  struct pollfd fds[1];
+#endif
 
 #if !defined(__FreeBSD__) && !defined(_M_UNIX) && !defined(__linux__) && !defined(__dos__)
   ACCESS_STACK;
@@ -2212,10 +2233,13 @@
   mode = fcntl(s, F_GETFL, 0);
   if (fcntl(s, F_SETFL, (mode | O_NDELAY | FASYNC)) < 0)
     return (-1);
+
+#ifdef F_SETOWN
   if (fcntl(s, F_SETOWN, getpid()) < 0) {
     fcntl (s, F_SETFL, mode);
     return(-1);
   }
+#endif
 
   while (TRUE) {
 #ifdef DEBUG
@@ -2241,6 +2265,15 @@
     SET_KERNEL_FLAG; /* No preemption */
     p = mac_pthread_self();
 
+#ifdef USE_POLL
+    fds[0].fd = s;
+    fds[0].events = POLLIN;
+    fds[0].revents = 0;
+    p->nfds = 1;
+    p->fds = fds;
+    p->wait_on_select = TRUE;
+    gpoll_fds_union(1, fds);
+#else
     gwidth = MAX(gwidth, s+1);
     p->width = s+1;
     pthread_fds_zero(&(p->readfds), p->width);
@@ -2248,6 +2281,7 @@
     FD_SET(s, &greadfds);
     pthread_fds_zero(&(p->writefds), p->width);
     pthread_fds_zero(&(p->exceptfds), p->width);
+#endif
 
     sigaddset(&p->sigwaitset, AIO_SIG);
     p->state &= ~T_RUNNING;
@@ -2276,6 +2310,13 @@
      int flags;
      __CONST_SOCKADDR_ARG to;
      socklen_t tolen;
+#elif defined(SCO5)
+     int s;
+     const void *msg;
+     int len;
+     int flags;
+     const struct sockaddr *to;
+     int tolen;
 #else /* !__linux__ */
      int s;
      char *msg;
@@ -2288,6 +2329,9 @@
   int mode;
   pthread_t p;
   int result;
+#ifdef USE_POLL
+  struct pollfd fds[1];
+#endif
 
 #if !defined(__FreeBSD__) && !defined(_M_UNIX) && !defined(__linux__) && !defined(__dos__)
   ACCESS_STACK;
@@ -2307,10 +2351,13 @@
   mode = fcntl(s, F_GETFL, 0);
   if (fcntl(s, F_SETFL, (mode | O_NDELAY | FASYNC)) < 0)
     return (-1);
+
+#ifdef F_SETOWN
   if (fcntl(s, F_SETOWN, getpid()) < 0) {
     fcntl (s, F_SETFL, mode);
     return(-1);
   }
+#endif
 
   while (TRUE) {
 #ifdef DEBUG
@@ -2332,6 +2379,15 @@
     SET_KERNEL_FLAG; /* No preemption */
     p = mac_pthread_self();
 
+#ifdef USE_POLL
+    fds[0].fd = s;
+    fds[0].events = POLLOUT;
+    fds[0].revents = 0;
+    p->nfds = 1;
+    p->fds = fds;
+    p->wait_on_select = TRUE;
+    gpoll_fds_union(1, fds);
+#else
     gwidth = MAX(gwidth, s+1);
     p->width = s+1;
     pthread_fds_zero(&(p->readfds), p->width);
@@ -2339,6 +2395,7 @@
     FD_SET(s, &(p->writefds));
     FD_SET(s, &gwritefds);
     pthread_fds_zero(&(p->exceptfds), p->width);
+#endif
 
     sigaddset(&p->sigwaitset, AIO_SIG);
     p->state &= ~T_RUNNING;
diff -ruN fsupthreads-3.14.orig/src/p_aux.S fsupthreads-3.14/src/p_aux.S
--- fsupthreads-3.14.orig/src/p_aux.S	2000-11-08 08:28:43.000000000 -0500
+++ fsupthreads-3.14/src/p_aux.S	2008-06-03 09:52:47.000000000 -0400
@@ -50,6 +50,7 @@
 #define NAME(x) x
 #else
 #if defined(__FreeBSD__) || defined(_M_UNIX) || defined(__linux__) || defined (__dos__)
+#define NAME(x) x
 #else
 #include <sparc/asm_linkage.h>
 #ifdef NAME	
diff -ruN fsupthreads-3.14.orig/src/pthread.c fsupthreads-3.14/src/pthread.c
--- fsupthreads-3.14.orig/src/pthread.c	2000-11-08 08:28:41.000000000 -0500
+++ fsupthreads-3.14/src/pthread.c	2008-06-03 09:52:47.000000000 -0400
@@ -137,7 +137,7 @@
 #ifdef MALLOC_DEBUG
   pthread_malloc_debug_init();
 #endif
-#endif;
+#endif
 
 #ifdef SOLARIS
   /*
@@ -603,8 +603,10 @@
   if (t->state & T_RUNNING) {
     pthread_pending_sigaction.func = pthread_suspend_internal;
     pthread_pending_sigaction.arg = t;
+#ifdef TDI_SUPPORT
     /* issue a SIGALRM to force a suspend on the current thread, if requested */
     __pthread_debug_TDI_ignored_signals |= 0x1 << (SIGALRM-1);
+#endif
   }
   else
     pthread_suspend_internal(t);
diff -ruN fsupthreads-3.14.orig/src/sco/io.S fsupthreads-3.14/src/sco/io.S
--- fsupthreads-3.14.orig/src/sco/io.S	2000-11-08 08:29:54.000000000 -0500
+++ fsupthreads-3.14/src/sco/io.S	2008-06-03 09:52:47.000000000 -0400
@@ -49,6 +49,26 @@
 	ret
         END(write)
 
+	.globl	NAME(readv)
+NAME(readv):
+        movl    $121,%eax
+        lcall   $7, $0
+	jae	1f
+	SET_ERRNO()
+1:
+	ret
+        END(readv)
+
+	.globl NAME(writev)
+NAME(writev):
+        movl    $122,%eax
+        lcall   $7, $0
+	jae	1f
+	SET_ERRNO()
+1:
+	ret
+        END(writev)
+
 	.globl NAME(ioctl)
 NAME(ioctl):
         movl    $0x36,%eax
diff -ruN fsupthreads-3.14.orig/src/sco/signal.h fsupthreads-3.14/src/sco/signal.h
--- fsupthreads-3.14.orig/src/sco/signal.h	2000-11-08 08:29:54.000000000 -0500
+++ fsupthreads-3.14/src/sco/signal.h	2008-06-03 09:52:47.000000000 -0400
@@ -48,5 +48,5 @@
 };
 #endif 
 
-#endif /* /* !_SCO_SIGNAL_H_ */ */
+#endif /* !_SCO_SIGNAL_H_ */
 
diff -ruN fsupthreads-3.14.orig/src/signal.c fsupthreads-3.14/src/signal.c
--- fsupthreads-3.14.orig/src/signal.c	2000-11-08 08:28:42.000000000 -0500
+++ fsupthreads-3.14/src/signal.c	2008-06-03 09:52:47.000000000 -0400
@@ -2962,6 +2962,7 @@
       gfds[gnfds].events = fds[i].events;
       gnfds++;
 next:
+	; /* Do nothing */
    }
 }
 
diff -ruN fsupthreads-3.14.orig/src/signal_func.c fsupthreads-3.14/src/signal_func.c
--- fsupthreads-3.14.orig/src/signal_func.c	2000-11-08 08:28:42.000000000 -0500
+++ fsupthreads-3.14/src/signal_func.c	2008-06-03 09:52:47.000000000 -0400
@@ -46,9 +46,9 @@
   act.sa_handler = handler;
 #if defined(SOLARIS) || defined(__dos__) || defined(__USE_POSIX)
   sigemptyset(&act.sa_mask);
-#else !SOLARIS || !__dos__
+#else /* !SOLARIS || !__dos__ */
   act.sa_mask = 0;
-#endif !SOLARIS
+#endif /* !SOLARIS */
 #if defined(__linux__) || defined(__FreeBSD__) || defined(_M_UNIX)
   act.sa_flags = SA_ONESHOT | SA_NOMASK;
 #endif
@@ -57,7 +57,7 @@
 #endif
 #ifdef __linux__ 
   act.sa_restorer = NULL;
-#endif __linux__ || __FreeBSD__ || _M_UNIX
+#endif /* __linux__ || __FreeBSD__ || _M_UNIX */
   if (!sigaction(sig, &act, (struct sigaction *) NULL))
     return(handler);
   else
diff -ruN fsupthreads-3.14.orig/src/tmp fsupthreads-3.14/src/tmp
--- fsupthreads-3.14.orig/src/tmp	1969-12-31 19:00:00.000000000 -0500
+++ fsupthreads-3.14/src/tmp	2008-06-03 09:52:47.000000000 -0400
@@ -0,0 +1 @@
+ssize_t writev __P((int filedes, const struct iovec *iov, int iovcnt));
diff -ruN fsupthreads-3.14.orig/src/wait.c fsupthreads-3.14/src/wait.c
--- fsupthreads-3.14.orig/src/wait.c	2000-11-08 08:28:43.000000000 -0500
+++ fsupthreads-3.14/src/wait.c	2008-06-03 09:52:47.000000000 -0400
@@ -52,9 +52,9 @@
       pthread_access_dummy = 0; \
   MACRO_END
 
-#else /* /* !STACK_CHECK || !SIGNAL_STACK */ */
+#else /* !STACK_CHECK || !SIGNAL_STACK */
 #define ACCESS_STACK
-#endif /* /* !STACK_CHECK || !SIGNAL_STACK */ */
+#endif /* !STACK_CHECK || !SIGNAL_STACK */
 
 #if defined(SCO5)
 #include <sys/wait.h>
@@ -174,4 +174,4 @@
 {
 	return(waitpid((pid_t)-1, (int *)status, 0));
 }
-#endif /* /* SCO5 */ */
+#endif /* SCO5 */

