The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]



"Выпуск earlyoom 1.1, процесса для раннего реагирования на не..."
Версия для распечатки Пред. тема | След. тема
Форум Разговоры, обсуждение новостей
Исходное сообщение [ Отслеживать ]
Отдельный RSS теперь доступен для каждого обсуждения в форуме и каждого минипортала.
. "Выпуск earlyoom 1.1, процесса для раннего реагирования на не..." +4 +/
Сообщение от Аноним (162), 09-Июл-18, 17:03 
(на мелодию рекламы пепси) Поколение смузихлебов выбираееееееет ... гoвно.

314 лайков, 35 форков вот у этого:
<code>
report_interval = report_interval * 10; // loop runs at 10Hz
...
usleep(100000); // 100 ms <=> 10 Hz

...
char notif[600];
snprintf(notif, sizeof(notif), "%s %s", notif_command, notif_args);
...
char notif_args[PATH_MAX + 1000];
snprintf(notif_args, sizeof(notif_args), "-i dialog-warning 'earlyoom' 'Killing process %d %s'", victim_pid, victim_name);
<code>

Ну и коммиты, конечно, просто блистают:
<diff>

     if (victim_pid == 0) {
        
-        fprintf(stderr, "Error: Could not find a process to kill. Sleeping 10 seconds.\n");
        
-        maybe_notify(notif_command, "-i dialog-error 'earlyoom' 'Error: Could not find a process to kill'");
        
-        sleep(10);
        
+        fprintf(stderr, "Error: Could not find a process to kill. Sleeping 1 second.\n");
        
+        maybe_notify(notif_command, "-i dialog-error 'earlyoom' 'Error: Could not find a process to kill. Sleeping 1 second.'");
        
+        sleep(1);
        
         return;
        
     }
        

    @@ -223,9 +223,9 @@ static void userspace_kill(DIR* procdir, int sig, int ignore_oom_score_adj,
        
         // Killing the process may have failed because we are not running as root.
        
         // In that case, trying again in 100ms will just yield the same error.
        
         // Throttle ourselves to not spam the log.
        
-        fprintf(stderr, "Sleeping 10 seconds\n");
        
-        maybe_notify(notif_command, "-i dialog-error 'earlyoom' 'Error: Failed to kill process'");
        
-        sleep(10);
        
+        fprintf(stderr, "Sleeping 1 second\n");
        
+        maybe_notify(notif_command, "-i dialog-error 'earlyoom' 'Error: Failed to kill process. Sleeping 1 second.'");
        
+        sleep(1);
        
     }
<diff>

Наxера святые Керниган и Ричи дали обезьянам дефайны и статики, а пророк их Страуструп консты - непонятно.

Ответить | Правка | Наверх | Cообщить модератору

Оглавление
Выпуск earlyoom 1.1, процесса для раннего реагирования на не..., opennews, 08-Июл-18, 19:31  [смотреть все]
Форумы | Темы | Пред. тема | След. тема



Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру