From: Kurt Zeilenga Date: Fri, 14 Aug 1998 05:50:03 +0000 (+0000) Subject: Moved ldap_ headers to include/ac or include/ldap X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a584607163f7d6a9fe93af250caae5d931c43d78;p=thirdparty%2Fopenldap.git Moved ldap_ headers to include/ac or include/ldap --- diff --git a/build/platforms/freebsd-gcc/Make-platform b/build/platforms/freebsd-gcc/Make-platform index 895b32f2af..1d78ed72c2 100644 --- a/build/platforms/freebsd-gcc/Make-platform +++ b/build/platforms/freebsd-gcc/Make-platform @@ -11,6 +11,9 @@ # ------------------------------------------------------------------------- # you will probably not need to edit anything below this point # ------------------------------------------------------------------------- -CC = gcc +CC = cc PLATFORMCFLAGS= -Dfreebsd + +# uncomment this line if using for LDAP_CRYPT +#PLATFORMLIBS= -lcrypt diff --git a/build/platforms/linux-gcc/Make-platform b/build/platforms/linux-gcc/Make-platform index 45f3823921..5e2a39fc44 100644 --- a/build/platforms/linux-gcc/Make-platform +++ b/build/platforms/linux-gcc/Make-platform @@ -15,3 +15,6 @@ CC = gcc RANLIB = "ranlib" PLATFORMCFLAGS= -Dlinux + +# uncomment this if -DLDAP_CRYPT is defined +#PLATFORMLIBS= -lcrypt diff --git a/clients/fax500/main.c b/clients/fax500/main.c index 7481d4980e..af0870442c 100644 --- a/clients/fax500/main.c +++ b/clients/fax500/main.c @@ -10,7 +10,7 @@ * is provided ``as is'' without express or implied warranty. */ - +#include "portable.h" #include #include #include @@ -24,7 +24,7 @@ #include #include #include -#include "portable.h" +#include "bridge.h" #include "lber.h" #include "ldap.h" diff --git a/clients/finger/main.c b/clients/finger/main.c index 38c8dfc769..092ce7e072 100644 --- a/clients/finger/main.c +++ b/clients/finger/main.c @@ -10,11 +10,12 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" #include "lber.h" #include "ldap.h" #include "disptmpl.h" #include -#include +#include #include #include #include @@ -24,12 +25,12 @@ #include #include #include -#include +#include #ifdef aix #include #endif /* aix */ #include -#include "portable.h" +#include "bridge.h" #include "ldapconfig.h" #ifdef USE_SYSCONF diff --git a/clients/gopher/go500.c b/clients/gopher/go500.c index 333787677a..0a704d8fb8 100644 --- a/clients/gopher/go500.c +++ b/clients/gopher/go500.c @@ -10,6 +10,7 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" #include #include #include @@ -27,7 +28,7 @@ #include #endif /* aix */ #include -#include "portable.h" +#include "bridge.h" #include "ldapconfig.h" #include "lber.h" #include "ldap.h" diff --git a/clients/gopher/go500gw.c b/clients/gopher/go500gw.c index 7f74fbf57c..78a3846e4b 100644 --- a/clients/gopher/go500gw.c +++ b/clients/gopher/go500gw.c @@ -10,6 +10,8 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include "lber.h" #include "ldap.h" #include "disptmpl.h" @@ -30,7 +32,7 @@ #ifdef aix #include #endif /* aix */ -#include "portable.h" +#include "bridge.h" #include "ldapconfig.h" #ifdef USE_SYSCONF diff --git a/clients/mail500/main.c b/clients/mail500/main.c index 5fdea96201..edce8ce20b 100644 --- a/clients/mail500/main.c +++ b/clients/mail500/main.c @@ -10,6 +10,7 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" #include #include #include @@ -21,7 +22,7 @@ #include #include #include -#include "portable.h" +#include "bridge.h" #include "lber.h" #include "ldap.h" diff --git a/clients/rcpt500/main.c b/clients/rcpt500/main.c index 3e65ac233b..c3303568de 100644 --- a/clients/rcpt500/main.c +++ b/clients/rcpt500/main.c @@ -6,13 +6,14 @@ * All Rights Reserved */ +#include "portable.h" #include #include #include #include #include -#include "portable.h" +#include "bridge.h" #include "ldapconfig.h" #include "rcpt500.h" diff --git a/clients/ud/main.c b/clients/ud/main.c index c0b70b2ceb..1635500c9f 100644 --- a/clients/ud/main.c +++ b/clients/ud/main.c @@ -35,7 +35,8 @@ #include #endif /* defined( NeXT ) || defined( ultrix ) etc. */ #endif /* !DOS */ -#if defined( aix ) || defined( __NetBSD__ ) +#if defined( aix ) || defined( __NetBSD__ ) \ + || defined( __FreeBSD__ ) || defined( linux ) #include #endif /* aix || __NetBSD__ */ #include diff --git a/clients/ud/util.c b/clients/ud/util.c index 18b694b9c4..ca5e3a83ad 100644 --- a/clients/ud/util.c +++ b/clients/ud/util.c @@ -14,7 +14,7 @@ #include #include -#include "ldap_string.h" +#include #ifdef DOS #include #endif @@ -30,7 +30,7 @@ #if !defined(DOS) && !defined(VMS) #include #endif - +#include "bridge.h" #ifdef USE_TERMIOS #include #else /* USE_TERMIOS */ @@ -38,8 +38,6 @@ #endif /* USE_TERMIOS */ #include "ud.h" -#include "bridge.h" - #if defined(VMS) #define getch getchar #endif diff --git a/include/lthread.h b/include/lthread.h index d1b34d8ecf..d712a5e593 100644 --- a/include/lthread.h +++ b/include/lthread.h @@ -3,7 +3,40 @@ #ifndef _LTHREAD_H #define _LTHREAD_H -#if defined( THREAD_SUNOS4_LWP ) +#if defined ( THREAD_NEXT_CTHREADS ) + +#define _THREAD + +#include + +typedef cthread_fn_t VFP; +typedef int pthread_attr_t; +typedef cthread_t pthread_t; + +/* default attr states */ +#define pthread_mutexattr_default NULL +#define pthread_condattr_default NULL + +/* thread state - joinable or not */ +#define PTHREAD_CREATE_JOINABLE 0 +#define PTHREAD_CREATE_DETACHED 1 +/* thread scope - who is in scheduling pool */ +#define PTHREAD_SCOPE_PROCESS 0 +#define PTHREAD_SCOPE_SYSTEM 1 + +/* mutex attributes and mutex type */ +typedef int pthread_mutexattr_t; +typedef struct mutex pthread_mutex_t; + +/* mutex and condition variable scope - process or system */ +#define PTHREAD_SHARE_PRIVATE 0 +#define PTHREAD_SHARE_PROCESS 1 + +/* condition variable attributes and condition variable type */ +typedef int pthread_condattr_t; +typedef struct condition pthread_cond_t; + +#elif defined( THREAD_SUNOS4_LWP ) /*********************************** * * * thread definitions for sunos4 * @@ -127,6 +160,18 @@ typedef cond_t pthread_cond_t; #define pthread_attr_setdetachstate( a, b ) \ pthread_attr_setdetach_np( a, b ) +#else /* end dce pthreads */ + +#if defined( POSIX_THREADS ) + +#define _THREAD + +#include + +#define pthread_mutexattr_default NULL +#define pthread_condattr_default NULL + +#endif /* posix threads */ #endif /* dce pthreads */ #endif /* mit pthreads */ #endif /* sunos5 */ diff --git a/libraries/liblthread/thread.c b/libraries/liblthread/thread.c index 89a85c70b4..f6e516f505 100644 --- a/libraries/liblthread/thread.c +++ b/libraries/liblthread/thread.c @@ -2,7 +2,157 @@ #include #include "lthread.h" -#if defined( THREAD_SUNOS4_LWP ) +#if defined( THREAD_NEXT_CTHREADS ) + +/*********************************************************************** + * * + * under NEXTSTEP or OPENSTEP use CThreads * + * lukeh@xedoc.com.au * + * * + ***********************************************************************/ + +int +pthread_attr_init( pthread_attr_t *attr ) +{ + *attr = 0; + return( 0 ); +} + +int +pthread_attr_destroy( pthread_attr_t *attr ) +{ + return( 0 ); +} + +int +pthread_attr_getdetachstate( pthread_attr_t *attr, int *detachstate ) +{ + *detachstate = *attr; + return( 0 ); +} + +int +pthread_attr_setdetachstate( pthread_attr_t *attr, int detachstate ) +{ + *attr = detachstate; + return( 0 ); +} + +/* ARGSUSED */ +int +pthread_create( + pthread_t *tid, + pthread_attr_t attr, + VFP func, + void *arg +) +{ + *tid = cthread_fork(func, arg); + return ( *tid == NULL ? -1 : 0 ); +} + +void +pthread_yield() +{ + cthread_yield(); +} + +void +pthread_exit( any_t a ) +{ + cthread_exit( a ); +} + +void +pthread_join( pthread_t tid, int *pStatus ) +{ + int status; + status = (int) cthread_join ( tid ); + if (pStatus != NULL) + { + *pStatus = status; + } +} + +/* ARGSUSED */ +void +pthread_kill( pthread_t tid, int sig ) +{ + return; +} + +/* ARGSUSED */ +int +pthread_mutex_init( pthread_mutex_t *mp, pthread_mutexattr_t *attr ) +{ + mutex_init( mp ); + mp->name = NULL; + return ( 0 ); +} + +int +pthread_mutex_destroy( pthread_mutex_t *mp ) +{ + mutex_clear( mp ); + return ( 0 ); +} + +int +pthread_mutex_lock( pthread_mutex_t *mp ) +{ + mutex_lock( mp ); + return ( 0 ); +} + +int +pthread_mutex_unlock( pthread_mutex_t *mp ) +{ + mutex_unlock( mp ); + return ( 0 ); +} + +int +pthread_mutex_trylock( pthread_mutex_t *mp ) +{ + return mutex_try_lock( mp ); +} + +int +pthread_cond_init( pthread_cond_t *cv, pthread_condattr_t *attr ) +{ + condition_init( cv ); + return( 0 ); +} + +int +pthread_cond_destroy( pthread_cond_t *cv ) +{ + condition_clear( cv ); + return( 0 ); +} + +int +pthread_cond_wait( pthread_cond_t *cv, pthread_mutex_t *mp ) +{ + condition_wait( cv, mp ); + return( 0 ); +} + +int +pthread_cond_signal( pthread_cond_t *cv ) +{ + condition_signal( cv ); + return( 0 ); +} + +int +pthread_cond_broadcast( pthread_cond_t *cv ) +{ + condition_broadcast( cv ); + return( 0 ); +} + +#elif defined( THREAD_SUNOS4_LWP ) /*********************************************************************** * * @@ -333,6 +483,16 @@ pthread_kill( pthread_t tid, int sig ) kill( getpid(), sig ); } +#else + +#if defined ( POSIX_THREADS ) + +void p_thread_yield( void ) +{ + sched_yield(); +} + +#endif /* posix threads */ #endif /* dce pthreads */ #endif /* mit pthreads */ #endif /* sunos5 lwp */ diff --git a/servers/slapd/aclparse.c b/servers/slapd/aclparse.c index 10fa6a0721..af6205c1d3 100644 --- a/servers/slapd/aclparse.c +++ b/servers/slapd/aclparse.c @@ -1,6 +1,6 @@ /* acl.c - routines to parse and check acl's */ - +#include "portable.h" #include #include #include @@ -9,7 +9,7 @@ #include #include "regex.h" #include "slap.h" -#include "portable.h" +#include "bridge.h" extern Filter *str2filter(); extern char *re_comp(); diff --git a/servers/slapd/attr.c b/servers/slapd/attr.c index 7686d94767..9de884518b 100644 --- a/servers/slapd/attr.c +++ b/servers/slapd/attr.c @@ -1,5 +1,6 @@ /* attr.c - routines for dealing with attributes */ +#include "portable.h" #include #include #include @@ -9,7 +10,7 @@ #include #include #include -#include "portable.h" +#include "bridge.h" #include "slap.h" extern char **charray_dup(); diff --git a/servers/slapd/back-ldbm/dbcache.c b/servers/slapd/back-ldbm/dbcache.c index c16c8b160d..45362173da 100644 --- a/servers/slapd/back-ldbm/dbcache.c +++ b/servers/slapd/back-ldbm/dbcache.c @@ -1,5 +1,6 @@ /* ldbmcache.c - maintain a cache of open ldbm files */ +#include "portable.h" #include #include #include @@ -8,7 +9,7 @@ #include #include #include -#include "portable.h" +#include "bridge.h" #include "slap.h" #include "ldapconfig.h" #include "back-ldbm.h" diff --git a/servers/slapd/charray.c b/servers/slapd/charray.c index b731cf1e90..e3b4d37feb 100644 --- a/servers/slapd/charray.c +++ b/servers/slapd/charray.c @@ -107,12 +107,15 @@ charray_dup( char **a ) } char ** -str2charray( char *str, char *brkstr ) +str2charray( char *str_in, char *brkstr ) { char **res; char *s; int i; + /* protect the input string from strtok */ + char *str = strdup( str_in ); + i = 1; for ( s = str; *s; s++ ) { if ( strchr( brkstr, *s ) != NULL ) { @@ -128,5 +131,6 @@ str2charray( char *str, char *brkstr ) } res[i] = NULL; + free( str ); return( res ); } diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index 5c3ebdf708..7634d3545b 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -1,3 +1,4 @@ +#include "portable.h" #include #include #include @@ -5,7 +6,7 @@ #include #include #include -#include "portable.h" +#include "bridge.h" #include "slap.h" extern Operation *op_add(); @@ -203,7 +204,7 @@ connection_activity( pthread_attr_init( &attr ); pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED ); - if ( pthread_create( &arg->co_op->o_tid, attr, + if ( pthread_create( &arg->co_op->o_tid, &attr, (void *) connection_operation, (void *) arg ) != 0 ) { Debug( LDAP_DEBUG_ANY, "pthread_create failed\n", 0, 0, 0 ); } else { diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index 161fb79cf0..5bb56bdcf6 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -1,3 +1,11 @@ + +/* Revision history + * + * 5-Jun-96 hodges + * Added locking of new_conn_mutex when traversing the c[] array. + */ + +#include "portable.h" #include #include #include @@ -12,7 +20,7 @@ #include #endif #include "slap.h" -#include "portable.h" +#include "bridge.h" #include "ldapconfig.h" #ifdef NEED_FILIO #include @@ -48,7 +56,7 @@ static void set_shutdown(); static void do_nothing(); void -daemon( +slapd_daemon( int port ) { @@ -68,7 +76,12 @@ daemon( #else /* USE_SYSCONF */ dtblsize = getdtablesize(); #endif /* USE_SYSCONF */ - + /* + * Add greg@greg.rim.or.jp + */ + if(dtblsize > FD_SETSIZE) { + dtblsize = FD_SETSIZE; + } c = (Connection *) ch_calloc( 1, dtblsize * sizeof(Connection) ); for ( i = 0; i < dtblsize; i++ ) { @@ -127,9 +140,18 @@ daemon( } (void) SIGNAL( SIGPIPE, SIG_IGN ); +#ifdef SIGSTKFLT + (void) SIGNAL( SIGSTKFLT, (void *) do_nothing ); +#else (void) SIGNAL( SIGUSR1, (void *) do_nothing ); +#endif +#ifdef SIGSTKFLT + (void) SIGNAL( SIGUNUSED, (void *) set_shutdown ); +#else (void) SIGNAL( SIGUSR2, (void *) set_shutdown ); +#endif (void) SIGNAL( SIGTERM, (void *) set_shutdown ); + (void) SIGNAL( SIGINT, (void *) set_shutdown ); (void) SIGNAL( SIGHUP, (void *) set_shutdown ); Debug( LDAP_DEBUG_ANY, "slapd starting\n", 0, 0, 0 ); @@ -164,6 +186,8 @@ daemon( Debug( LDAP_DEBUG_CONNS, "listening for connections on %d, activity on:", tcps, 0, 0 ); + + pthread_mutex_lock( &new_conn_mutex ); for ( i = 0; i < dtblsize; i++ ) { if ( c[i].c_sb.sb_sd != -1 ) { FD_SET( c[i].c_sb.sb_sd, &readfds ); @@ -176,6 +200,7 @@ daemon( } } Debug( LDAP_DEBUG_CONNS, "\n", 0, 0, 0 ); + pthread_mutex_unlock( &new_conn_mutex ); zero.tv_sec = 0; zero.tv_usec = 0; @@ -349,15 +374,28 @@ set_shutdown() { Debug( LDAP_DEBUG_ANY, "slapd got shutdown signal\n", 0, 0, 0 ); slapd_shutdown = 1; +#ifdef SIGSTKFLT + pthread_kill( listener_tid, SIGSTKFLT ); +#else pthread_kill( listener_tid, SIGUSR1 ); +#endif +#ifdef SIGUNUSED + (void) SIGNAL( SIGUNUSED, (void *) set_shutdown ); +#else (void) SIGNAL( SIGUSR2, (void *) set_shutdown ); +#endif (void) SIGNAL( SIGTERM, (void *) set_shutdown ); + (void) SIGNAL( SIGINT, (void *) set_shutdown ); (void) SIGNAL( SIGHUP, (void *) set_shutdown ); } static void do_nothing() { - Debug( LDAP_DEBUG_TRACE, "slapd got SIGUSR1\n", 0, 0, 0 ); + Debug( LDAP_DEBUG_TRACE, "slapd got do_nothing signal\n", 0, 0, 0 ); +#ifdef SIGSTKFLT + (void) SIGNAL( SIGSTKFLT, (void *) do_nothing ); +#else (void) SIGNAL( SIGUSR1, (void *) do_nothing ); +#endif } diff --git a/servers/slapd/detach.c b/servers/slapd/detach.c index 7b3fdab57a..dcd723b79f 100644 --- a/servers/slapd/detach.c +++ b/servers/slapd/detach.c @@ -10,6 +10,7 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" #include #include #ifdef SVR4 @@ -19,7 +20,7 @@ #include #include #include -#include "portable.h" +#include "bridge.h" #ifdef USE_SYSCONF #include diff --git a/servers/slapd/dn.c b/servers/slapd/dn.c index 226937efa9..d18c15f0a0 100644 --- a/servers/slapd/dn.c +++ b/servers/slapd/dn.c @@ -1,12 +1,13 @@ /* dn.c - routines for dealing with distinguished names */ +#include "portable.h" #include #include #include #include #include #include -#include "portable.h" +#include "bridge.h" #include "slap.h" static char **dn_explode(); diff --git a/servers/slapd/main.c b/servers/slapd/main.c index 01930b9709..4f0b874131 100644 --- a/servers/slapd/main.c +++ b/servers/slapd/main.c @@ -1,3 +1,4 @@ +#include "portable.h" #include #include #include @@ -6,11 +7,11 @@ #include #include #include -#include "portable.h" +#include "bridge.h" #include "slap.h" #include "ldapconfig.h" -extern void daemon(); +extern void slapd_daemon(); extern int lber_debug; extern char Versionstr[]; @@ -184,7 +185,7 @@ main( argc, argv ) pthread_attr_init( &attr ); pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED ); - if ( pthread_create( &listener_tid, attr, (void *) daemon, + if ( pthread_create( &listener_tid, &attr, (void *) slapd_daemon, (void *) port ) != 0 ) { Debug( LDAP_DEBUG_ANY, "listener pthread_create failed\n", 0, 0, 0 ); diff --git a/servers/slapd/phonetic.c b/servers/slapd/phonetic.c index 959e06e1e3..1117026f07 100644 --- a/servers/slapd/phonetic.c +++ b/servers/slapd/phonetic.c @@ -1,12 +1,13 @@ /* phonetic.c - routines to do phonetic matching */ +#include "portable.h" #include #include #include #include #include #include -#include "portable.h" +#include "bridge.h" #include "slap.h" #if !defined(METAPHONE) && !defined(SOUNDEX) diff --git a/servers/slapd/result.c b/servers/slapd/result.c index 0ef82a7b3e..90b6dbe68d 100644 --- a/servers/slapd/result.c +++ b/servers/slapd/result.c @@ -1,5 +1,6 @@ /* result.c - routines to send ldap results, errors, and referrals */ +#include "portable.h" #include #include #include @@ -8,7 +9,7 @@ #include #include #include -#include "portable.h" +#include "bridge.h" #include "slap.h" #ifndef SYSERRLIST_IN_STDIO @@ -121,7 +122,11 @@ send_ldap_result2( pthread_mutex_lock( &active_threads_mutex ); active_threads--; conn->c_writewaiter = 1; +#ifdef SIGSTKFLT + pthread_kill( listener_tid, SIGSTKFLT ); +#else pthread_kill( listener_tid, SIGUSR1 ); +#endif pthread_cond_wait( &conn->c_wcv, &active_threads_mutex ); pthread_mutex_unlock( &active_threads_mutex ); diff --git a/servers/slapd/tools/centipede.c b/servers/slapd/tools/centipede.c index 4f0546d171..97ee1b3e46 100644 --- a/servers/slapd/tools/centipede.c +++ b/servers/slapd/tools/centipede.c @@ -3,9 +3,9 @@ #include "portable.h" #include -#include "ldap_string.h" +#include #include -#include "ldap_time.h" +#include #include #include diff --git a/servers/slapd/tools/ldbmcat.c b/servers/slapd/tools/ldbmcat.c index e9d70ba5bd..46aae30336 100644 --- a/servers/slapd/tools/ldbmcat.c +++ b/servers/slapd/tools/ldbmcat.c @@ -1,7 +1,7 @@ #include "portable.h" #include -#include "ldap_string.h" +#include #include #include #include diff --git a/servers/slapd/tools/ldbmtest.c b/servers/slapd/tools/ldbmtest.c index 5dd55f392f..d7908b78ad 100644 --- a/servers/slapd/tools/ldbmtest.c +++ b/servers/slapd/tools/ldbmtest.c @@ -6,9 +6,9 @@ #include #include #include -#include "ldap_time.h" +#include #include -#include "ldap_wait.h" +#include #include #include #include diff --git a/servers/slapd/tools/ldif.c b/servers/slapd/tools/ldif.c index 456433bdf4..d480a2e7dd 100644 --- a/servers/slapd/tools/ldif.c +++ b/servers/slapd/tools/ldif.c @@ -1,7 +1,7 @@ #include "portable.h" #include -#include "ldap_string.h" +#include #include #include #include diff --git a/servers/slapd/tools/ldif2id2children.c b/servers/slapd/tools/ldif2id2children.c index f8a1aef52b..4c79722b4f 100644 --- a/servers/slapd/tools/ldif2id2children.c +++ b/servers/slapd/tools/ldif2id2children.c @@ -1,7 +1,7 @@ #include "portable.h" #include -#include "ldap_string.h" +#include #include #include #include "../slap.h" diff --git a/servers/slapd/tools/ldif2id2entry.c b/servers/slapd/tools/ldif2id2entry.c index 3010d1d58c..ca315c3f7f 100644 --- a/servers/slapd/tools/ldif2id2entry.c +++ b/servers/slapd/tools/ldif2id2entry.c @@ -1,7 +1,7 @@ #include "portable.h" #include -#include "ldap_string.h" +#include #include #include #include "../slap.h" diff --git a/servers/slapd/tools/ldif2index.c b/servers/slapd/tools/ldif2index.c index 71318e0292..87a1f71caf 100644 --- a/servers/slapd/tools/ldif2index.c +++ b/servers/slapd/tools/ldif2index.c @@ -1,7 +1,7 @@ #include "portable.h" #include -#include "ldap_string.h" +#include #include #include #include "../slap.h" diff --git a/servers/slapd/tools/ldif2ldbm.c b/servers/slapd/tools/ldif2ldbm.c index 56531b4fbc..d6e2b6924e 100644 --- a/servers/slapd/tools/ldif2ldbm.c +++ b/servers/slapd/tools/ldif2ldbm.c @@ -1,6 +1,6 @@ #include "portable.h" #include -#include "ldap_string.h" +#include #include #include #include diff --git a/servers/slapd/value.c b/servers/slapd/value.c index c9e6fbb577..68b81283de 100644 --- a/servers/slapd/value.c +++ b/servers/slapd/value.c @@ -1,12 +1,13 @@ /* value.c - routines for dealing with values */ +#include "portable.h" #include #include #include #include #include #include -#include "portable.h" +#include "bridge.h" #include "slap.h" int diff --git a/servers/slurpd/admin.c b/servers/slurpd/admin.c index 6a58b40c4c..d1aed00cbf 100644 --- a/servers/slurpd/admin.c +++ b/servers/slurpd/admin.c @@ -16,12 +16,15 @@ */ +#include "portable.h" + #include #include #include "slurp.h" #include "globals.h" +#include "bridge.h" /* * Eventually, do_admin will be the entry point for performing diff --git a/servers/slurpd/args.c b/servers/slurpd/args.c index b3cc935df8..dacf17fffa 100644 --- a/servers/slurpd/args.c +++ b/servers/slurpd/args.c @@ -14,6 +14,8 @@ * args.c - process command-line arguments, and set appropriate globals. */ +#include "portable.h" + #include #include @@ -23,6 +25,8 @@ #include "slurp.h" #include "globals.h" +#include "bridge.h" + static int usage( char *name ) diff --git a/servers/slurpd/detach.c b/servers/slurpd/detach.c index 7b3fdab57a..dcd723b79f 100644 --- a/servers/slurpd/detach.c +++ b/servers/slurpd/detach.c @@ -10,6 +10,7 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" #include #include #ifdef SVR4 @@ -19,7 +20,7 @@ #include #include #include -#include "portable.h" +#include "bridge.h" #ifdef USE_SYSCONF #include diff --git a/servers/slurpd/fm.c b/servers/slurpd/fm.c index 5966c0a03b..8223e14adf 100644 --- a/servers/slurpd/fm.c +++ b/servers/slurpd/fm.c @@ -14,6 +14,7 @@ * fm.c - file management routines. */ +#include "portable.h" #include #include #include @@ -21,6 +22,8 @@ #include "slurp.h" #include "globals.h" +#include "bridge.h" + extern void do_admin(); static void set_shutdown(); @@ -77,12 +80,20 @@ fm( /* Set up our signal handlers: * SIG{TERM,INT,HUP} causes a shutdown - * SIGUSR1 - does nothing, used to wake up sleeping threads. - * SIGUSR2 - causes slurpd to read its administrative interface file. + * SIG(STKFLT|USR1) - does nothing, used to wake up sleeping threads. + * SIG(UNUSED|USR2) - causes slurpd to read its administrative interface file. * (not yet implemented). */ +#ifdef SIGSTKFLT + (void) SIGNAL( SIGSTKFLT, (void *) do_nothing ); +#else (void) SIGNAL( SIGUSR1, (void *) do_nothing ); +#endif +#ifdef SIGUNUSED + (void) SIGNAL( SIGUNUSED, (void *) do_admin ); +#else (void) SIGNAL( SIGUSR2, (void *) do_admin ); +#endif (void) SIGNAL( SIGTERM, (void *) set_shutdown ); (void) SIGNAL( SIGINT, (void *) set_shutdown ); (void) SIGNAL( SIGHUP, (void *) set_shutdown ); @@ -160,7 +171,11 @@ set_shutdown() int i; sglob->slurpd_shutdown = 1; /* set flag */ +#ifdef SIGSTKFLT + pthread_kill( sglob->fm_tid, SIGSTKFLT ); /* wake up file mgr */ +#else pthread_kill( sglob->fm_tid, SIGUSR1 ); /* wake up file mgr */ +#endif sglob->rq->rq_lock( sglob->rq ); /* lock queue */ pthread_cond_broadcast( &(sglob->rq->rq_more) ); /* wake repl threads */ for ( i = 0; i < sglob->num_replicas; i++ ) { @@ -181,7 +196,11 @@ set_shutdown() void do_nothing() { +#ifdef SIGSTKFLT + (void) SIGNAL( SIGSTKFLT, (void *) do_nothing ); +#else (void) SIGNAL( SIGUSR1, (void *) do_nothing ); +#endif } diff --git a/servers/slurpd/main.c b/servers/slurpd/main.c index a3b935faa5..98ffb2917c 100644 --- a/servers/slurpd/main.c +++ b/servers/slurpd/main.c @@ -121,7 +121,7 @@ main( * Start the main file manager thread (in fm.c). */ pthread_attr_init( &attr ); - if ( pthread_create( &(sglob->fm_tid), attr, (void *) fm, (void *) NULL ) + if ( pthread_create( &(sglob->fm_tid), &attr, (void *) fm, (void *) NULL ) != 0 ) { Debug( LDAP_DEBUG_ANY, "file manager pthread_create failed\n", 0, 0, 0 ); diff --git a/servers/slurpd/replica.c b/servers/slurpd/replica.c index ed25a62907..ce878390fd 100644 --- a/servers/slurpd/replica.c +++ b/servers/slurpd/replica.c @@ -59,7 +59,7 @@ start_replica_thread( pthread_attr_init( &attr ); pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED ); - if ( pthread_create( &(ri->ri_tid), attr, (void *) replicate, + if ( pthread_create( &(ri->ri_tid), &attr, (void *) replicate, (void *) ri ) != 0 ) { Debug( LDAP_DEBUG_ANY, "replica \"%s:%d\" pthread_create failed\n", ri->ri_hostname, ri->ri_port, 0 ); diff --git a/servers/slurpd/ri.c b/servers/slurpd/ri.c index cc478d1e6a..b1df234a68 100644 --- a/servers/slurpd/ri.c +++ b/servers/slurpd/ri.c @@ -16,7 +16,7 @@ * instance. The Ri struct is defined in slurp.h */ - +#include "portable.h" #include #include @@ -24,6 +24,7 @@ #include "slurp.h" #include "globals.h" +#include "bridge.h" /* External references */ #ifdef NEEDPROTOS @@ -60,7 +61,11 @@ Ri_process( int rc ; char *errmsg; +#ifdef SIGSTKFLT + (void) SIGNAL( SIGSTKFLT, (void *) do_nothing ); +#else (void) SIGNAL( SIGUSR1, (void *) do_nothing ); +#endif (void) SIGNAL( SIGPIPE, SIG_IGN ); if ( ri == NULL ) { Debug( LDAP_DEBUG_ANY, "Error: Ri_process: ri == NULL!\n", 0, 0, 0 ); @@ -146,7 +151,8 @@ Ri_process( /* - * Wake a replication thread which may be sleeping. Send it a SIGUSR1. + * Wake a replication thread which may be sleeping. + * Send it a SIG(STKFLT|USR1). */ static void Ri_wake( @@ -156,8 +162,13 @@ Ri_wake( if ( ri == NULL ) { return; } +#ifdef SIGSTKFLT + pthread_kill( ri->ri_tid, SIGSTKFLT ); + (void) SIGNAL( SIGSTKFLT, (void *) do_nothing ); +#else pthread_kill( ri->ri_tid, SIGUSR1 ); (void) SIGNAL( SIGUSR1, (void *) do_nothing ); +#endif }