]> git.sur5r.net Git - openldap/commitdiff
Apply LinuxThread changes to support alpha/sparc signals
authorKurt Zeilenga <kurt@openldap.org>
Thu, 19 Nov 1998 01:33:57 +0000 (01:33 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Thu, 19 Nov 1998 01:33:57 +0000 (01:33 +0000)
include/ac/signal.h [new file with mode: 0644]
servers/slapd/daemon.c
servers/slapd/result.c
servers/slurpd/admin.c
servers/slurpd/fm.c
servers/slurpd/ri.c

diff --git a/include/ac/signal.h b/include/ac/signal.h
new file mode 100644 (file)
index 0000000..e5776f3
--- /dev/null
@@ -0,0 +1,46 @@
+/* Generic signal.h */
+
+#ifndef _AC_SIGNAL_H
+#define _AC_SIGNAL_H
+
+#include <signal.h>
+
+#ifdef HAVE_SIGSET
+#define SIGNAL sigset
+#else
+#define SIGNAL signal
+#endif
+
+#if !defined( LDAP_SIGUSR1 ) || !defined( LDAP_SIGUSR2 )
+#undef LDAP_SIGUSR1
+#undef LDAP_SIGUSR2
+
+#      ifndef HAVE_LINUX_THREADS
+#              define LDAP_SIGUSR1     SIGUSR1
+#              define LDAP_SIGUSR2     SIGUSR2
+
+#      else
+               /*
+               LinuxThreads implemented unfortunately uses the only
+               two signals reserved for user applications.  This forces
+               OpenLDAP to use, hopefullly unused, signals reserved
+               for other uses.
+               */
+           
+#              if defined( SIGSTKFLT )
+#                      define LDAP_SIGUSR1     SIGSTKFLT
+#              elif defined ( SIGSYS )
+#                      define LDAP_SIGUSR1     SIGSYS
+#              endif
+
+#              ifdef defined( SIGUNUSED )
+#                      define LDAP_SIGUSR2     SIGUNUSED
+#              elif defined ( SIGINFO )
+#                      define LDAP_SIGUSR1     SIGINFO
+#              elif defined ( SIGEMT )
+#                      define LDAP_SIGUSR1     SIGEMT
+#              endif
+#      endif
+#endif
+
+#endif /* _AC_SIGNAL_H */
index 48eb7f13d3a5212a2bcab052772c4ad67a6912c0..2258f1c2d626b766cd8a64bafd19a87525acd114 100644 (file)
@@ -127,17 +127,8 @@ slapd_daemon(
        }
 
        (void) SIGNAL( SIGPIPE, SIG_IGN );
-#ifdef HAVE_LINUX_THREADS
-       /*
-        * LinuxThreads are implemented using SIGUSR1/USR2,
-        * so we'll use SIGSTKFLT and SIGUNUSED
-        */
-       (void) SIGNAL( SIGSTKFLT, do_nothing );
-       (void) SIGNAL( SIGUNUSED, set_shutdown );
-#else  /* !linux */
-       (void) SIGNAL( SIGUSR1, do_nothing );
-       (void) SIGNAL( SIGUSR2, set_shutdown );
-#endif /* !linux */
+       (void) SIGNAL( LDAP_SIGUSR1, do_nothing );
+       (void) SIGNAL( LDAP_SIGUSR2, set_shutdown );
        (void) SIGNAL( SIGTERM, set_shutdown );
        (void) SIGNAL( SIGINT, set_shutdown );
        (void) SIGNAL( SIGHUP, set_shutdown );
@@ -401,17 +392,8 @@ set_shutdown( int sig )
 {
        Debug( LDAP_DEBUG_ANY, "slapd got shutdown signal %d\n", sig, 0, 0 );
        slapd_shutdown = 1;
-#ifdef HAVE_LINUX_THREADS
-       /*
-        * LinuxThreads are implemented using SIGUSR1/USR2,
-        * so we'll use SIGSTKFLT and SIGUNUSED
-        */
-       pthread_kill( listener_tid, SIGSTKFLT );
-       (void) SIGNAL( SIGUNUSED, set_shutdown );
-#else /* !linux */
-       pthread_kill( listener_tid, SIGUSR1 );
-       (void) SIGNAL( SIGUSR2, set_shutdown );
-#endif /* !linux */
+       pthread_kill( listener_tid, LDAP_SIGUSR1 );
+       (void) SIGNAL( LDAP_SIGUSR2, set_shutdown );
        (void) SIGNAL( SIGTERM, set_shutdown );
        (void) SIGNAL( SIGINT, set_shutdown );
        (void) SIGNAL( SIGHUP, set_shutdown );
@@ -421,13 +403,5 @@ static void
 do_nothing( int sig )
 {
        Debug( LDAP_DEBUG_TRACE, "slapd got do_nothing signal %d\n", sig, 0, 0 );
-#ifdef HAVE_LINUX_THREADS
-       /*
-        * LinuxThreads are implemented using SIGUSR1/USR2,
-        * so we'll use SIGSTKFLT and SIGUNUSED
-        */
-       (void) SIGNAL( SIGSTKFLT, do_nothing );
-#else /* !linux */
-       (void) SIGNAL( SIGUSR1, do_nothing );
-#endif /* !linux */
+       (void) SIGNAL( LDAP_SIGUSR1, do_nothing );
 }
index a710e1910f98812e128d928e40764821b69da1a9..a18ba20a8611ba266c2c212f56e5310cb54e294f 100644 (file)
@@ -113,11 +113,7 @@ send_ldap_result2(
                active_threads--;
                conn->c_writewaiter = 1;
 
-#ifdef HAVE_LINUX_THREADS
-               pthread_kill( listener_tid, SIGSTKFLT );
-#else /* !linux */
-               pthread_kill( listener_tid, SIGUSR1 );
-#endif /* !linux */
+               pthread_kill( listener_tid, LDAP_SIGUSR1 );
 
                pthread_cond_wait( &conn->c_wcv, &active_threads_mutex );
                pthread_mutex_unlock( &active_threads_mutex );
@@ -348,7 +344,7 @@ send_search_entry(
                pthread_mutex_lock( &active_threads_mutex );
                active_threads--;
                conn->c_writewaiter = 1;
-               pthread_kill( listener_tid, SIGUSR1 );
+               pthread_kill( listener_tid, LDAP_SIGUSR1 );
                pthread_cond_wait( &conn->c_wcv, &active_threads_mutex );
                pthread_mutex_unlock( &active_threads_mutex );
 
index b5aecdca0f93e7cdc65f95d2c759ee6238384873..4c814b2b001162839cfcb5ebfcd744cc6c561a5a 100644 (file)
@@ -39,5 +39,5 @@ RETSIGTYPE
 do_admin( int sig )
 {
     sglob->rq->rq_dump( sglob->rq );
-    (void) SIGNAL( SIGUSR2, do_admin );
+    (void) SIGNAL( LDAP_SIGUSR2, do_admin );
 }
index be02d2b6f910c5d101fcdd817342e41b7bbbfcc7..5063927180dac1cb1eb9dfafa47abc22a4071e46 100644 (file)
@@ -51,17 +51,12 @@ fm(
 
     /* Set up our signal handlers:
      * SIG{TERM,INT,HUP} causes a shutdown
-     * SIG(STKFLT|USR1) - does nothing, used to wake up sleeping threads.
-     * SIG(UNUSED|USR2) - causes slurpd to read its administrative interface file.
+     * LDAP_SIGUSR1 - does nothing, used to wake up sleeping threads.
+     * LDAP_SIGUSR2 - causes slurpd to read its administrative interface file.
      *           (not yet implemented).
      */
-#ifdef HAVE_LINUX_THREADS
-    (void) SIGNAL( SIGSTKFLT, do_nothing );
-    (void) SIGNAL( SIGUNUSED, do_admin );
-#else
-    (void) SIGNAL( SIGUSR1, do_nothing );
-    (void) SIGNAL( SIGUSR2, do_admin );
-#endif
+    (void) SIGNAL( LDAP_SIGUSR1, do_nothing );
+    (void) SIGNAL( LDAP_SIGUSR2, do_admin );
     (void) SIGNAL( SIGTERM, set_shutdown );
     (void) SIGNAL( SIGINT, set_shutdown );
     (void) SIGNAL( SIGHUP, set_shutdown );
@@ -140,11 +135,7 @@ set_shutdown(int x)
     int        i;
 
     sglob->slurpd_shutdown = 1;                                /* set flag */
-#ifdef HAVE_LINUX_THREADS
-    pthread_kill( sglob->fm_tid, SIGSTKFLT );  /* wake up file mgr */
-#else
-    pthread_kill( sglob->fm_tid, SIGUSR1 );            /* wake up file mgr */
-#endif
+    pthread_kill( sglob->fm_tid, LDAP_SIGUSR1 );       /* wake up file mgr */
     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++ ) {
@@ -165,11 +156,7 @@ set_shutdown(int x)
 RETSIGTYPE
 do_nothing(int i)
 {
-#ifdef HAVE_LINUX_THREADS
-    (void) SIGNAL( SIGSTKFLT, do_nothing );
-#else
-    (void) SIGNAL( SIGUSR1, do_nothing );
-#endif
+    (void) SIGNAL( LDAP_SIGUSR1, do_nothing );
 }
 
 
index d96482d13c04e10aa01da78b0d247aa708a9ff7f..de335061ab7886e609f4e05de9fa26facded545d 100644 (file)
@@ -45,11 +45,7 @@ Ri_process(
     int                rc ;
     char       *errmsg;
 
-#ifdef HAVE_LINUX_THREADS
-    (void) SIGNAL( SIGSTKFLT, do_nothing );
-#else
-    (void) SIGNAL( SIGUSR1, do_nothing );
-#endif
+    (void) SIGNAL( LDAP_SIGUSR1, do_nothing );
     (void) SIGNAL( SIGPIPE, SIG_IGN );
     if ( ri == NULL ) {
        Debug( LDAP_DEBUG_ANY, "Error: Ri_process: ri == NULL!\n", 0, 0, 0 );
@@ -137,7 +133,7 @@ Ri_process(
 
 /*
  * Wake a replication thread which may be sleeping.
- * Send it a SIG(STKFLT|USR1).
+ * Send it a LDAP_SIGUSR1.
  */
 static void
 Ri_wake(
@@ -147,13 +143,8 @@ Ri_wake(
     if ( ri == NULL ) {
        return;
     }
-#ifdef HAVE_LINUX_THREADS
-    pthread_kill( ri->ri_tid, SIGSTKFLT );
-    (void) SIGNAL( SIGSTKFLT, do_nothing );
-#else
-    pthread_kill( ri->ri_tid, SIGUSR1 );
-    (void) SIGNAL( SIGUSR1, do_nothing );
-#endif
+    pthread_kill( ri->ri_tid, LDAP_SIGUSR1 );
+    (void) SIGNAL( LDAP_SIGUSR1, do_nothing );
 }