Kea  1.9.9-git
lfc/main.cc
Go to the documentation of this file.
1 // Copyright (C) 2015-2020 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>
10 #include <log/logger_support.h>
11 #include <log/logger_manager.h>
12 #include <boost/exception/diagnostic_information.hpp>
13 #include <boost/exception_ptr.hpp>
14 #include <iostream>
15 #include <sys/resource.h>
16 
17 using namespace std;
18 using namespace isc::lfc;
19 
26 int main(int argc, char* argv[]) {
27  // Ask scheduling to not give too much resources to LFC.
28  // First parameter means to change only the process priority.
29  // Second parameter (0) means the calling process.
30  // Third parameter 4 is a bit below the default priority of 0 in
31  // a range of -20 (highest priority) and 19 or 20 (lowest priority).
32  static_cast<void>(setpriority(PRIO_PROCESS, 0, 4));
33 
34  int ret = EXIT_SUCCESS;
35  LFCController lfc_controller;
36 
37  // Launch the controller passing in command line arguments.
38  // Exit program with the controller's return code.
39  try {
40  // 'false' value disables test mode.
41  lfc_controller.launch(argc, argv, false);
42 
43  } catch (const boost::exception& ex) {
44  std::cerr << boost::diagnostic_information(ex) << std::endl;
45  ret = EXIT_FAILURE;
46 
47  } catch (const std::exception& ex) {
48  std::cerr << "Service failed: " << ex.what() << std::endl;
49  ret = EXIT_FAILURE;
50  }
51 
52  return (ret);
53 }
STL namespace.
void launch(int argc, char *argv[], const bool test_mode)
Acts as the primary entry point to start execution of the process.
int main(int argc, char *argv[])
This file contains the entry point (main() function) for the standard LFC process, kea-lfc, component of the Kea software suite.
Definition: lfc/main.cc:26
Process controller for LFC process.
Logging initialization functions.