From 1b5451d61952b918f892d4a8792ebae4bd8bc783 Mon Sep 17 00:00:00 2001
From: Kurt Zeilenga <kurt@openldap.org>
Date: Fri, 14 Aug 1998 20:12:02 +0000
Subject: [PATCH] Added patch to support LWP under SunOS 5.6

---
 include/lthread.h             | 6 ++++++
 libraries/liblber/encode.c    | 2 +-
 libraries/liblthread/thread.c | 4 ++++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/include/lthread.h b/include/lthread.h
index d712a5e593..d3fd3d0ec6 100644
--- a/include/lthread.h
+++ b/include/lthread.h
@@ -99,9 +99,11 @@ typedef void	*(*VFP)();
 /* sunos5 threads are preemptive */
 #define PTHREAD_PREEMPTIVE	1
 
+#if !defined(__SunOS_5_6)
 /* thread attributes and thread type */
 typedef int		pthread_attr_t;
 typedef thread_t	pthread_t;
+#endif /* ! sunos56 */
 
 /* default attr states */
 #define pthread_mutexattr_default	NULL
@@ -114,17 +116,21 @@ typedef thread_t	pthread_t;
 #define PTHREAD_SCOPE_PROCESS   0
 #define PTHREAD_SCOPE_SYSTEM    THR_BOUND
 
+#if !defined(__SunOS_5_6)
 /* mutex attributes and mutex type */
 typedef int	pthread_mutexattr_t;
 typedef mutex_t	pthread_mutex_t;
+#endif /* ! sunos56 */
 
 /* mutex and condition variable scope - process or system */
 #define PTHREAD_SHARE_PRIVATE   USYNC_THREAD
 #define PTHREAD_SHARE_PROCESS   USYNC_PROCESS
 
+#if !defined(__SunOS_5_6)
 /* condition variable attributes and condition variable type */
 typedef int     pthread_condattr_t;
 typedef cond_t	pthread_cond_t;
+#endif /* ! sunos56 */
 
 #else /* end sunos5 */
 
diff --git a/libraries/liblber/encode.c b/libraries/liblber/encode.c
index d6b1304d25..cb9e30ffa0 100644
--- a/libraries/liblber/encode.c
+++ b/libraries/liblber/encode.c
@@ -24,7 +24,7 @@
 #include <malloc.h>
 #endif
 #endif /* next || vms */
-#if defined( BC31 ) || defined( _WIN32 )
+#if defined( BC31 ) || defined( _WIN32 ) 
 #include <stdarg.h>
 #else /* BC31 || _WIN32 */
 #include <varargs.h>
diff --git a/libraries/liblthread/thread.c b/libraries/liblthread/thread.c
index f6e516f505..8faf872dc6 100644
--- a/libraries/liblthread/thread.c
+++ b/libraries/liblthread/thread.c
@@ -328,6 +328,7 @@ pthread_cond_broadcast( pthread_cond_t *cv )
  *                                                                     *
  ***********************************************************************/
 
+#if !defined(__SunOS_5_6)
 int
 pthread_attr_init( pthread_attr_t *attr )
 {
@@ -367,6 +368,7 @@ pthread_create(
 {
 	return( thr_create( NULL, 0, func, arg, attr, tid ) );
 }
+#endif /* ! sunos56 */
 
 void
 pthread_yield()
@@ -374,6 +376,7 @@ pthread_yield()
 	thr_yield();
 }
 
+#if !defined(__SunOS_5_6)
 void
 pthread_exit()
 {
@@ -452,6 +455,7 @@ pthread_cond_broadcast( pthread_cond_t *cv )
 {
 	return( cond_broadcast( cv ) );
 }
+#endif /* ! sunos56 */
 
 
 #else /* end sunos5 threads */
-- 
GitLab