From: Francis Dupont Date: Wed, 4 Mar 2026 08:16:23 +0000 (+0100) Subject: [#4093] Moved setpriority X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3ce58644edfe46403fbb92ee6eb7afd28b4903ff;p=thirdparty%2Fkea.git [#4093] Moved setpriority --- diff --git a/src/bin/lfc/lfc_controller.cc b/src/bin/lfc/lfc_controller.cc index 27a7e3d027..2198e7ca83 100644 --- a/src/bin/lfc/lfc_controller.cc +++ b/src/bin/lfc/lfc_controller.cc @@ -26,6 +26,7 @@ #include #include #include +#include using namespace std; using namespace isc::util; @@ -102,6 +103,13 @@ LFCController::launch(int argc, char* argv[], const bool test_mode) { if (existing == 0) { pid_file.write(); } + + // Ask scheduling to not give too much resources to LFC. + // First parameter means to change only the process priority. + // Second parameter (0) means the calling process. + // Third parameter 4 is a bit below the default priority of 0 in + // a range of -20 (highest priority) and 19 or 20 (lowest priority). + static_cast(setpriority(PRIO_PROCESS, 0, 4)); } catch (const PIDFileError& pid_ex) { LOG_FATAL(lfc_logger, LFC_FAIL_PID_CREATE).arg(pid_ex.what()); return; diff --git a/src/bin/lfc/main.cc b/src/bin/lfc/main.cc index 61f4c34ef0..05bb8dd20a 100644 --- a/src/bin/lfc/main.cc +++ b/src/bin/lfc/main.cc @@ -13,7 +13,6 @@ #include #include #include -#include using namespace std; using namespace isc::lfc; @@ -29,13 +28,6 @@ int main(int argc, char* argv[]) { int ret = EXIT_SUCCESS; try { - // Ask scheduling to not give too much resources to LFC. - // First parameter means to change only the process priority. - // Second parameter (0) means the calling process. - // Third parameter 4 is a bit below the default priority of 0 in - // a range of -20 (highest priority) and 19 or 20 (lowest priority). - static_cast(setpriority(PRIO_PROCESS, 0, 4)); - LFCController lfc_controller; // Launch the controller passing in command line arguments.