libcgroup
Loading...
Searching...
No Matches
cgrulesengd.h
1/* SPDX-License-Identifier: LGPL-2.1-only */
8#ifndef _CGRULESENGD_H
9#define _CGRULESENGD_H
10
11#include <features.h>
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17#include "config.h"
18#include "libcgroup.h"
19
20#include <linux/connector.h>
21#include <linux/cn_proc.h>
22
23#ifndef _GNU_SOURCE
24#define _GNU_SOURCE
25#endif
26
27#ifndef __USE_GNU
28#define __USE_GNU
29#endif
30
31/* The following ten macros are all for the Netlink code. */
32#define SEND_MESSAGE_LEN (NLMSG_LENGTH(sizeof(struct cn_msg) + sizeof(enum proc_cn_mcast_op)))
33#define RECV_MESSAGE_LEN (NLMSG_LENGTH(sizeof(struct cn_msg) + sizeof(struct proc_event)))
34
35#define SEND_MESSAGE_SIZE (NLMSG_SPACE(SEND_MESSAGE_LEN))
36#define RECV_MESSAGE_SIZE (NLMSG_SPACE(RECV_MESSAGE_LEN))
37
38#define BUFF_SIZE (max(max(SEND_MESSAGE_SIZE, RECV_MESSAGE_SIZE), 1024))
39#define MIN_RECV_SIZE (min(SEND_MESSAGE_SIZE, RECV_MESSAGE_SIZE))
40
41#define PROC_CN_MCAST_LISTEN (1)
42#define PROC_CN_MCAST_IGNORE (2)
43
51void cgre_usage(FILE *fd, const char *msg, ...);
52
61void flog(int level, const char *msg, ...);
62
71int cgre_process_event(const struct proc_event *ev, const int type);
72
81int cgre_handle_message(struct cn_msg *cn_hdr);
82
94int cgre_start_daemon(const char *logp, const int logf, const unsigned char daemon,
95 const int logv);
96
102void cgre_flash_rules(int signum);
103
109void cgre_flash_templates(int signum);
110
116void cgre_catch_term(int signum);
117
118#ifdef __cplusplus
119} /* extern "C" */
120#endif
121
122#endif /* _CGRULESENGD_H */