1N/A/*
1N/A * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
1N/A * All rights reserved.
1N/A * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
1N/A * Copyright (c) 1988, 1993
1N/A * The Regents of the University of California. All rights reserved.
1N/A *
1N/A * By using this file, you agree to the terms and conditions set
1N/A * forth in the LICENSE file which can be found at the top level of
1N/A * the sendmail distribution.
1N/A *
1N/A * $Id: signal.h,v 1.16 2001/07/20 19:48:21 gshapiro Exp $
1N/A */
1N/A
1N/A#pragma ident "%Z%%M% %I% %E% SMI"
1N/A
1N/A/*
1N/A** SIGNAL.H -- libsm (and sendmail) signal facilities
1N/A** Extracted from sendmail/conf.h and focusing
1N/A** on signal configuration.
1N/A*/
1N/A
1N/A#ifndef SM_SIGNAL_H
1N/A#define SM_SIGNAL_H 1
1N/A
1N/A#include <sys/types.h>
1N/A#include <limits.h>
1N/A#include <signal.h>
1N/A#include <sm/cdefs.h>
1N/A#include <sm/conf.h>
1N/A
1N/A/*
1N/A** Critical signal sections
1N/A*/
1N/A
1N/A#define PEND_SIGHUP 0x0001
1N/A#define PEND_SIGINT 0x0002
1N/A#define PEND_SIGTERM 0x0004
1N/A#define PEND_SIGUSR1 0x0008
1N/A
1N/A#define ENTER_CRITICAL() InCriticalSection++
1N/A
1N/A#define LEAVE_CRITICAL() \
1N/Ado \
1N/A{ \
1N/A if (InCriticalSection > 0) \
1N/A InCriticalSection--; \
1N/A} while (0)
1N/A
1N/A#define CHECK_CRITICAL(sig) \
1N/Ado \
1N/A{ \
1N/A if (InCriticalSection > 0 && (sig) != 0) \
1N/A { \
1N/A pend_signal((sig)); \
1N/A return SIGFUNC_RETURN; \
1N/A } \
1N/A} while (0)
1N/A
1N/A/* variables */
1N/Aextern unsigned int volatile InCriticalSection; /* >0 if in critical section */
1N/Aextern int volatile PendingSignal; /* pending signal to resend */
1N/A
1N/A/* functions */
1N/Aextern void pend_signal __P((int));
1N/A
1N/A/* reset signal in case System V semantics */
1N/A#ifdef SYS5SIGNALS
1N/A# define FIX_SYSV_SIGNAL(sig, handler) \
1N/A{ \
1N/A if ((sig) != 0) \
1N/A (void) sm_signal((sig), (handler)); \
1N/A}
1N/A#else /* SYS5SIGNALS */
1N/A# define FIX_SYSV_SIGNAL(sig, handler) { /* EMPTY */ }
1N/A#endif /* SYS5SIGNALS */
1N/A
1N/Aextern void sm_allsignals __P((bool));
1N/Aextern int sm_blocksignal __P((int));
1N/Aextern int sm_releasesignal __P((int));
1N/Aextern sigfunc_t sm_signal __P((int, sigfunc_t));
1N/Aextern SIGFUNC_DECL sm_signal_noop __P((int));
1N/A#endif /* SM_SIGNAL_H */