Commit b5973eba authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Minor change to signal handler. Changed _shutdown flag to

type 'sig_atomic_t' and marked it volatile.  Add detection to
configure to ensure sig_atomic_t and volatile are supported.
parent 8aba5c50
......@@ -172,6 +172,12 @@
/* define this to use SLAPD shell backend */
#undef SLAPD_SHELL
/* define this to be empty if your compiler doesn't support volatile */
#undef volatile
/* define this if sig_atomic_t isn't defined in signal.h */
#undef sig_atomic_t
/* These are defined in ldap_features.h */
/*
LDAP_API_FEATURE_X_OPENLDAP_REENTRANT
......
......@@ -394,3 +394,32 @@ if test $ol_cv_dcl_sys_errlist = no ; then
AC_MSG_RESULT($ol_cv_have_sys_errlist)
fi
])dnl
dnl ====================================================================
dnl Early MIPS compilers (used in Ultrix 4.2) don't like
dnl "int x; int *volatile a = &x; *a = 0;"
dnl -- borrowed from PDKSH
AC_DEFUN(OL_C_VOLATILE,
[AC_CACHE_CHECK(if compiler understands volatile, ol_cv_c_volatile,
[AC_TRY_COMPILE([int x, y, z;],
[volatile int a; int * volatile b = x ? &y : &z;
/* Older MIPS compilers (eg., in Ultrix 4.2) don't like *b = 0 */
*b = 0;], ol_cv_c_volatile=yes, ol_cv_c_volatile=no)])
if test $ol_cv_c_volatile = yes; then
:
else
AC_DEFINE(volatile, )
fi
])dnl
dnl ====================================================================
dnl Define sig_atomic_t if not defined in signal.h
AC_DEFUN(OL_TYPE_SIG_ATOMIC_T,
[AC_CACHE_CHECK(for sig_atomic_t, ol_cv_type_sig_atomic_t,
[AC_TRY_COMPILE([#include <signal.h>], [sig_atomic_t atomic;],
ol_cv_type_sig_atomic_t=yes, ol_cv_type_sig_atomic_t=no)])
if test $ol_cv_type_sig_atomic_t = no; then
AC_DEFINE(sig_atomic_t, int)
fi
])dnl
This diff is collapsed.
......@@ -1102,6 +1102,7 @@ AC_TYPE_OFF_T
AC_TYPE_PID_T
AM_TYPE_PTRDIFF_T
AC_TYPE_SIGNAL
OL_TYPE_SIG_ATOMIC_T
AC_TYPE_SIZE_T
AC_STRUCT_ST_BLKSIZE
AC_HEADER_TIME
......@@ -1109,6 +1110,7 @@ AC_STRUCT_TM
OL_C_UPPER_LOWER
AC_C_CONST
OL_C_VOLATILE
if test $cross_compiling = yes ; then
AC_DEFINE(CROSS_COMPILING, 1)
......
......@@ -261,6 +261,12 @@ is provided ``as is'' without express or implied warranty.
/* define this to use SLAPD shell backend */
#undef SLAPD_SHELL
/* define this to be empty if your compiler doesn't support volatile */
#undef volatile
/* define this if sig_atomic_t isn't defined in signal.h */
#undef sig_atomic_t
/* These are defined in ldap_features.h */
/*
LDAP_API_FEATURE_X_OPENLDAP_REENTRANT
......
......@@ -36,6 +36,7 @@ int deny_severity = LOG_NOTICE;
int dtblsize;
Connection *c;
static volatile sig_atomic_t slapd_shutdown = 0;
static void set_shutdown(int sig);
static void do_nothing (int sig);
......
......@@ -24,7 +24,6 @@ int ldap_syslog;
#endif
int ldap_syslog_level = LOG_DEBUG;
int udp;
int slapd_shutdown;
char *default_referral;
char *configfile;
time_t starttime;
......
......@@ -234,7 +234,6 @@ extern int global_schemacheck;
extern int lber_debug;
extern int ldap_syslog;
extern int num_conns;
extern int slapd_shutdown;
extern long num_bytes_sent;
extern long num_entries_sent;
extern long ops_completed;
......
......@@ -29,7 +29,7 @@ typedef struct globals {
/* How long the master slurpd sleeps when there's no work to do */
int no_work_interval;
/* We keep running until slurpd_shutdown is nonzero. HUP signal set this */
int slurpd_shutdown;
sig_atomic_t slurpd_shutdown;
/* Number of replicas we're servicing */
int num_replicas;
/* Array of pointers to replica info */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment