[!POSIXSIGNALS]: Thoroughly obsolete, remove. This also gets rid of
an odd case where signals were not catched when debugging. (main, empth_start): Using sa_handler with SA_SIGINFO is wrong. Simply don't set SA_SIGINFO; the additional signal information is not used anyway.
This commit is contained in:
parent
014d005c69
commit
09b481b30a
6 changed files with 10 additions and 64 deletions
|
@ -79,7 +79,7 @@ HPUXLFLAGS =
|
||||||
HPUXMASTER = GLOBALCFLAGS="$(HPUXCFLAGS)" GLOBALLFLAGS="$(HPUXLFLAGS)" RANLIB="$(HPUXRANLIB)" CLIENTLIBS=-ltermcap
|
HPUXMASTER = GLOBALCFLAGS="$(HPUXCFLAGS)" GLOBALLFLAGS="$(HPUXLFLAGS)" RANLIB="$(HPUXRANLIB)" CLIENTLIBS=-ltermcap
|
||||||
|
|
||||||
IRIX5RANLIB = echo
|
IRIX5RANLIB = echo
|
||||||
IRIX5CFLAGS = -DSVR4 -DRel4 -DUCONTEXT -DPOSIXSIGNALS -O3 -fullwarn -woff 835,709
|
IRIX5CFLAGS = -DSVR4 -DRel4 -DUCONTEXT -O3 -fullwarn -woff 835,709
|
||||||
IRIX5LFLAGS = -lnsl
|
IRIX5LFLAGS = -lnsl
|
||||||
IRIX5MASTER = GLOBALCFLAGS="$(IRIX5CFLAGS)" GLOBALLFLAGS="$(IRIX5LFLAGS)" RANLIB="$(IRIX5RANLIB)"
|
IRIX5MASTER = GLOBALCFLAGS="$(IRIX5CFLAGS)" GLOBALLFLAGS="$(IRIX5LFLAGS)" RANLIB="$(IRIX5RANLIB)"
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ RTPCCFLAGS = -DBSD_INCLUDES -Daix -Dsys5 $(LOCALCFLAGS) -a
|
||||||
RTPCLFLAGS =
|
RTPCLFLAGS =
|
||||||
RTPCMASTER = GLOBALCFLAGS="$(RTPCCFLAGS)" GLOBALLFLAGS="$(RTPCLFLAGS)"
|
RTPCMASTER = GLOBALCFLAGS="$(RTPCCFLAGS)" GLOBALLFLAGS="$(RTPCLFLAGS)"
|
||||||
|
|
||||||
SOLCFLAGS = -g -DSVR4 -DRel4 -DUCONTEXT -DPOSIXSIGNALS -Dsolaris
|
SOLCFLAGS = -g -DSVR4 -DRel4 -DUCONTEXT -Dsolaris
|
||||||
SOLLFLAGS = -lnsl -lsocket -lthread
|
SOLLFLAGS = -lnsl -lsocket -lthread
|
||||||
SOLMASTER = GLOBALCFLAGS="$(SOLCFLAGS)" GLOBALLFLAGS="$(SOLLFLAGS)"
|
SOLMASTER = GLOBALCFLAGS="$(SOLCFLAGS)" GLOBALLFLAGS="$(SOLLFLAGS)"
|
||||||
|
|
||||||
|
@ -155,6 +155,6 @@ MIPSBSDCFLAGS = -DMIPS -DNOSTRDUP -G 33 -signed
|
||||||
MIPSBSDLFLAGS = -G 33
|
MIPSBSDLFLAGS = -G 33
|
||||||
MIPSBSDMASTER = GLOBALCFLAGS="$(MIPSBSDCFLAGS)" GLOBALLFLAGS="$(MIPSBSDLFLAGS)"
|
MIPSBSDMASTER = GLOBALCFLAGS="$(MIPSBSDCFLAGS)" GLOBALLFLAGS="$(MIPSBSDLFLAGS)"
|
||||||
|
|
||||||
VAXULTCFLAGS = -O -DNOSTRDUP -DPOSIXSIGNALS
|
VAXULTCFLAGS = -O -DNOSTRDUP
|
||||||
VAXULTLFLAGS =
|
VAXULTLFLAGS =
|
||||||
VAXULTMASTER = GLOBALCFLAGS="$(VAXULTCFLAGS)" GLOBALLFLAGS="$(VAXULTLFLAGS)"
|
VAXULTMASTER = GLOBALCFLAGS="$(VAXULTCFLAGS)" GLOBALLFLAGS="$(VAXULTLFLAGS)"
|
||||||
|
|
|
@ -90,18 +90,10 @@ struct mob_acc_globals {
|
||||||
|
|
||||||
typedef u_char natid; /* NSC_NATID must match this */
|
typedef u_char natid; /* NSC_NATID must match this */
|
||||||
|
|
||||||
#if defined(__linux__ ) || defined(__osf__)
|
|
||||||
#define POSIXSIGNALS 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined (_EMPTH_LWP) && !defined (_EMPTH_POSIX)
|
#if !defined (_EMPTH_LWP) && !defined (_EMPTH_POSIX)
|
||||||
#define _EMPTH_LWP 1
|
#define _EMPTH_LWP 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_EMPTH_POSIX) && !defined(POSIXSIGNALS)
|
|
||||||
#define POSIXSIGNALS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if !defined(aix) && !defined(sgi)
|
#if !defined(aix) && !defined(sgi)
|
||||||
#ifndef ultrix /* already defined in ultrix */
|
#ifndef ultrix /* already defined in ultrix */
|
||||||
|
|
|
@ -65,9 +65,6 @@ empth_start(void *ctx)
|
||||||
struct sigaction act;
|
struct sigaction act;
|
||||||
|
|
||||||
/* actually it should inherit all this from main but... */
|
/* actually it should inherit all this from main but... */
|
||||||
#ifdef SA_SIGINFO
|
|
||||||
act.sa_flags = SA_SIGINFO;
|
|
||||||
#endif
|
|
||||||
sigemptyset(&act.sa_mask);
|
sigemptyset(&act.sa_mask);
|
||||||
act.sa_handler = shutdwn;
|
act.sa_handler = shutdwn;
|
||||||
/* pthreads on Linux use SIGUSR1 (*shrug*) so only catch it if not on
|
/* pthreads on Linux use SIGUSR1 (*shrug*) so only catch it if not on
|
||||||
|
|
|
@ -42,11 +42,7 @@ struct lwpProc *LwpCurrent = NULL;
|
||||||
char **LwpContextPtr;
|
char **LwpContextPtr;
|
||||||
int LwpMaxpri = 0; /* maximum priority so far */
|
int LwpMaxpri = 0; /* maximum priority so far */
|
||||||
|
|
||||||
#ifdef POSIXSIGNALS
|
|
||||||
static sigset_t oldmask;
|
static sigset_t oldmask;
|
||||||
#else /* POSIXSIGNALS */
|
|
||||||
static int oldmask;
|
|
||||||
#endif /* POSIXSIGNALS */
|
|
||||||
|
|
||||||
/* for systems without strdup */
|
/* for systems without strdup */
|
||||||
#ifdef NOSTRDUP
|
#ifdef NOSTRDUP
|
||||||
|
@ -85,9 +81,7 @@ lwpReschedule(void)
|
||||||
static int lcount = LCOUNT;
|
static int lcount = LCOUNT;
|
||||||
static struct lwpProc *nextp;
|
static struct lwpProc *nextp;
|
||||||
static int i;
|
static int i;
|
||||||
#ifdef POSIXSIGNALS
|
|
||||||
static sigset_t tmask;
|
static sigset_t tmask;
|
||||||
#endif /* POSIXSIGNALS */
|
|
||||||
|
|
||||||
if (LwpCurrent && (LwpCurrent->flags & LWP_STACKCHECK)) {
|
if (LwpCurrent && (LwpCurrent->flags & LWP_STACKCHECK)) {
|
||||||
lwpStackCheck(LwpCurrent);
|
lwpStackCheck(LwpCurrent);
|
||||||
|
@ -95,12 +89,8 @@ lwpReschedule(void)
|
||||||
if (!--lcount) {
|
if (!--lcount) {
|
||||||
int p = lwpSetPriority(LWP_MAX_PRIO - 1);
|
int p = lwpSetPriority(LWP_MAX_PRIO - 1);
|
||||||
lcount = LCOUNT;
|
lcount = LCOUNT;
|
||||||
#ifdef POSIXSIGNALS
|
|
||||||
sigprocmask(SIG_SETMASK, &oldmask, &tmask);
|
sigprocmask(SIG_SETMASK, &oldmask, &tmask);
|
||||||
sigprocmask(SIG_SETMASK, &tmask, &oldmask);
|
sigprocmask(SIG_SETMASK, &tmask, &oldmask);
|
||||||
#else /* POSIXSIGNALS */
|
|
||||||
sigsetmask(sigsetmask(oldmask));
|
|
||||||
#endif /* POSIXSIGNALS */
|
|
||||||
LwpCurrent->pri = p;
|
LwpCurrent->pri = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,20 +180,14 @@ lwpReschedule(void)
|
||||||
void
|
void
|
||||||
lwpEntryPoint(void)
|
lwpEntryPoint(void)
|
||||||
{
|
{
|
||||||
#ifdef POSIXSIGNALS
|
|
||||||
sigset_t set;
|
sigset_t set;
|
||||||
#endif /* POSIXSIGNALS */
|
|
||||||
|
|
||||||
#ifdef BOUNDS_CHECK
|
#ifdef BOUNDS_CHECK
|
||||||
BOUNDS_CHECKING_OFF;
|
BOUNDS_CHECKING_OFF;
|
||||||
#endif
|
#endif
|
||||||
#ifdef POSIXSIGNALS
|
|
||||||
sigemptyset(&set);
|
sigemptyset(&set);
|
||||||
sigaddset(&set, SIGALRM);
|
sigaddset(&set, SIGALRM);
|
||||||
sigprocmask(SIG_SETMASK, &set, &oldmask);
|
sigprocmask(SIG_SETMASK, &set, &oldmask);
|
||||||
#else /* POSIXSIGNALS */
|
|
||||||
sigsetmask(SIGNALS);
|
|
||||||
#endif /* POSIXSIGNALS */
|
|
||||||
*LwpContextPtr = LwpCurrent->ud;
|
*LwpContextPtr = LwpCurrent->ud;
|
||||||
|
|
||||||
lwpStatus(LwpCurrent, "starting at entry point");
|
lwpStatus(LwpCurrent, "starting at entry point");
|
||||||
|
|
|
@ -72,8 +72,6 @@ void lwpRestore(jmp_buf);
|
||||||
/* XXX Note that this assumes sizeof(long) == 4 */
|
/* XXX Note that this assumes sizeof(long) == 4 */
|
||||||
#define LWP_CHECKMARK 0x5a5a5a5aL
|
#define LWP_CHECKMARK 0x5a5a5a5aL
|
||||||
|
|
||||||
#define SIGNALS sigmask(SIGALRM)
|
|
||||||
|
|
||||||
#ifndef hpux
|
#ifndef hpux
|
||||||
typedef double stkalign_t;
|
typedef double stkalign_t;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -251,6 +251,9 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize for serving, acquire resources.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
init_server(void)
|
init_server(void)
|
||||||
{
|
{
|
||||||
|
@ -278,20 +281,17 @@ init_server(void)
|
||||||
logerror("Empire server (pid %d) started", (int)getpid());
|
logerror("Empire server (pid %d) started", (int)getpid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Start serving.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
start_server(int flags)
|
start_server(int flags)
|
||||||
{
|
{
|
||||||
#ifdef POSIXSIGNALS
|
|
||||||
struct sigaction act;
|
struct sigaction act;
|
||||||
#endif /* POSIXSIGNALS */
|
|
||||||
|
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
/* signal() should not be used with mit pthreads. Anyway if u
|
/* signal() should not be used with mit pthreads. Anyway if u
|
||||||
have a posix threads u definitly have posix signals -- Sasha */
|
have a posix threads u definitly have posix signals -- Sasha */
|
||||||
#if defined (POSIXSIGNALS) || defined (_EMPTH_POSIX)
|
|
||||||
#ifdef SA_SIGINFO
|
|
||||||
act.sa_flags = SA_SIGINFO;
|
|
||||||
#endif
|
|
||||||
sigemptyset(&act.sa_mask);
|
sigemptyset(&act.sa_mask);
|
||||||
act.sa_handler = shutdwn;
|
act.sa_handler = shutdwn;
|
||||||
/* pthreads on Linux use SIGUSR1 (*shrug*) so only catch it if not on
|
/* pthreads on Linux use SIGUSR1 (*shrug*) so only catch it if not on
|
||||||
|
@ -308,23 +308,7 @@ start_server(int flags)
|
||||||
sigaction(SIGFPE, &act, NULL);
|
sigaction(SIGFPE, &act, NULL);
|
||||||
act.sa_handler = SIG_IGN;
|
act.sa_handler = SIG_IGN;
|
||||||
sigaction(SIGPIPE, &act, NULL);
|
sigaction(SIGPIPE, &act, NULL);
|
||||||
#else
|
#endif /* !_WIN32 */
|
||||||
if (debug == 0 && flags == 0) {
|
|
||||||
/* pthreads on Linux use SIGUSR1 (*shrug*) so only catch it if not on
|
|
||||||
a Linux box running POSIX threads -- STM */
|
|
||||||
#if !(defined(__linux__) && defined(_EMPTH_POSIX))
|
|
||||||
signal(SIGUSR1, shutdwn);
|
|
||||||
#endif
|
|
||||||
signal(SIGTERM, shutdwn);
|
|
||||||
signal(SIGBUS, panic);
|
|
||||||
signal(SIGSEGV, panic);
|
|
||||||
signal(SIGILL, panic);
|
|
||||||
signal(SIGFPE, panic);
|
|
||||||
signal(SIGINT, shutdwn);
|
|
||||||
}
|
|
||||||
signal(SIGPIPE, SIG_IGN);
|
|
||||||
#endif /* POSIXSIGNALS */
|
|
||||||
#endif /* _WIN32 */
|
|
||||||
|
|
||||||
empth_init((char **)&player, flags);
|
empth_init((char **)&player, flags);
|
||||||
|
|
||||||
|
@ -398,7 +382,6 @@ close_files(void)
|
||||||
void
|
void
|
||||||
panic(int sig)
|
panic(int sig)
|
||||||
{
|
{
|
||||||
#ifdef POSIXSIGNALS
|
|
||||||
struct sigaction act;
|
struct sigaction act;
|
||||||
|
|
||||||
act.sa_flags = 0;
|
act.sa_flags = 0;
|
||||||
|
@ -408,12 +391,6 @@ panic(int sig)
|
||||||
sigaction(SIGSEGV, &act, NULL);
|
sigaction(SIGSEGV, &act, NULL);
|
||||||
sigaction(SIGILL, &act, NULL);
|
sigaction(SIGILL, &act, NULL);
|
||||||
sigaction(SIGFPE, &act, NULL);
|
sigaction(SIGFPE, &act, NULL);
|
||||||
#else
|
|
||||||
signal(SIGBUS, SIG_DFL);
|
|
||||||
signal(SIGSEGV, SIG_DFL);
|
|
||||||
signal(SIGILL, SIG_DFL);
|
|
||||||
signal(SIGFPE, SIG_DFL);
|
|
||||||
#endif /* POSIXSIGNALS */
|
|
||||||
logerror("server received fatal signal %d", sig);
|
logerror("server received fatal signal %d", sig);
|
||||||
log_last_commands();
|
log_last_commands();
|
||||||
close_files();
|
close_files();
|
||||||
|
@ -579,9 +556,7 @@ loc_NTInit()
|
||||||
_exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
|
||||||
void
|
void
|
||||||
loc_NTTerm()
|
loc_NTTerm()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue