Portability of this code needs to tested.
; /* NULL */
#endif
- (void) SIGNAL( SIGCHLD, wait4child );
+ (void) SIGNAL_REINSTALL ( SIGCHLD, wait4child );
}
static void
; /* NULL */
#endif
- (void) SIGNAL( SIGCHLD, wait4child );
+ (void) SIGNAL_REINSTALL ( SIGCHLD, wait4child );
}
static void
fflush(stdout);
printf("\n\n INTERRUPTED!\n");
- (void) SIGNAL (SIGINT, attn);
+ (void) SIGNAL_REINSTALL (SIGINT, attn);
longjmp(env, 1);
}
col_size = win.ws_col;
}
- (void) SIGNAL (SIGWINCH, chwinsz);
+ (void) SIGNAL_REINSTALL (SIGWINCH, chwinsz);
}
#endif
#include <signal.h>
#undef SIGNAL
-#ifdef HAVE_SIGSET
+
+#if defined( HAVE_SIGACTION )
+#define SIGNAL lutil_sigaction
+typedef void (*lutil_sig_t)(int);
+LDAP_LUTIL_F(lutil_sig_t) lutil_sigaction( int sig, sig_t func );
+#define SIGNAL_REINSTALL(sig,act) (void)0
+#elif defined( HAVE_SIGSET )
#define SIGNAL sigset
+#define SIGNAL_REINSTALL sigset
#else
#define SIGNAL signal
+#define SIGNAL_REINSTALL signal
#endif
#if !defined( LDAP_SIGUSR1 ) || !defined( LDAP_SIGUSR2 )
UNIX_SRCS = detach.c
UNIX_OBJS = detach.o
-SRCS = base64.c debug.c entropy.c sasl.c \
+SRCS = base64.c debug.c entropy.c sasl.c signal.c \
md5.c passwd.c sha1.c getpass.c lockf.c utils.c sockpair.c \
@LIBSRCS@ $(@PLAT@_SRCS)
-OBJS = base64.o debug.o entropy.o sasl.o \
+OBJS = base64.o debug.o entropy.o sasl.o signal.o \
md5.o passwd.o sha1.o getpass.o lockf.o utils.o sockpair.o \
@LIBOBJS@ $(@PLAT@_OBJS)
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 2000 The OpenLDAP Foundation
+ * COPYING RESTRICTIONS APPLY. See COPYRIGHT File in top level directory
+ * of this package for details.
+ */
+
+#include "portable.h"
+
+#ifdef HAVE_SIGACTION
+#include <ac/signal.h>
+
+lutil_sig_t
+lutil_sigaction(int sig, lutil_sig_t func)
+{
+ int rc;
+ struct sigaction action, oaction;
+
+ memset( &action, '\0', sizeof(action) );
+
+ action.sa_handler = func;
+ sigemptyset( &action.sa_mask );
+#ifdef SA_RESTART
+ action.sa_flags != SA_RESTART;
+#endif
+
+ if( sigaction( sig, &action, &oaction ) != 0 ) {
+ return NULL;
+ }
+
+ return oaction.sa_handler;
+}
+#endif
WAKE_LISTENER(1);
/* reinstall self */
- (void) SIGNAL( sig, slap_sig_shutdown );
+ (void) SIGNAL_REINSTALL( sig, slap_sig_shutdown );
}
RETSIGTYPE
WAKE_LISTENER(1);
/* reinstall self */
- (void) SIGNAL( sig, slap_sig_wake );
+ (void) SIGNAL_REINSTALL( sig, slap_sig_wake );
}
#else
(void) wait( NULL );
#endif
- (void) SIGNAL( sig, wait4child );
+ (void) SIGNAL_REINSTALL( sig, wait4child );
errno = save_errno;
}
do_admin( int sig )
{
sglob->rq->rq_dump( sglob->rq );
- (void) SIGNAL( sig, do_admin );
+ (void) SIGNAL_REINSTALL( sig, do_admin );
}
(sglob->replicas[ i ])->ri_wake( sglob->replicas[ i ]);
}
sglob->rq->rq_unlock( sglob->rq ); /* unlock queue */
- (void) SIGNAL( sig, set_shutdown ); /* reinstall handlers */
+ (void) SIGNAL_REINSTALL( sig, set_shutdown ); /* reinstall handlers */
}
RETSIGTYPE
do_nothing(int sig)
{
- (void) SIGNAL( sig, do_nothing );
+ (void) SIGNAL_REINSTALL( sig, do_nothing );
}