diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2009-02-26 14:23:54 +0100 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2009-02-26 14:23:54 +0100 |
commit | cb5303927188de9504a6e18aedec299956a22b6f (patch) | |
tree | 0d8ac146c9d84b85e382fb994d9e10688c2e3e36 /lib | |
parent | a9dc5e1ef2fd08c53bceb54690f6dac83ddf0c81 (diff) | |
download | bird-cb5303927188de9504a6e18aedec299956a22b6f.tar bird-cb5303927188de9504a6e18aedec299956a22b6f.zip |
Rate limit for most abundant log messages
Diffstat (limited to 'lib')
-rw-r--r-- | lib/birdlib.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/birdlib.h b/lib/birdlib.h index 93f25fb..b7cd6b4 100644 --- a/lib/birdlib.h +++ b/lib/birdlib.h @@ -9,6 +9,8 @@ #ifndef _BIRD_BIRDLIB_H_ #define _BIRD_BIRDLIB_H_ +#include "timer.h" + /* Ugly structure offset handling macros */ #define OFFSETOF(s, i) ((unsigned int)&((s *)0)->i) @@ -33,8 +35,14 @@ /* Logging and dying */ +struct rate_limit { + bird_clock_t timestamp; + int count; +}; + #define log log_msg void log_msg(char *msg, ...); +void log_rl(struct rate_limit *rl, char *msg, ...); void die(char *msg, ...) NORET; void bug(char *msg, ...) NORET; |