2 * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Contact: Jan Olszak (j.olszak@samsung.com)
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License
21 * @author Jan Olszak (j.olszak@samsung.com)
22 * @brief Server class declaration
26 #ifndef SERVER_SERVER_HPP
27 #define SERVER_SERVER_HPP
29 #include "zones-manager.hpp"
31 #include "utils/latch.hpp"
32 #include "utils/signalfd.hpp"
33 #include "utils/glib-loop.hpp"
34 #include "ipc/epoll/event-poll.hpp"
46 Server(const std::string& configPath);
49 * Starts all the zones and blocks until SIGINT, SIGTERM or SIGUSR1
51 void run(bool asRoot);
54 * Reload the server by launching execve on itself if SIGUSR1 was sent to server.
56 void reloadIfRequired(char* argv[]);
59 * Terminates the server.
60 * Equivalent of sending SIGINT or SIGTERM signal
65 * Check server runtime environment
67 static bool checkEnvironment();
72 std::string mConfigPath;
73 utils::ScopedGlibLoop loop;
74 ipc::epoll::EventPoll mEventPoll;
75 utils::SignalFD mSignalFD;
76 ZonesManager mZonesManager;
77 ::pthread_t mDispatchingThread;
80 * Set needed caps, groups and drop root privileges.
82 static bool prepareEnvironment(const std::string& configPath, bool runAsRoot);
93 #endif // SERVER_SERVER_HPP