added check for reliable signal handlers

This commit is contained in:
Radim Kolar 2009-08-24 20:42:12 +02:00
parent c2576bd59e
commit fb2d438abb
2 changed files with 45 additions and 1 deletions

View File

@ -52,6 +52,7 @@ from locktype import checkForLockingType
from lamerpack import checkForLamerpack from lamerpack import checkForLamerpack
from debugmode import checkForDebugBuild from debugmode import checkForDebugBuild
from timeout import checkForClientTimeout from timeout import checkForClientTimeout
from relsignals import checkReliableSignals
conf = Configure(env,{'checkForCCOption':checkForCCOption, conf = Configure(env,{'checkForCCOption':checkForCCOption,
'MAINTAINER_MODE':checkForMaintainerMode, 'MAINTAINER_MODE':checkForMaintainerMode,
@ -61,7 +62,8 @@ conf = Configure(env,{'checkForCCOption':checkForCCOption,
'checkForLockingType':checkForLockingType, 'checkForLockingType':checkForLockingType,
'checkForLamerPack':checkForLamerpack, 'checkForLamerPack':checkForLamerpack,
'checkForDebugBuild':checkForDebugBuild, 'checkForDebugBuild':checkForDebugBuild,
'checkForClientTimeout':checkForClientTimeout 'checkForClientTimeout':checkForClientTimeout,
'checkReliableSignals':checkReliableSignals
}) })
# check for CC options # check for CC options
for option in Split(""" for option in Split("""
@ -118,6 +120,8 @@ if not conf.CheckType("union semun", "#include <sys/types.h>\n#include <sys/ipc.
conf.env.Append(CPPFLAGS = "-D_SEM_SEMUN_UNDEFINED=1") conf.env.Append(CPPFLAGS = "-D_SEM_SEMUN_UNDEFINED=1")
conf.checkForLockingType(conf) conf.checkForLockingType(conf)
if conf.checkReliableSignals():
conf.env.Append(CPPFLAGS = '-DRELIABLE_SIGNALS')
conf.checkForLockPrefix() conf.checkForLockPrefix()
PREFIX=conf.checkPrefix(PREFIX) PREFIX=conf.checkPrefix(PREFIX)
conf.env.Append(CPPFLAGS = '-DSYSCONFDIR=\\"'+PREFIX+'/etc\\"') conf.env.Append(CPPFLAGS = '-DSYSCONFDIR=\\"'+PREFIX+'/etc\\"')

40
site_scons/relsignals.py Normal file
View File

@ -0,0 +1,40 @@
#
# SCons Reliable signals test
#
# Version 1.0
# 24-Aug-2009
#
def checkReliableSignals(conf):
"""Returns true if signal handlers reinstalls themself"""
conf.Message("Checking for reliable signals... ")
rc,result = conf.TryRun('''
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
volatile int test;
void sig_handler(int sg)
{
test=1;
}
int main()
{
signal(SIGUSR1,sig_handler);
test=0;
kill(getpid(),SIGUSR1);
sleep(1);
if(test==0) {
printf("Signals ARE BROKEN!\\n");
kill(0,SIGQUIT);
}
test=0;
kill(getpid(),SIGUSR1);
if(test==1)
exit(0);
else
exit(1);
}
''','.c')
conf.Result(rc)
return rc