103 |
|
fout << ::getpid() << ios::NewLine; |
104 |
|
} |
105 |
|
|
106 |
< |
Mounter mounter(config); |
107 |
< |
Unmounter unmounter(config); |
106 |
> |
Daemon daemon_(config); |
107 |
|
|
108 |
< |
daemons.InsertLast(dynamic_cast<Daemon*>(&mounter)); |
110 |
< |
daemons.InsertLast(dynamic_cast<Daemon*>(&unmounter)); |
108 |
> |
daemon = &daemon_; |
109 |
|
|
110 |
|
{ |
111 |
|
struct ::sigaction action; |
121 |
|
api::Posix::CheckError(::sigaction(SIGINT, &action, NULL)); |
122 |
|
api::Posix::CheckError(::sigaction(SIGTERM, &action, NULL)); |
123 |
|
} |
126 |
– |
|
127 |
– |
_foreach (ext::Vector<Daemon*>, daemon, daemons) (*daemon)->start(); |
128 |
– |
_foreach (ext::Vector<Daemon*>, daemon, daemons) (*daemon)->wait(); |
124 |
|
} |
125 |
|
|
126 |
|
Spectre2::~Spectre2() |
130 |
|
|
131 |
|
ext::String Spectre2::program(api::GetExecutablePath().GetName()), Spectre2::prefix(_Spectre2_prefix_), Spectre2::root(_Spectre2_root_), Spectre2::mount(_Spectre2_mount_); |
132 |
|
bool Spectre2::debug(false); |
133 |
< |
ext::Vector<Daemon*> Spectre2::daemons; |
139 |
< |
ext::RedBlackSet<Share> Spectre2::shares; |
140 |
< |
api::ThreadMutex Spectre2::sharesLock; |
133 |
> |
Daemon* Spectre2::daemon; |
134 |
|
|
135 |
|
extern "C" |
136 |
|
{ |
137 |
|
void reload(int signal, ::siginfo_t* info, void* uap) |
138 |
|
{ |
139 |
< |
_foreach (ext::Vector<Daemon*>, daemon, Spectre2::daemons) (*daemon)->reload(); |
139 |
> |
Spectre2::daemon->reload(); |
140 |
|
} |
141 |
|
|
142 |
|
void stop(int signal, ::siginfo_t* info, void* uap) |
143 |
|
{ |
144 |
< |
_foreach (ext::Vector<Daemon*>, daemon, Spectre2::daemons) (*daemon)->stop(); |
144 |
> |
Spectre2::daemon->stop(); |
145 |
|
} |
146 |
|
} |