From 0cd0626de019c8ca288ed8a61a053c0f485c5c5c Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Wed, 1 Mar 2006 01:07:04 +0900 Subject: [PATCH] server: Print a message if wineserver crashes and we don't dump cores. --- configure | 2 ++ configure.ac | 1 + include/config.h.in | 3 +++ server/signal.c | 26 ++++++++++++++++++++++++++ 4 files changed, 32 insertions(+) diff --git a/configure b/configure index 392808f4e6f..9e163c84089 100755 --- a/configure +++ b/configure @@ -7036,6 +7036,7 @@ done + for ac_header in \ @@ -7119,6 +7120,7 @@ for ac_header in \ sys/poll.h \ sys/ptrace.h \ sys/reg.h \ + sys/resource.h \ sys/scsiio.h \ sys/shm.h \ sys/signal.h \ diff --git a/configure.ac b/configure.ac index e88d337001b..f2f910daa1d 100644 --- a/configure.ac +++ b/configure.ac @@ -252,6 +252,7 @@ AC_CHECK_HEADERS(\ sys/poll.h \ sys/ptrace.h \ sys/reg.h \ + sys/resource.h \ sys/scsiio.h \ sys/shm.h \ sys/signal.h \ diff --git a/include/config.h.in b/include/config.h.in index 18f11277887..d2c9f3bda71 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -734,6 +734,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_REG_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_RESOURCE_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SCSIIO_H diff --git a/server/signal.c b/server/signal.c index 0c2a579bae0..e12532e8318 100644 --- a/server/signal.c +++ b/server/signal.c @@ -28,6 +28,9 @@ #ifdef HAVE_SYS_POLL_H #include #endif +#ifdef HAVE_SYS_RESOURCE_H +#include +#endif #include #include "file.h" @@ -215,6 +218,13 @@ static void do_sigchld( int signum ) do_signal( handler_sigchld ); } +/* SIGSEGV handler */ +static void do_sigsegv( int signum ) +{ + fprintf( stderr, "wineserver crashed, please report this.\n"); + abort(); +} + /* SIGIO handler */ #ifdef HAVE_SIGINFO_T_SI_FD static void do_sigio( int signum, siginfo_t *si, void *x ) @@ -241,6 +251,17 @@ int watchdog_triggered(void) return watchdog != 0; } +static int core_dump_disabled( void ) +{ + int r = 0; +#ifdef RLIMIT_CORE + struct rlimit lim; + + r = !getrlimit(RLIMIT_CORE, &lim) && (lim.rlim_cur == 0); +#endif + return r; +} + void init_signals(void) { struct sigaction action; @@ -279,6 +300,11 @@ void init_signals(void) action.sa_handler = do_sigterm; sigaction( SIGQUIT, &action, NULL ); sigaction( SIGTERM, &action, NULL ); + if (core_dump_disabled()) + { + action.sa_handler = do_sigsegv; + sigaction( SIGSEGV, &action, NULL ); + } action.sa_handler = SIG_IGN; sigaction( SIGXFSZ, &action, NULL ); #ifdef HAVE_SIGINFO_T_SI_FD