Kea: main.cc Source File

| Kea 3.0.2-git

lfc/main.cc
Go to the documentation of this file.
1// Copyright (C) 2015-2025 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#include <config.h>
8#include <lfc/lfc_controller.h>
9#include <exceptions/exceptions.h>
10#include <log/logger_support.h>
11#include <log/logger_manager.h>
12#include <util/filesystem.h>
13#include <boost/exception/diagnostic_information.hpp>
14#include <boost/exception_ptr.hpp>
15#include <iostream>
16#include <sys/resource.h>
17
18using namespace std;
19using namespace isc::lfc;
20
27 int main(int argc, char* argv[]) {
28 isc::util::file::setUmask();
29
30 int ret = EXIT_SUCCESS;
31 try {
32 // Ask scheduling to not give too much resources to LFC.
33 // First parameter means to change only the process priority.
34 // Second parameter (0) means the calling process.
35 // Third parameter 4 is a bit below the default priority of 0 in
36 // a range of -20 (highest priority) and 19 or 20 (lowest priority).
37 static_cast<void>(setpriority(PRIO_PROCESS, 0, 4));
38
39 LFCController lfc_controller;
40
41 // Launch the controller passing in command line arguments.
42 // Exit program with the controller's return code.
43
44 // 'false' value disables test mode.
45 lfc_controller.launch(argc, argv, false);
46
47 } catch (const boost::exception& ex) {
48 std::cerr << boost::diagnostic_information(ex) << std::endl;
49 ret = EXIT_FAILURE;
50 } catch (const std::exception& ex) {
51 std::cerr << "Service failed: " << ex.what() << std::endl;
52 ret = EXIT_FAILURE;
53 } catch (...) {
54 std::cerr << "Service failed" << std::endl;
55 ret = EXIT_FAILURE;
56 }
57
58 return (ret);
59}
isc::lfc::LFCController
Process controller for LFC process.
Definition lfc_controller.h:37
isc::lfc::LFCController::launch
void launch(int argc, char *argv[], const bool test_mode)
Acts as the primary entry point to start execution of the process.
Definition lfc_controller.cc:59
exceptions.h
filesystem.h
main
int main(int argc, char *argv[])
This file contains the entry point (main() function) for the standard LFC process,...
Definition lfc/main.cc:27
lfc_controller.h
logger_manager.h
logger_support.h
Logging initialization functions.
isc::lfc
Definition lfc_controller.cc:41
isc::util::file::setUmask
void setUmask()
Set umask (at least 0027 i.e. no group write and no other access).
Definition filesystem.cc:97