mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-02-18 18:18:06 -05:00
Import fix from devel to handle signals in all threads.
This commit is contained in:
parent
ece345fac8
commit
cbfbb7fb3b
4 changed files with 25 additions and 18 deletions
1
CHANGES
1
CHANGES
|
|
@ -3,6 +3,7 @@ OpenLDAP Change Log
|
|||
Changes included in OpenLDAP 1.2
|
||||
CVS Tag: OPENLDAP_REL_ENG_1_2
|
||||
Fixed slapd/back-ldbm/cache entry lock assert bugs
|
||||
Fixed slapd uncaught signals in main thread problem
|
||||
Build environment
|
||||
Fixed build/man.mk "ln -sf" bug
|
||||
|
||||
|
|
|
|||
|
|
@ -37,8 +37,6 @@ int dtblsize;
|
|||
Connection *c;
|
||||
|
||||
static int slapd_shutdown = 0;
|
||||
static void set_shutdown(int sig);
|
||||
static void do_nothing (int sig);
|
||||
|
||||
/* a link to the slapd.conf configuration parameters */
|
||||
extern char *slapd_pid_file;
|
||||
|
|
@ -129,13 +127,6 @@ slapd_daemon(
|
|||
exit( 1 );
|
||||
}
|
||||
|
||||
(void) SIGNAL( SIGPIPE, SIG_IGN );
|
||||
(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 );
|
||||
|
||||
Debug( LDAP_DEBUG_ANY, "slapd starting\n", 0, 0, 0 );
|
||||
|
||||
if (( slapd_pid_file != NULL ) &&
|
||||
|
|
@ -392,24 +383,26 @@ slapd_daemon(
|
|||
0 );
|
||||
be_close();
|
||||
Debug( LDAP_DEBUG_ANY, "slapd stopping\n", 0, 0, 0 );
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
set_shutdown( int sig )
|
||||
void
|
||||
slap_set_shutdown( int sig )
|
||||
{
|
||||
Debug( LDAP_DEBUG_ANY, "slapd got shutdown signal %d\n", sig, 0, 0 );
|
||||
slapd_shutdown = 1;
|
||||
ldap_pvt_thread_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 );
|
||||
|
||||
/* reinstall self */
|
||||
(void) SIGNAL( sig, slap_set_shutdown );
|
||||
}
|
||||
|
||||
static void
|
||||
do_nothing( int sig )
|
||||
void
|
||||
slap_do_nothing( int sig )
|
||||
{
|
||||
Debug( LDAP_DEBUG_TRACE, "slapd got do_nothing signal %d\n", sig, 0, 0 );
|
||||
(void) SIGNAL( LDAP_SIGUSR1, do_nothing );
|
||||
|
||||
/* reinstall self */
|
||||
(void) SIGNAL( sig, slap_do_nothing );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <ac/signal.h>
|
||||
#include <ac/socket.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/time.h>
|
||||
|
|
@ -189,6 +190,13 @@ main( int argc, char **argv )
|
|||
if ( ! inetd ) {
|
||||
int status;
|
||||
|
||||
(void) SIGNAL( SIGPIPE, SIG_IGN );
|
||||
(void) SIGNAL( LDAP_SIGUSR1, slap_do_nothing );
|
||||
(void) SIGNAL( LDAP_SIGUSR2, slap_set_shutdown );
|
||||
(void) SIGNAL( SIGTERM, slap_set_shutdown );
|
||||
(void) SIGNAL( SIGINT, slap_set_shutdown );
|
||||
(void) SIGNAL( SIGHUP, slap_set_shutdown );
|
||||
|
||||
time( &starttime );
|
||||
|
||||
if ( status = ldap_pvt_thread_create( &listener_tid, 0,
|
||||
|
|
|
|||
|
|
@ -269,6 +269,11 @@ extern int be_group LDAP_P((Backend *be, Entry *target,
|
|||
char *objectclassValue, char *groupattrName));
|
||||
extern void init LDAP_P((void));
|
||||
extern void be_unbind LDAP_P((Connection *conn, Operation *op));
|
||||
|
||||
extern void * slapd_daemon LDAP_P((void *port));
|
||||
extern void slap_set_shutdown LDAP_P((int sig));
|
||||
extern void slap_do_nothing LDAP_P((int sig));
|
||||
|
||||
extern void config_info LDAP_P((Connection *conn, Operation *op));
|
||||
extern void do_abandon LDAP_P((Connection *conn, Operation *op));
|
||||
extern void do_add LDAP_P((Connection *conn, Operation *op));
|
||||
|
|
|
|||
Loading…
Reference in a new issue