3 * Copyright (c) 2013-2020 Samsung Electronics Co., Ltd
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is furnished
10 * to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in all
13 * copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 #ifndef _LOGLIMITER_H_
24 #define _LOGLIMITER_H_
26 /* Define maximum logging speed, everything greater means unlimited.
27 * Maximum possible value is INT_MAX-2 */
28 #define __LOG_LIMITER_LIMIT_MAX (10*1000)
36 #include <logconfig.h>
37 #include <ptrs_list.h>
41 struct limiter_limits {
53 void __log_limiter_destroy(void);
55 struct pass_log_result {
59 DECISION_TAG_LIMIT_EXCEEDED_MESSAGE,
60 DECISION_PID_LIMIT_EXCEEDED_MESSAGE,
67 struct pass_log_result __log_limiter_pass_log(const char *tag, int prio);
69 int __log_limiter_create(const struct log_config *config);
71 struct limiter_limits __log_limiter_get_limits(const char *tag, int prio);
73 void __log_limiter_update(const struct log_config *config);
75 int __log_limiter_dump_rule(struct rule **, char *, const size_t);
77 // Note: result only valid until next __log_limiter_{update,destroy}
78 list_head __log_limiter_get_pid_limits();
84 #endif /* _LOGLIMITER_H_ */