mirror of
https://github.com/NLnetLabs/unbound.git
synced 2024-09-21 06:37:08 +00:00
exit on signal, compatible with bad versions of libevent.
git-svn-id: file:///svn/unbound/trunk@161 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
1c24c78462
commit
aa4918c25b
@ -421,6 +421,7 @@ if test x_$withval != x_no; then
|
|||||||
AC_SEARCH_LIBS(event_set, [event])
|
AC_SEARCH_LIBS(event_set, [event])
|
||||||
AC_CHECK_HEADERS([event.h],,, [AC_INCLUDES_DEFAULT])
|
AC_CHECK_HEADERS([event.h],,, [AC_INCLUDES_DEFAULT])
|
||||||
AC_CHECK_FUNCS([event_base_free]) # only in libevent 1.2 and later
|
AC_CHECK_FUNCS([event_base_free]) # only in libevent 1.2 and later
|
||||||
|
AC_CHECK_FUNCS([event_base_once]) # only in libevent 1.4? and later
|
||||||
else
|
else
|
||||||
AC_DEFINE(USE_MINI_EVENT, 1, [Define if you want to use internal select based events])
|
AC_DEFINE(USE_MINI_EVENT, 1, [Define if you want to use internal select based events])
|
||||||
fi
|
fi
|
||||||
@ -519,6 +520,10 @@ AH_BOTTOM([
|
|||||||
#define fseeko fseek
|
#define fseeko fseek
|
||||||
#define ftello ftell
|
#define ftello ftell
|
||||||
#endif /* HAVE_FSEEKO */
|
#endif /* HAVE_FSEEKO */
|
||||||
|
#if defined(HAVE_EVENT_H) && !defined(HAVE_EVENT_BASE_ONCE) && (defined(HAVE_PTHREAD) || defined(HAVE_SOLARIS_THREADS))
|
||||||
|
/* using version of libevent that is not threadsafe. */
|
||||||
|
# define LIBEVENT_SIGNAL_PROBLEM 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef RAND_MAX
|
#ifndef RAND_MAX
|
||||||
#define RAND_MAX 2147483647
|
#define RAND_MAX 2147483647
|
||||||
|
@ -59,6 +59,9 @@ static int sig_record_reload = 0;
|
|||||||
* when multiple signals in quick succession are sent to us. */
|
* when multiple signals in quick succession are sent to us. */
|
||||||
static RETSIGTYPE record_sigh(int sig)
|
static RETSIGTYPE record_sigh(int sig)
|
||||||
{
|
{
|
||||||
|
#ifdef LIBEVENT_SIGNAL_PROBLEM
|
||||||
|
exit(0);
|
||||||
|
#endif
|
||||||
switch(sig)
|
switch(sig)
|
||||||
{
|
{
|
||||||
case SIGTERM:
|
case SIGTERM:
|
||||||
|
@ -323,6 +323,7 @@ worker_init(struct worker* worker, struct config_file *cfg,
|
|||||||
ub_thread_sig_unblock(SIGINT);
|
ub_thread_sig_unblock(SIGINT);
|
||||||
ub_thread_sig_unblock(SIGQUIT);
|
ub_thread_sig_unblock(SIGQUIT);
|
||||||
ub_thread_sig_unblock(SIGTERM);
|
ub_thread_sig_unblock(SIGTERM);
|
||||||
|
#ifndef LIBEVENT_SIGNAL_PROBLEM
|
||||||
worker->comsig = comm_signal_create(worker->base,
|
worker->comsig = comm_signal_create(worker->base,
|
||||||
worker_sighandler, worker);
|
worker_sighandler, worker);
|
||||||
if(!worker->comsig || !comm_signal_bind(worker->comsig, SIGHUP)
|
if(!worker->comsig || !comm_signal_bind(worker->comsig, SIGHUP)
|
||||||
@ -333,6 +334,7 @@ worker_init(struct worker* worker, struct config_file *cfg,
|
|||||||
worker_delete(worker);
|
worker_delete(worker);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif /* LIBEVENT_SIGNAL_PROBLEM */
|
||||||
} else { /* !do_sigs */
|
} else { /* !do_sigs */
|
||||||
worker->comsig = 0;
|
worker->comsig = 0;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
- do not compile fork funcs unless needed. Otherwise will give
|
- do not compile fork funcs unless needed. Otherwise will give
|
||||||
type errors as their typedefs have not been enabled.
|
type errors as their typedefs have not been enabled.
|
||||||
- log shows thread numbers much more nicely (and portably).
|
- log shows thread numbers much more nicely (and portably).
|
||||||
|
- even on systems with nonthreadsafe libevent signal handling,
|
||||||
|
unbound will exit if given a signal.
|
||||||
|
Reloads will not work, and exit is not graceful.
|
||||||
|
|
||||||
1 March 2007: Wouter
|
1 March 2007: Wouter
|
||||||
- Signals, libevent and threads work well, with libevent patch and
|
- Signals, libevent and threads work well, with libevent patch and
|
||||||
|
@ -18,4 +18,11 @@ This software is under BSD license, see LICENSE for details.
|
|||||||
* run libtoolize -c if config.sub is missing.
|
* run libtoolize -c if config.sub is missing.
|
||||||
* autoreconf (autoheader && autoconf), if ./configure is missing.
|
* autoreconf (autoheader && autoconf), if ./configure is missing.
|
||||||
|
|
||||||
|
Known issues
|
||||||
|
------------
|
||||||
|
o If libevent is older (1.3 and before), unbound will exit instead of reload
|
||||||
|
on sighup. On a restart 'did not exit gracefully last time' warning is
|
||||||
|
printed. Perform ./configure --with-libevent=no or update libevent, rerun
|
||||||
|
configure and recompile unbound to make sighup work correctly.
|
||||||
|
|
||||||
* mailto:wouter@nlnetlabs.nl
|
* mailto:wouter@nlnetlabs.nl
|
||||||
|
Loading…
Reference in New Issue
Block a user