Whamcloud - gitweb
git://git.whamcloud.com
/
tools
/
e2fsprogs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tests: dumpe2fs against an image with bad os_type
[tools/e2fsprogs.git]
/
e2fsck
/
sigcatcher.c
diff --git
a/e2fsck/sigcatcher.c
b/e2fsck/sigcatcher.c
index
83f912d
..
a9d3b7f
100644
(file)
--- a/
e2fsck/sigcatcher.c
+++ b/
e2fsck/sigcatcher.c
@@
-9,6
+9,7
@@
* %End-Header%
*/
* %End-Header%
*/
+#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
@@
-28,121
+29,285
@@
struct str_table {
#define END_TABLE { 0, 0 }
static struct str_table sig_table[] = {
#define END_TABLE { 0, 0 }
static struct str_table sig_table[] = {
+#ifdef SIGHUP
DEFINE_ENTRY(SIGHUP)
DEFINE_ENTRY(SIGHUP)
+#endif
+#ifdef SIGINT
DEFINE_ENTRY(SIGINT)
DEFINE_ENTRY(SIGINT)
+#endif
+#ifdef SIGQUIT
DEFINE_ENTRY(SIGQUIT)
DEFINE_ENTRY(SIGQUIT)
+#endif
+#ifdef SIGILL
DEFINE_ENTRY(SIGILL)
DEFINE_ENTRY(SIGILL)
+#endif
+#ifdef SIGTRAP
DEFINE_ENTRY(SIGTRAP)
DEFINE_ENTRY(SIGTRAP)
+#endif
+#ifdef SIGABRT
DEFINE_ENTRY(SIGABRT)
DEFINE_ENTRY(SIGABRT)
+#endif
+#ifdef SIGIOT
DEFINE_ENTRY(SIGIOT)
DEFINE_ENTRY(SIGIOT)
+#endif
+#ifdef SIGBUS
DEFINE_ENTRY(SIGBUS)
DEFINE_ENTRY(SIGBUS)
+#endif
+#ifdef SIGFPE
DEFINE_ENTRY(SIGFPE)
DEFINE_ENTRY(SIGFPE)
+#endif
+#ifdef SIGKILL
DEFINE_ENTRY(SIGKILL)
DEFINE_ENTRY(SIGKILL)
+#endif
+#ifdef SIGUSR1
DEFINE_ENTRY(SIGUSR1)
DEFINE_ENTRY(SIGUSR1)
+#endif
+#ifdef SIGSEGV
DEFINE_ENTRY(SIGSEGV)
DEFINE_ENTRY(SIGSEGV)
+#endif
+#ifdef SIGUSR2
DEFINE_ENTRY(SIGUSR2)
DEFINE_ENTRY(SIGUSR2)
+#endif
+#ifdef SIGPIPE
DEFINE_ENTRY(SIGPIPE)
DEFINE_ENTRY(SIGPIPE)
+#endif
+#ifdef SIGALRM
DEFINE_ENTRY(SIGALRM)
DEFINE_ENTRY(SIGALRM)
+#endif
+#ifdef SIGTERM
DEFINE_ENTRY(SIGTERM)
DEFINE_ENTRY(SIGTERM)
+#endif
+#ifdef SIGSTKFLT
DEFINE_ENTRY(SIGSTKFLT)
DEFINE_ENTRY(SIGSTKFLT)
+#endif
+#ifdef SIGCHLD
DEFINE_ENTRY(SIGCHLD)
DEFINE_ENTRY(SIGCHLD)
+#endif
+#ifdef SIGCONT
DEFINE_ENTRY(SIGCONT)
DEFINE_ENTRY(SIGCONT)
+#endif
+#ifdef SIGSTOP
DEFINE_ENTRY(SIGSTOP)
DEFINE_ENTRY(SIGSTOP)
+#endif
+#ifdef SIGTSTP
DEFINE_ENTRY(SIGTSTP)
DEFINE_ENTRY(SIGTSTP)
+#endif
+#ifdef SIGTTIN
DEFINE_ENTRY(SIGTTIN)
DEFINE_ENTRY(SIGTTIN)
+#endif
+#ifdef SIGTTOU
DEFINE_ENTRY(SIGTTOU)
DEFINE_ENTRY(SIGTTOU)
+#endif
+#ifdef SIGURG
DEFINE_ENTRY(SIGURG)
DEFINE_ENTRY(SIGURG)
+#endif
+#ifdef SIGXCPU
DEFINE_ENTRY(SIGXCPU)
DEFINE_ENTRY(SIGXCPU)
+#endif
+#ifdef SIGXFSZ
DEFINE_ENTRY(SIGXFSZ)
DEFINE_ENTRY(SIGXFSZ)
+#endif
+#ifdef SIGVTALRM
DEFINE_ENTRY(SIGVTALRM)
DEFINE_ENTRY(SIGVTALRM)
+#endif
+#ifdef SIGPROF
DEFINE_ENTRY(SIGPROF)
DEFINE_ENTRY(SIGPROF)
+#endif
+#ifdef SIGWINCH
DEFINE_ENTRY(SIGWINCH)
DEFINE_ENTRY(SIGWINCH)
+#endif
+#ifdef SIGIO
DEFINE_ENTRY(SIGIO)
DEFINE_ENTRY(SIGIO)
+#endif
+#ifdef SIGPOLL
DEFINE_ENTRY(SIGPOLL)
DEFINE_ENTRY(SIGPOLL)
+#endif
+#ifdef SIGPWR
DEFINE_ENTRY(SIGPWR)
DEFINE_ENTRY(SIGPWR)
+#endif
+#ifdef SIGSYS
DEFINE_ENTRY(SIGSYS)
DEFINE_ENTRY(SIGSYS)
+#endif
END_TABLE
};
static struct str_table generic_code_table[] = {
END_TABLE
};
static struct str_table generic_code_table[] = {
+#ifdef SI_ASYNCNL
DEFINE_ENTRY(SI_ASYNCNL)
DEFINE_ENTRY(SI_ASYNCNL)
+#endif
+#ifdef SI_TKILL
DEFINE_ENTRY(SI_TKILL)
DEFINE_ENTRY(SI_TKILL)
+#endif
+#ifdef SI_SIGIO
DEFINE_ENTRY(SI_SIGIO)
DEFINE_ENTRY(SI_SIGIO)
+#endif
+#ifdef SI_ASYNCIO
DEFINE_ENTRY(SI_ASYNCIO)
DEFINE_ENTRY(SI_ASYNCIO)
+#endif
+#ifdef SI_MESGQ
DEFINE_ENTRY(SI_MESGQ)
DEFINE_ENTRY(SI_MESGQ)
+#endif
+#ifdef SI_TIMER
DEFINE_ENTRY(SI_TIMER)
DEFINE_ENTRY(SI_TIMER)
+#endif
+#ifdef SI_QUEUE
DEFINE_ENTRY(SI_QUEUE)
DEFINE_ENTRY(SI_QUEUE)
+#endif
+#ifdef SI_USER
DEFINE_ENTRY(SI_USER)
DEFINE_ENTRY(SI_USER)
+#endif
+#ifdef SI_KERNEL
DEFINE_ENTRY(SI_KERNEL)
DEFINE_ENTRY(SI_KERNEL)
+#endif
END_TABLE
};
static struct str_table sigill_code_table[] = {
END_TABLE
};
static struct str_table sigill_code_table[] = {
+#ifdef ILL_ILLOPC
DEFINE_ENTRY(ILL_ILLOPC)
DEFINE_ENTRY(ILL_ILLOPC)
+#endif
+#ifdef ILL_ILLOPN
DEFINE_ENTRY(ILL_ILLOPN)
DEFINE_ENTRY(ILL_ILLOPN)
+#endif
+#ifdef ILL_ILLADR
DEFINE_ENTRY(ILL_ILLADR)
DEFINE_ENTRY(ILL_ILLADR)
+#endif
+#ifdef ILL_ILLTRP
DEFINE_ENTRY(ILL_ILLTRP)
DEFINE_ENTRY(ILL_ILLTRP)
+#endif
+#ifdef ILL_PRVOPC
DEFINE_ENTRY(ILL_PRVOPC)
DEFINE_ENTRY(ILL_PRVOPC)
+#endif
+#ifdef ILL_PRVREG
DEFINE_ENTRY(ILL_PRVREG)
DEFINE_ENTRY(ILL_PRVREG)
+#endif
+#ifdef ILL_COPROC
DEFINE_ENTRY(ILL_COPROC)
DEFINE_ENTRY(ILL_COPROC)
+#endif
+#ifdef ILL_BADSTK
DEFINE_ENTRY(ILL_BADSTK)
DEFINE_ENTRY(ILL_BADSTK)
+#endif
+#ifdef BUS_ADRALN
DEFINE_ENTRY(BUS_ADRALN)
DEFINE_ENTRY(BUS_ADRALN)
+#endif
+#ifdef BUS_ADRERR
DEFINE_ENTRY(BUS_ADRERR)
DEFINE_ENTRY(BUS_ADRERR)
+#endif
+#ifdef BUS_OBJERR
DEFINE_ENTRY(BUS_OBJERR)
DEFINE_ENTRY(BUS_OBJERR)
+#endif
END_TABLE
};
static struct str_table sigfpe_code_table[] = {
END_TABLE
};
static struct str_table sigfpe_code_table[] = {
+#ifdef FPE_INTDIV
DEFINE_ENTRY(FPE_INTDIV)
DEFINE_ENTRY(FPE_INTDIV)
+#endif
+#ifdef FPE_INTOVF
DEFINE_ENTRY(FPE_INTOVF)
DEFINE_ENTRY(FPE_INTOVF)
+#endif
+#ifdef FPE_FLTDIV
DEFINE_ENTRY(FPE_FLTDIV)
DEFINE_ENTRY(FPE_FLTDIV)
+#endif
+#ifdef FPE_FLTOVF
DEFINE_ENTRY(FPE_FLTOVF)
DEFINE_ENTRY(FPE_FLTOVF)
+#endif
+#ifdef FPE_FLTUND
DEFINE_ENTRY(FPE_FLTUND)
DEFINE_ENTRY(FPE_FLTUND)
+#endif
+#ifdef FPE_FLTRES
DEFINE_ENTRY(FPE_FLTRES)
DEFINE_ENTRY(FPE_FLTRES)
+#endif
+#ifdef FPE_FLTINV
DEFINE_ENTRY(FPE_FLTINV)
DEFINE_ENTRY(FPE_FLTINV)
+#endif
+#ifdef FPE_FLTSUB
DEFINE_ENTRY(FPE_FLTSUB)
DEFINE_ENTRY(FPE_FLTSUB)
+#endif
END_TABLE
};
static struct str_table sigsegv_code_table[] = {
END_TABLE
};
static struct str_table sigsegv_code_table[] = {
+#ifdef SEGV_MAPERR
DEFINE_ENTRY(SEGV_MAPERR)
DEFINE_ENTRY(SEGV_MAPERR)
+#endif
+#ifdef SEGV_ACCERR
DEFINE_ENTRY(SEGV_ACCERR)
DEFINE_ENTRY(SEGV_ACCERR)
+#endif
END_TABLE
};
static struct str_table sigbus_code_table[] = {
END_TABLE
};
static struct str_table sigbus_code_table[] = {
+#ifdef BUS_ADRALN
DEFINE_ENTRY(BUS_ADRALN)
DEFINE_ENTRY(BUS_ADRALN)
+#endif
+#ifdef BUS_ADRERR
DEFINE_ENTRY(BUS_ADRERR)
DEFINE_ENTRY(BUS_ADRERR)
+#endif
+#ifdef BUS_OBJERR
DEFINE_ENTRY(BUS_OBJERR)
DEFINE_ENTRY(BUS_OBJERR)
+#endif
END_TABLE
};
END_TABLE
};
+#if 0 /* should this be hooked in somewhere? */
static struct str_table sigstrap_code_table[] = {
static struct str_table sigstrap_code_table[] = {
+#ifdef TRAP_BRKPT
DEFINE_ENTRY(TRAP_BRKPT)
DEFINE_ENTRY(TRAP_BRKPT)
+#endif
+#ifdef TRAP_TRACE
DEFINE_ENTRY(TRAP_TRACE)
DEFINE_ENTRY(TRAP_TRACE)
+#endif
END_TABLE
};
END_TABLE
};
+#endif
static struct str_table sigcld_code_table[] = {
static struct str_table sigcld_code_table[] = {
+#ifdef CLD_EXITED
DEFINE_ENTRY(CLD_EXITED)
DEFINE_ENTRY(CLD_EXITED)
+#endif
+#ifdef CLD_KILLED
DEFINE_ENTRY(CLD_KILLED)
DEFINE_ENTRY(CLD_KILLED)
+#endif
+#ifdef CLD_DUMPED
DEFINE_ENTRY(CLD_DUMPED)
DEFINE_ENTRY(CLD_DUMPED)
+#endif
+#ifdef CLD_TRAPPED
DEFINE_ENTRY(CLD_TRAPPED)
DEFINE_ENTRY(CLD_TRAPPED)
+#endif
+#ifdef CLD_STOPPED
DEFINE_ENTRY(CLD_STOPPED)
DEFINE_ENTRY(CLD_STOPPED)
+#endif
+#ifdef CLD_CONTINUED
DEFINE_ENTRY(CLD_CONTINUED)
DEFINE_ENTRY(CLD_CONTINUED)
+#endif
END_TABLE
};
END_TABLE
};
+#if 0 /* should this be hooked in somewhere? */
static struct str_table sigpoll_code_table[] = {
static struct str_table sigpoll_code_table[] = {
+#ifdef POLL_IN
DEFINE_ENTRY(POLL_IN)
DEFINE_ENTRY(POLL_IN)
+#endif
+#ifdef POLL_OUT
DEFINE_ENTRY(POLL_OUT)
DEFINE_ENTRY(POLL_OUT)
+#endif
+#ifdef POLL_MSG
DEFINE_ENTRY(POLL_MSG)
DEFINE_ENTRY(POLL_MSG)
+#endif
+#ifdef POLL_ERR
DEFINE_ENTRY(POLL_ERR)
DEFINE_ENTRY(POLL_ERR)
+#endif
+#ifdef POLL_PRI
DEFINE_ENTRY(POLL_PRI)
DEFINE_ENTRY(POLL_PRI)
+#endif
+#ifdef POLL_HUP
DEFINE_ENTRY(POLL_HUP)
DEFINE_ENTRY(POLL_HUP)
+#endif
END_TABLE
};
END_TABLE
};
+#endif
static const char *lookup_table(int num, struct str_table *table)
{
static const char *lookup_table(int num, struct str_table *table)
{
@@
-166,10
+331,9
@@
static const char *lookup_table_fallback(int num, struct str_table *table)
return buf;
}
return buf;
}
-static void die_signal_handler(int signum, siginfo_t *siginfo, void *context)
+static void die_signal_handler(int signum, siginfo_t *siginfo,
+ void *context EXT2FS_ATTR((unused)))
{
{
- void *stack_syms[32];
- int frames;
const char *cp;
fprintf(stderr, "Signal (%d) %s ", signum,
const char *cp;
fprintf(stderr, "Signal (%d) %s ", signum,
@@
-195,7
+359,7
@@
static void die_signal_handler(int signum, siginfo_t *siginfo, void *context)
fprintf(stderr, "si_code=%s ",
lookup_table_fallback(siginfo->si_code,
sigbus_code_table));
fprintf(stderr, "si_code=%s ",
lookup_table_fallback(siginfo->si_code,
sigbus_code_table));
- else if (signum == SIGCLD)
+ else if (signum == SIGC
H
LD)
fprintf(stderr, "si_code=%s ",
lookup_table_fallback(siginfo->si_code,
sigcld_code_table));
fprintf(stderr, "si_code=%s ",
lookup_table_fallback(siginfo->si_code,
sigcld_code_table));
@@
-207,9
+371,14
@@
static void die_signal_handler(int signum, siginfo_t *siginfo, void *context)
fprintf(stderr, "fault addr=%p", siginfo->si_addr);
fprintf(stderr, "\n");
fprintf(stderr, "fault addr=%p", siginfo->si_addr);
fprintf(stderr, "\n");
-#ifdef HAVE_BACKTRACE
- frames = backtrace(stack_syms, 32);
- backtrace_symbols_fd(stack_syms, frames, 2);
+#if defined(HAVE_BACKTRACE) && !defined(DISABLE_BACKTRACE)
+ {
+ void *stack_syms[32];
+ int frames;
+
+ frames = backtrace(stack_syms, 32);
+ backtrace_symbols_fd(stack_syms, frames, 2);
+ }
#endif
exit(FSCK_ERROR);
}
#endif
exit(FSCK_ERROR);
}
@@
-226,6
+395,7
@@
void sigcatcher_setup(void)
sigaction(SIGILL, &sa, 0);
sigaction(SIGBUS, &sa, 0);
sigaction(SIGSEGV, &sa, 0);
sigaction(SIGILL, &sa, 0);
sigaction(SIGBUS, &sa, 0);
sigaction(SIGSEGV, &sa, 0);
+ sigaction(SIGABRT, &sa, 0);
}
}