-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.h
executable file
·71 lines (50 loc) · 1.3 KB
/
app.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef RCL_H_APP_4C9557A02420417f850745DF202C81A5
#define RCL_H_APP_4C9557A02420417f850745DF202C81A5
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
#include <syslog.h>
#include <signal.h>
#include <syslog.h>
#include <cassert>
#include <string>
#include <stdexcept>
namespace RCL {
#define MAXFD 64
#define MAKEDAEMONAPP
extern char* __z_self;
class EDaemon:public std::runtime_error
{
public:
EDaemon(const std::string & whatString): std::runtime_error(whatString){
}
};
class CApplication{
public:
int m_nArgc;
char** m_strArgv;
char** m_pEnv;
void InitDaemon();
public:
int InitSignal();
CApplication();
virtual ~CApplication();
virtual int IsDaemon(){
return 0;
}; /* Return 1 for Daemon, Return 0 for console */
virtual int Run(){return 1;};
virtual int OnSignalChild(){return 1;};
virtual int OnSignalHup(){return 1;};
virtual int OnSignalInt(){return 1;};
virtual int OnSignalTerm(){return 1;};
virtual int OnSignalPipe(){return 1;};
virtual int OnSignalSegv(){return 1;};
virtual int OnSignalUser1(){return 1;};
virtual int OnSignalAlarm(){return 1;};
virtual int setAlarm(int seconds){return 0;}
};
extern CApplication* RCL_GetApp();
}
#endif