]> git.sur5r.net Git - openldap/commitdiff
ITS#6669
authorQuanah Gibson-Mount <quanah@openldap.org>
Mon, 3 Jan 2011 21:36:58 +0000 (21:36 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 3 Jan 2011 21:36:58 +0000 (21:36 +0000)
CHANGES
configure
configure.in
include/ldap_int_thread.h
include/portable.hin
libraries/libldap_r/Makefile.in
libraries/libldap_r/thr_lwp.c [deleted file]

diff --git a/CHANGES b/CHANGES
index db7d04c192aedf7668125ab9a1e5b5303390a101..43af3c9c69a7f3d29b73da36df0830a2e52a194f 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -49,6 +49,7 @@ OpenLDAP 2.4.24 Engineering
                Added support for [unsigned] long long (ITS#6622)
                Fixed slapd-tester EOF handling (ITS#6723)
                Fixed slapd-tesster filter initialization (ITS#6735)
+               Removed antiquated SunOS LWP support (ITS#6669)
        Documentation
                admin24 guide typo fixes (ITS#6609)
                ldap_open(3) document ldap_set_urllist_proc (ITS#6601)
index 429778a9bb09e634522ec6705dba90de39e0b483..e77d876b5812aa7761edf638bf388d9ed24aa9de 100755 (executable)
--- a/configure
+++ b/configure
@@ -19692,75 +19692,6 @@ done
 
                fi
        fi
-
-               for ac_header in lwp/lwp.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "lwp/lwp.h" "ac_cv_header_lwp_lwp_h" "$ac_includes_default"
-if test "x$ac_cv_header_lwp_lwp_h" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LWP_LWP_H 1
-_ACEOF
-
-fi
-
-done
-
-       if test $ac_cv_header_lwp_lwp_h = yes ; then
-               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lwp_create in -llwp" >&5
-$as_echo_n "checking for lwp_create in -llwp... " >&6; }
-if test "${ac_cv_lib_lwp_lwp_create+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-llwp  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char lwp_create ();
-int
-main ()
-{
-return lwp_create ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_lwp_lwp_create=yes
-else
-  ac_cv_lib_lwp_lwp_create=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lwp_lwp_create" >&5
-$as_echo "$ac_cv_lib_lwp_lwp_create" >&6; }
-if test "x$ac_cv_lib_lwp_lwp_create" = x""yes; then :
-  have_lwp=yes
-else
-  have_lwp=no
-fi
-
-
-               if test $have_lwp = yes ; then
-
-$as_echo "#define HAVE_LWP 1" >>confdefs.h
-
-                       LTHREAD_LIBS="$LTHREAD_LIBS -llwp"
-                       ol_link_threads=lwp
-
-                       if test $ol_with_yielding_select = auto ; then
-                               ol_with_yielding_select=no
-                       fi
-               fi
-       fi
        ;;
 esac
 
@@ -19842,18 +19773,6 @@ _ACEOF
 
 fi
 
-done
-
-       for ac_header in lwp/lwp.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "lwp/lwp.h" "ac_cv_header_lwp_lwp_h" "$ac_includes_default"
-if test "x$ac_cv_header_lwp_lwp_h" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LWP_LWP_H 1
-_ACEOF
-
-fi
-
 done
 
        for ac_header in thread.h synch.h
index 2051b1cecbc48bc18009db096c02b7f6dc8bd5da..59bf06ca9c6b1c62259bd14ea6805fe5428be53a 100644 (file)
@@ -1687,23 +1687,6 @@ case $ol_with_threads in auto | yes | lwp)
                        )
                fi
        fi
-
-       dnl check for SunOS4 LWP
-       AC_CHECK_HEADERS(lwp/lwp.h)
-       if test $ac_cv_header_lwp_lwp_h = yes ; then
-               AC_CHECK_LIB(lwp, lwp_create, [have_lwp=yes], [have_lwp=no])
-
-               if test $have_lwp = yes ; then
-                       AC_DEFINE(HAVE_LWP,1,
-                               [if you have SunOS LWP package])
-                       LTHREAD_LIBS="$LTHREAD_LIBS -llwp"
-                       ol_link_threads=lwp
-
-                       if test $ol_with_yielding_select = auto ; then
-                               ol_with_yielding_select=no
-                       fi
-               fi
-       fi
        ;;
 esac
 
@@ -1723,7 +1706,6 @@ if test $ol_with_threads = manual ; then
        OL_HEADER_LINUX_THREADS
 
        AC_CHECK_HEADERS(mach/cthreads.h)
-       AC_CHECK_HEADERS(lwp/lwp.h)
        AC_CHECK_HEADERS(thread.h synch.h)
 fi
 
index 759c951e22272946d806cff073acf35f4981f01d..d2430f31ac967460b15e9933327702d301fc8fde 100644 (file)
@@ -145,31 +145,6 @@ typedef thread_key_t       ldap_int_thread_key_t;
 
 LDAP_END_DECL
 
-#elif defined( HAVE_LWP )
-/*************************************
- *                                   *
- * thread definitions for SunOS LWP  *
- *                                   *
- *************************************/
-
-#include <lwp/lwp.h>
-#include <lwp/stackdep.h>
-#define LDAP_THREAD_HAVE_SLEEP 1
-
-LDAP_BEGIN_DECL
-
-typedef thread_t               ldap_int_thread_t;
-typedef mon_t                  ldap_int_thread_mutex_t;
-struct ldap_int_thread_lwp_cv {
-       int             lcv_created;
-       cv_t            lcv_cv;
-};
-typedef struct ldap_int_thread_lwp_cv ldap_int_thread_cond_t;
-
-#define HAVE_REENTRANT_FUNCTIONS 1
-
-LDAP_END_DECL
-
 #elif defined(HAVE_NT_THREADS)
 /*************************************
  *                                   *
index 64b81ce9381bae7c11224552b99aae57f032d598..b372192b1e6391debeae9c8b921acc1620816c5a 100644 (file)
 /* Define to 1 if you have the <ltdl.h> header file. */
 #undef HAVE_LTDL_H
 
-/* if you have SunOS LWP package */
-#undef HAVE_LWP
-
-/* Define to 1 if you have the <lwp/lwp.h> header file. */
-#undef HAVE_LWP_LWP_H
-
 /* define if you have Mach Cthreads */
 #undef HAVE_MACH_CTHREADS
 
index 1fc166d48dc266608c118263f7bfcfb33bf02c1b..334d1fe43b390799c1a4e4aca01ecc4b8e97aad5 100644 (file)
@@ -32,10 +32,10 @@ XXSRCS    = apitest.c test.c \
        turn.c ppolicy.c dds.c txn.c ldap_sync.c stctrl.c \
        assertion.c deref.c
 SRCS   = threads.c rdwr.c rmutex.c tpool.c rq.c \
-       thr_posix.c thr_cthreads.c thr_thr.c thr_lwp.c thr_nt.c \
+       thr_posix.c thr_cthreads.c thr_thr.c thr_nt.c \
        thr_pth.c thr_stub.c thr_debug.c
 OBJS   = threads.lo rdwr.lo rmutex.lo tpool.lo  rq.lo \
-       thr_posix.lo thr_cthreads.lo thr_thr.lo thr_lwp.lo thr_nt.lo \
+       thr_posix.lo thr_cthreads.lo thr_thr.lo thr_nt.lo \
        thr_pth.lo thr_stub.lo thr_debug.lo \
        bind.lo open.lo result.lo error.lo compare.lo search.lo \
        controls.lo messages.lo references.lo extended.lo cyrus.lo \
diff --git a/libraries/libldap_r/thr_lwp.c b/libraries/libldap_r/thr_lwp.c
deleted file mode 100644 (file)
index 515ca38..0000000
+++ /dev/null
@@ -1,378 +0,0 @@
-/* thr_lwp.c - wrappers around SunOS LWP threads */
-/* $OpenLDAP$ */
-/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
- *
- * Copyright 1998-2010 The OpenLDAP Foundation.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted only as authorized by the OpenLDAP
- * Public License.
- *
- * A copy of this license is available in file LICENSE in the
- * top-level directory of the distribution or, alternatively, at
- * <http://www.OpenLDAP.org/license.html>.
- */
-
-/* BUGS:
- * - slurpd calls the get_stack/free_stack functions. Should be fixed, so
- *   they can become static.
- */
-
-#include "portable.h"
-
-#if defined( HAVE_LWP )
-
-/*************
- *           *
- * SunOS LWP *
- *           *
- *************/
-
-/* This implementation NEEDS WORK.   It currently does not compile */
-
-#include <stdio.h>
-
-#include <ac/time.h>
-#include <ac/socket.h>
-
-#include "ldap-int.h"
-
-#include "ldap_pvt_thread.h" /* Get the thread interface */
-#define LDAP_THREAD_IMPLEMENTATION
-#include "ldap_thr_debug.h"     /* May rename the symbols defined below */
-
-#include <lwp/lwp.h>
-#include <lwp/stackdep.h>
-
-#define MAX_STACK      51200
-#define MAX_THREADS    20
-
-/*
- * Initialize LWP by spinning of a schedular
- */
-int
-ldap_int_thread_initialize( void )
-{
-       thread_t                tid;
-       stkalign_t              *stack;
-       int                     stackno;
-
-       if (( stack = get_stack( &stackno )) == NULL ) {
-               return -1;
-       }
-
-       lwp_create( &tid, lwp_scheduler, MINPRIO, 0, stack, 1, stackno );
-       return 0;
-}
-
-int
-ldap_int_thread_destroy( void )
-{
-       /* need to destroy lwp_scheduler thread and clean up private
-               variables */
-       return 0;
-}
-
-struct stackinfo {
-       int             stk_inuse;
-       stkalign_t      *stk_stack;
-};
-
-static struct stackinfo        *stacks;
-
-static stkalign_t * ldap_int_thread_get_stack( int *stacknop )
-{
-       int     i;
-
-       if ( stacks == NULL ) {
-               stacks = (struct stackinfo *) LDAP_CALLOC( 1, MAX_THREADS *
-                   sizeof(struct stackinfo) );
-
-               if( stacks == NULL ) {
-                       Debug( LDAP_DEBUG_ANY, "stacks allocation failed",
-                               0, 0, 0 );
-                       return NULL;
-               }
-       }
-
-       for ( i = 0; i < MAX_THREADS; i++ ) {
-               if ( stacks[i].stk_inuse == 0 ) {
-                       break;
-               }
-       }
-
-       if ( i == MAX_THREADS ) {
-               Debug( LDAP_DEBUG_ANY,
-                   "no more stacks (max %d) - increase MAX_THREADS for more",
-                   MAX_THREADS, 0, 0 );
-               return( NULL );
-       }
-
-       if ( stacks[i].stk_stack == NULL ) {
-               stacks[i].stk_stack = (stkalign_t *) LDAP_MALLOC(
-                   (MAX_STACK / sizeof(stkalign_t) + 1 )
-                   * sizeof(stkalign_t) );
-
-               if( stacks[i].stk_stack == NULL ) {
-                       Debug( LDAP_DEBUG_ANY, "stack allocation failed",
-                               0, 0, 0 );
-                       return( NULL );
-               }
-       }
-
-       *stacknop = i;
-       stacks[i].stk_inuse = 1;
-       return( stacks[i].stk_stack + MAX_STACK / sizeof(stkalign_t) );
-}
-
-static void
-ldap_int_thread_free_stack( int        stackno )
-{
-       if ( stackno < 0 || stackno > MAX_THREADS ) {
-               Debug( LDAP_DEBUG_ANY, "free_stack of bogus stack %d\n",
-                   stackno, 0, 0 );
-       }
-
-       stacks[stackno].stk_inuse = 0;
-}
-
-static void
-lwp_create_stack( void *(*func)(), void *arg, int stackno )
-{
-       (*func)( arg );
-
-       ldap_int_thread_free_stack( stackno );
-}
-
-int 
-ldap_pvt_thread_create( ldap_pvt_thread_t * thread, 
-       int detach,
-       void *(*start_routine)( void *),
-       void *arg)
-{
-       stkalign_t      *stack;
-       int             stackno;
-
-       if ( (stack = ldap_int_thread_get_stack( &stackno )) == NULL ) {
-               return( -1 );
-       }
-       return( lwp_create( thread, lwp_create_stack, MINPRIO, 0, 
-                          stack, 3, start_routine, arg, stackno ) );
-}
-
-void 
-ldap_pvt_thread_exit( void *retval )
-{
-       lwp_destroy( SELF );
-}
-
-unsigned int
-ldap_pvt_thread_sleep(
-       unsigned int interval
-)
-{
-       thread_t                mylwp;
-       tl_t            *t, *nt;
-       time_t          now;
-
-
-       if ( lwp_self( &mylwp ) < 0 ) {
-               return -1;
-       }
-
-       time( &now );
-
-       mon_enter( &sglob->tsl_mon );
-
-       if ( sglob->tsl_list != NULL ) {
-               for ( t = sglob->tsl_list; t != NULL; t = t->tl_next ) {
-                       if ( SAMETHREAD( t->tl_tid, mylwp )) {
-                               /* We're already sleeping? */
-                               t->tl_wake = now + interval;
-                               mon_exit( &sglob->tsl_mon );
-                               lwp_suspend( mylwp );
-                               return 0;
-                       }
-               }
-       }
-
-       nt = (tl_t *) LDAP_MALLOC( sizeof( tl_t ));
-
-       if( nt == NULL ) return -1;
-
-       nt->tl_next = sglob->tsl_list;
-       nt->tl_wake = now + interval;
-       nt->tl_tid = mylwp;
-       sglob->tsl_list = nt;
-
-       mon_exit( &sglob->tsl_mon );
-
-       lwp_suspend( mylwp );
-       return 0;
-}
-
-/*
- * The lwp_scheduler thread periodically checks to see if any threads
- * are due to be resumed.  If there are, it resumes them.  Otherwise,
- * it computes the lesser of ( 1 second ) or ( the minimum time until
- * a thread need to be resumed ) and puts itself to sleep for that amount
- * of time.
- */
-static void
-lwp_scheduler(
-       int             stackno
-)
-{
-       time_t                  now, min;
-       struct timeval          interval;
-       tl_t                    *t;
-
-       while ( !sglob->slurpd_shutdown ) {
-               mon_enter( &sglob->tsl_mon );
-
-               time( &now );
-               min = 0L;
-               if ( sglob->tsl_list != NULL ) {
-                       for ( t = sglob->tsl_list; t != NULL; t = t->tl_next ) {
-                               if (( t->tl_wake  > 0L ) && ( t->tl_wake < now )) {
-                                       lwp_resume( t->tl_tid );
-                                       t->tl_wake = 0L;
-                               }
-
-                               if (( t->tl_wake > now ) && ( t->tl_wake < min )) {
-                                       min =  t->tl_wake;
-                               }
-                       }
-               }
-
-               mon_exit( &sglob->tsl_mon );
-
-               interval.tv_usec = 0L;
-               if ( min == 0L ) {
-                       interval.tv_sec = 1L;
-               } else {
-                       interval.tv_sec = min;
-               }
-
-               lwp_sleep( &interval );
-       }
-
-       mon_enter( &sglob->tsl_mon );
-
-       for ( t = sglob->tsl_list; t != NULL; t = t->tl_next ) {
-               lwp_resume( t->tl_tid );
-       }
-
-       mon_exit( &sglob->tsl_mon );
-
-       free_stack( stackno );
-}
-
-int 
-ldap_pvt_thread_join( ldap_pvt_thread_t thread, void **thread_return )
-{
-       lwp_join( thread );
-       return 0;
-}
-
-int 
-ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo )
-{
-       return 0;
-}
-
-int 
-ldap_pvt_thread_yield( void )
-{
-       lwp_yield( SELF );
-       return 0;
-}
-
-int 
-ldap_pvt_thread_cond_init( ldap_pvt_thread_cond_t *cond )
-{
-       /*
-        * lwp cv_create requires the monitor id be passed in
-        * when the cv is created, pthreads passes it when the
-        * condition is waited for.  so, we fake the creation
-        * here and actually do it when the cv is waited for
-        * later.
-        */
-
-       cond->lcv_created = 0;
-
-       return( 0 );
-}
-
-int 
-ldap_pvt_thread_cond_signal( ldap_pvt_thread_cond_t *cond )
-{
-       return( cond->lcv_created ? cv_notify( cv->lcv_cv ) : 0 );
-}
-
-int 
-ldap_pvt_thread_cond_wait( ldap_pvt_thread_cond_t *cond, 
-       ldap_pvt_thread_mutex_t *mutex )
-{
-       if ( ! cond->lcv_created ) {
-               cv_create( &cond->lcv_cv, *mutex );
-               cond->lcv_created = 1;
-       }
-
-       return( cv_wait( cond->lcv_cv ) );      
-}
-
-int 
-ldap_pvt_thread_mutex_init( ldap_pvt_thread_mutex_t *mutex )
-{
-       return( mon_create( mutex ) );
-}
-
-int 
-ldap_pvt_thread_mutex_destroy( ldap_pvt_thread_mutex_t *mutex )
-{
-       return( mon_destroy( *mutex ) );
-}
-
-int 
-ldap_pvt_thread_mutex_lock( ldap_pvt_thread_mutex_t *mutex )
-{
-       return( mon_enter( *mutex ) );
-}
-
-int 
-ldap_pvt_thread_mutex_unlock( ldap_pvt_thread_mutex_t *mutex )
-{
-       return( mon_exit( *mutex ) );
-}
-
-int
-ldap_pvt_thread_mutex_trylock( ldap_pvt_thread_mutex_t *mp )
-{
-       return( mon_cond_enter( *mp ) );
-}
-
-int
-ldap_pvt_thread_cond_destroy( ldap_pvt_thread_cond_t *cv )
-{
-       return( cv->lcv_created ? cv_destroy( cv->lcv_cv ) : 0 );
-}
-
-int
-ldap_pvt_thread_cond_broadcast( ldap_pvt_thread_cond_t *cv )
-{
-       return( cv->lcv_created ? cv_broadcast( cv->lcv_cv ) : 0 );
-}
-
-ldap_pvt_thread_t
-ldap_pvt_thread_self( void )
-{
-       thread_t                mylwp;
-
-       lwp_self( &mylwp );
-
-       return mylwp;
-}
-
-#endif /* HAVE_LWP */