Remove all support for other signal interfaces.
Pulled in from nmh. Thanks to Ken Hornstein.
dnl ---------------
dnl CHECK FUNCTIONS
dnl ---------------
-AC_CHECK_FUNCS(sigaction sigprocmask sigblock sigsetmask \
- sighold sigrelse lstat tzset \
- getutent nl_langinfo mbtowc wcwidth)
+AC_CHECK_FUNCS(lstat tzset getutent nl_langinfo mbtowc wcwidth)
dnl Look for the initgroups() declaration. On AIX 4.[13], Solaris 4.1.3, and
dnl ULTRIX 4.2A the function is defined in libc but there's no declaration in
AC_TYPE_MODE_T
AC_TYPE_SIZE_T
-dnl Check for sigset_t. Currently I'm looking in
-dnl <sys/types.h> and <signal.h>. Others might need
-dnl to be added.
-AC_CACHE_CHECK(for sigset_t, nmh_cv_type_sigset_t,
-[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
-#include <signal.h>]], [[sigset_t tempsigset;]])],
-nmh_cv_type_sigset_t=yes,nmh_cv_type_sigset_t=no)])
-if test $nmh_cv_type_sigset_t = no; then
- AC_DEFINE(sigset_t, unsigned int,
- [Define to `unsigned int' if <sys/types.h> or <signal.h> doesn't define.])
-fi
-
dnl ----------------
dnl CHECK STRUCTURES
dnl ----------------
AC_STRUCT_DIRENT_D_TYPE
-dnl -------------
-dnl CHECK SIGNALS
-dnl -------------
-dnl What style of signal do you have (POSIX, BSD, or SYSV)?
-AH_TEMPLATE(RELIABLE_SIGNALS, [Define to 1 if you have reliable signals.])
-AC_MSG_CHECKING(what style of signals to use)
-if test $ac_cv_func_sigaction = yes -a $ac_cv_func_sigprocmask = yes; then
- signals_style=POSIX_SIGNALS
- AC_DEFINE(POSIX_SIGNALS, 1,
- [Define to 1 if you use POSIX style signal handling.])
- AC_DEFINE(RELIABLE_SIGNALS)
-elif test $ac_cv_func_sigblock = yes -a $ac_cv_func_sigsetmask = yes; then
- signals_style=BSD_SIGNALS
- AC_DEFINE(BSD_SIGNALS,1,
- [Define to 1 if you use BSD style signal handling (and can block signals).])
- AC_DEFINE(RELIABLE_SIGNALS)
-elif test $ac_cv_func_sighold = yes -a $ac_cv_func_sigrelse = yes; then
- signals_style=SYSV_SIGNALS
- AC_DEFINE(SYSV_SIGNALS,1,
- [Define to 1 if you use SYSV style signal handling (and can block signals).])
-else
- signals_style=NO_SIGNAL_BLOCKING
- AC_DEFINE(NO_SIGNAL_BLOCKING,1,
- [Define to 1 if you have no signal blocking at all (bummer).])
-fi
-
-AC_MSG_RESULT($signals_style)
-
dnl Where is <signal.h> located? Needed as input for signames.awk
AC_CACHE_CHECK(where signal.h is located, nmh_cv_path_signal_h,
[for SIGNAL_H in /usr/include/bsd/sys/signal.h dnl Next
typedef void (*SIGNAL_HANDLER)(int);
/*
-** If not a POSIX machine, then we create our
-** own POSIX style signal sets functions. This
-** currently assumes you have 31 signals, which
-** should be true on most pure BSD machines.
-*/
-#ifndef POSIX_SIGNALS
-# define sigemptyset(s) (*(s) = 0)
-# define sigfillset(s) (*(s) = ~((sigset_t) 0), 0)
-# define sigaddset(s,n) (*(s) |= (1 << ((n) - 1)), 0)
-# define sigdelset(s,n) (*(s) &= ~(1 << ((n) - 1)), 0)
-# define sigismember(s,n) ((*(s) & (1 << ((n) - 1))) != 0)
-#endif
-
-/*
** prototypes
*/
-int SIGPROCMASK(int, const sigset_t *, sigset_t *);
SIGNAL_HANDLER SIGNAL(int, SIGNAL_HANDLER);
SIGNAL_HANDLER SIGNAL2(int, SIGNAL_HANDLER);
sigaddset(&set, SIGINT);
sigaddset(&set, SIGQUIT);
sigaddset(&set, SIGTERM);
- SIGPROCMASK(SIG_BLOCK, &set, &oset);
+ sigprocmask(SIG_BLOCK, &set, &oset);
if (!(out = lkfopen(ctxpath, "w")))
adios(ctxpath, "unable to write");
fprintf(out, "%s: %s\n", np->n_name, np->n_field);
lkfclose(out, ctxpath);
- SIGPROCMASK(SIG_SETMASK, &oset, &set); /* reset the signal mask */
+ sigprocmask(SIG_SETMASK, &oset, &set); /* reset the signal mask */
if (action == 0)
_exit(0); /* we are child, time to die */
char *lockfile;
struct lock *lp;
-#ifndef RELIABLE_SIGNALS
- SIGNAL(SIGALRM, alrmser);
-#endif
-
/* update the ctime of all the lock files */
for (lp = l_top; lp; lp = lp->l_next) {
lockfile = lp->l_lock;
sigaddset(&set, SIGINT);
sigaddset(&set, SIGQUIT);
sigaddset(&set, SIGTERM);
- SIGPROCMASK(SIG_BLOCK, &set, &oset);
+ sigprocmask(SIG_BLOCK, &set, &oset);
}
fprintf(fp, "%s: %s\n", mp->msgattrs[i], cp);
}
if (fp) {
lkfclose(fp, seqfile);
- SIGPROCMASK(SIG_SETMASK, &oset, &set); /* reset signal mask */
+ sigprocmask(SIG_SETMASK, &oset, &set); /* reset signal mask */
} else {
/*
** If folder is not readonly, and we didn't save any
#include <h/signals.h>
-int
-SIGPROCMASK(int how, const sigset_t *set, sigset_t *oset)
-{
-#ifdef POSIX_SIGNALS
- return sigprocmask(how, set, oset);
-#else
-# ifdef BSD_SIGNALS
- switch(how) {
- case SIG_BLOCK:
- *oset = sigblock(*set);
- break;
- case SIG_UNBLOCK:
- sigfillset(*oset);
- *oset = sigsetmask(*oset);
- sigsetmask(*oset & ~(*set));
- break;
- case SIG_SETMASK:
- *oset = sigsetmask(*set);
- break;
- default:
- adios(NULL, "unknown flag in SIGPROCMASK");
- break;
- }
- return 0;
-# endif
-#endif
-}
-
-
/*
** A version of the function `signal' that uses reliable
** signals, if the machine supports them. Also, (assuming
** OS support), it restarts interrupted system calls for all
** signals except SIGALRM.
+**
+** Since we are now assuming POSIX signal support everywhere, we always
+** use reliable signals.
*/
SIGNAL_HANDLER
SIGNAL(int sig, SIGNAL_HANDLER func)
{
-#ifdef POSIX_SIGNALS
struct sigaction act, oact;
act.sa_handler = func;
if (sigaction(sig, &act, &oact) < 0)
return (SIG_ERR);
return (oact.sa_handler);
-#else
- return signal(sig, func);
-#endif
}
SIGNAL_HANDLER
SIGNAL2(int sig, SIGNAL_HANDLER func)
{
-#ifdef POSIX_SIGNALS
struct sigaction act, oact;
if (sigaction(sig, NULL, &oact) < 0)
return (SIG_ERR);
}
return (oact.sa_handler);
-#else
- SIGNAL_HANDLER ofunc;
-
- if ((ofunc = signal(sig, SIG_IGN)) != SIG_IGN)
- signal(sig, func);
- return ofunc;
-#endif
}
static void
intrser(int i)
{
-#ifndef RELIABLE_SIGNALS
- SIGNAL(SIGINT, intrser);
-#endif
-
discard(stdout);
putchar('\n');
longjmp(env, DONE);
static void
pipeser(int i)
{
-#ifndef RELIABLE_SIGNALS
- SIGNAL(SIGPIPE, pipeser);
-#endif
-
done(NOTOK);
}
static void
quitser(int i)
{
-#ifndef RELIABLE_SIGNALS
- SIGNAL(SIGQUIT, quitser);
-#endif
-
putchar('\n');
fflush(stdout);
done(NOTOK);
static void
intrser(int i)
{
-#ifndef RELIABLE_SIGNALS
- if (i)
- SIGNAL(i, SIG_IGN);
-#endif
-
unlink(tmpfil);
done(i != 0 ? 1 : 0);
}
sigaddset(&set, SIGINT);
sigaddset(&set, SIGQUIT);
sigaddset(&set, SIGTERM);
- SIGPROCMASK(SIG_BLOCK, &set, &oset);
+ sigprocmask(SIG_BLOCK, &set, &oset);
while (wait(&status) != NOTOK) {
pidcheck(status);
}
/* reset the signal mask */
- SIGPROCMASK(SIG_SETMASK, &oset, &set);
+ sigprocmask(SIG_SETMASK, &oset, &set);
xpid = 0;
flush_errors();
sigaddset(&set, SIGINT);
sigaddset(&set, SIGQUIT);
sigaddset(&set, SIGTERM);
- SIGPROCMASK(SIG_BLOCK, &set, &oset);
+ sigprocmask(SIG_BLOCK, &set, &oset);
}
/*
out:
if (!nowserial) {
/* reset the signal mask */
- SIGPROCMASK(SIG_SETMASK, &oset, &set);
+ sigprocmask(SIG_SETMASK, &oset, &set);
}
return result;
static void
intrser(int i)
{
-#ifndef RELIABLE_SIGNALS
- SIGNAL(SIGINT, intrser);
-#endif
-
if (wtuser)
longjmp(sigenv, NOTOK);
sigint++;
static void
alrmser(int i)
{
-#ifndef RELIABLE_SIGNALS
- SIGNAL(SIGALRM, alrmser);
-#endif
-
longjmp(myctx, DONE);
}