forked from rfjakob/earlyoom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkill.h
41 lines (36 loc) · 1.15 KB
/
kill.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* SPDX-License-Identifier: MIT */
#ifndef KILL_H
#define KILL_H
#include <regex.h>
#include <stdbool.h>
#define EMERG_KILL_MAXLEN 512
typedef struct {
/* kill processes until we reach the upper watermark */
double mem_high_percent;
/* if the available memory AND swap goes below these percentages,
* we start killing processes */
double mem_term_percent;
double mem_kill_percent;
double mem_emerg_percent;
double swap_term_percent;
double swap_kill_percent;
/* ignore /proc/PID/oom_score_adj? */
bool ignore_oom_score_adj;
/* send d-bus notifications? */
bool notify;
/* prefer/avoid killing these processes. NULL = no-op. */
regex_t* prefer_regex;
regex_t* avoid_regex;
regex_t* avoid_users;
regex_t* prefer_old;
/* memory report interval, in milliseconds */
int report_interval_ms;
/* Flag --dryrun was passed */
bool dryrun;
bool nice;
/* comma-delimited list of processes to kill in case of emergency */
char* emerg_kill;
} poll_loop_args_t;
void kill_largest_process(const poll_loop_args_t* args, int sig);
int kill_emergency(const poll_loop_args_t* args);
#endif