1 #ifndef _PROJENT_RESCTL_H
2 #define _PROJENT_RESCTL_H
3
4
5 /*
6 * Put includes here if needed to be.
7 */
8
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12
13
14 #define RESCTL_TYPE_UNKWN 0x00
15 #define RESCTL_TYPE_BYTES 0x01
16 #define RESCTL_TYPE_SCNDS 0x02
17 #define RESCTL_TYPE_COUNT 0x03
18
19 #define RESCTL_PRIV_PRIVE 0x01
20 #define RESCTL_PRIV_PRIVD 0x02
21 #define RESCTL_PRIV_BASIC 0x04
22 #define RESCTL_PRIV_ALLPR 0x07
23
24 #define RESCTL_ACTN_NONE 0x01
25 #define RESCTL_ACTN_DENY 0x02
26 #define RESCTL_ACTN_SIGN 0x04
27 #define RESCTL_ACTN_ALLA 0x07
28
29 #define RESCTL_SIG_ABRT 0x01
30 #define RESCTL_SIG_XRES 0x02
31 #define RESCTL_SIG_HUP 0x04
32 #define RESCTL_SIG_STOP 0x08
33 #define RESCTL_SIG_TERM 0x10
34 #define RESCTL_SIG_KILL 0x20
35 #define RESCTL_SIG_XFSZ 0x40
36 #define RESCTL_SIG_XCPU 0x80
37
38 #define RESCTL_SIG_CMN 0x3f
39 #define RESCTL_SIG_ALL 0xff
40
41 typedef struct sig_s {
42 char sig[6];
43 int mask;
44 } sig_t;
45
46 #define SIGS_CNT 16
47 extern sig_t sigs[SIGS_CNT];
48
49 typedef struct resctlrule_s {
50 uint64_t resctl_max;
51 uint8_t resctl_type;
52 uint8_t resctl_privs;
53 uint8_t resctl_action;
54 uint8_t resctl_sigs;
55 } resctlrule_t;
56
57 typedef struct resctl_info_s {
58 unsigned long long value;
59 int flags;
60 } resctl_info_t;
61
62 extern int resctl_pool_exist(char *);
63 extern int resctl_get_info(char *, resctl_info_t *);
64 extern void resctl_get_rule(resctl_info_t *, resctlrule_t *);
65
66 #ifdef __cplusplus
67 }
68 #endif
69 #endif /* _PROJENT_RESCTL_H */