|
a/src/common/rclinit.cpp |
|
b/src/common/rclinit.cpp |
1 |
#ifndef lint
|
1 |
#ifndef lint
|
2 |
static char rcsid[] = "@(#$Id: rclinit.cpp,v 1.2 2005-11-05 14:40:50 dockes Exp $ (C) 2004 J.F.Dockes";
|
2 |
static char rcsid[] = "@(#$Id: rclinit.cpp,v 1.3 2005-11-09 21:39:04 dockes Exp $ (C) 2004 J.F.Dockes";
|
3 |
#endif
|
3 |
#endif
|
4 |
|
4 |
|
5 |
#include <stdio.h>
|
5 |
#include <stdio.h>
|
6 |
#include <signal.h>
|
6 |
#include <signal.h>
|
7 |
|
7 |
|
|
... |
|
... |
10 |
#include "rclinit.h"
|
10 |
#include "rclinit.h"
|
11 |
|
11 |
|
12 |
RclConfig *recollinit(void (*cleanup)(void), void (*sigcleanup)(int),
|
12 |
RclConfig *recollinit(void (*cleanup)(void), void (*sigcleanup)(int),
|
13 |
string &reason)
|
13 |
string &reason)
|
14 |
{
|
14 |
{
|
|
|
15 |
if (cleanup)
|
15 |
atexit(cleanup);
|
16 |
atexit(cleanup);
|
|
|
17 |
if (sigcleanup) {
|
16 |
if (signal(SIGHUP, SIG_IGN) != SIG_IGN)
|
18 |
if (signal(SIGHUP, SIG_IGN) != SIG_IGN)
|
17 |
signal(SIGHUP, sigcleanup);
|
19 |
signal(SIGHUP, sigcleanup);
|
18 |
if (signal(SIGINT, SIG_IGN) != SIG_IGN)
|
20 |
if (signal(SIGINT, SIG_IGN) != SIG_IGN)
|
19 |
signal(SIGINT, sigcleanup);
|
21 |
signal(SIGINT, sigcleanup);
|
20 |
if (signal(SIGQUIT, SIG_IGN) != SIG_IGN)
|
22 |
if (signal(SIGQUIT, SIG_IGN) != SIG_IGN)
|
21 |
signal(SIGQUIT, sigcleanup);
|
23 |
signal(SIGQUIT, sigcleanup);
|
22 |
if (signal(SIGTERM, SIG_IGN) != SIG_IGN)
|
24 |
if (signal(SIGTERM, SIG_IGN) != SIG_IGN)
|
23 |
signal(SIGTERM, sigcleanup);
|
25 |
signal(SIGTERM, sigcleanup);
|
24 |
|
26 |
}
|
25 |
DebugLog::getdbl()->setloglevel(DEBDEB1);
|
27 |
DebugLog::getdbl()->setloglevel(DEBDEB1);
|
26 |
DebugLog::setfilename("stderr");
|
28 |
DebugLog::setfilename("stderr");
|
27 |
RclConfig *config = new RclConfig;
|
29 |
RclConfig *config = new RclConfig;
|
28 |
if (!config || !config->ok()) {
|
30 |
if (!config || !config->ok()) {
|
29 |
reason = "Configuration could not be built:\n";
|
31 |
reason = "Configuration could not be built:\n";
|