(на мелодию рекламы пепси) Поколение смузихлебов выбираееееееет ... г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ера святые Керниган и Ричи дали обезьянам дефайны и статики, а пророк их Страуструп консты - непонятно.