X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fdaemon.c;h=d14f37eda42a26c3cdd3dfdc9c5ea16deaf991a9;hb=ceb1c5ce1c22a1e062cf724d222b126751e2906a;hp=48eb7f13d3a5212a2bcab052772c4ad67a6912c0;hpb=3952bc8e95a2b21aced14f890028f12d00e191fa;p=openldap diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index 48eb7f13d3..d14f37eda4 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -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 ); @@ -198,7 +189,7 @@ slapd_daemon( Debug( LDAP_DEBUG_CONNS, "before select active_threads %d\n", active_threads, 0, 0 ); -#ifdef PREEMPTIVE_THREADS +#if defined( HAVE_YIELDING_SELECT ) || defined( NO_THREADS ) tvp = NULL; #else tvp = active_threads ? &zero : NULL; @@ -313,13 +304,13 @@ slapd_daemon( if ( c[ns].c_addr != NULL ) { free( c[ns].c_addr ); } - c[ns].c_addr = strdup( client_addr ); + c[ns].c_addr = ch_strdup( client_addr ); if ( c[ns].c_domain != NULL ) { free( c[ns].c_domain ); } - c[ns].c_domain = strdup( client_name == NULL + c[ns].c_domain = ch_strdup( client_name == NULL ? "" : client_name ); pthread_mutex_lock( &c[ns].c_dnmutex ); @@ -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 ); }