2014-11-21 10:51:34 +00:00
|
|
|
/*
|
|
|
|
* MARS Long Distance Replication Software
|
|
|
|
*
|
|
|
|
* This file is part of MARS project: http://schoebel.github.io/mars/
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010-2014 Thomas Schoebel-Theuer
|
|
|
|
* Copyright (C) 2011-2014 1&1 Internet AG
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2011-11-14 17:52:05 +00:00
|
|
|
#ifndef BRICK_SAY_H
|
|
|
|
#define BRICK_SAY_H
|
|
|
|
|
2013-07-10 06:30:35 +00:00
|
|
|
#ifndef CONFIG_MARS_MODULE
|
|
|
|
// when unsure, include faked config file
|
2013-04-09 13:35:00 +00:00
|
|
|
#include "mars_config.h"
|
2013-07-10 06:30:35 +00:00
|
|
|
#endif
|
2013-04-09 13:35:00 +00:00
|
|
|
|
2011-11-14 17:52:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2013-04-08 08:45:20 +00:00
|
|
|
extern int brick_say_logging;
|
2013-01-20 22:09:09 +00:00
|
|
|
extern int brick_say_debug;
|
2012-11-13 11:50:48 +00:00
|
|
|
extern int brick_say_syslog_min;
|
|
|
|
extern int brick_say_syslog_max;
|
2014-01-28 09:51:17 +00:00
|
|
|
extern int brick_say_syslog_flood_class;
|
|
|
|
extern int brick_say_syslog_flood_limit;
|
|
|
|
extern int brick_say_syslog_flood_recovery;
|
2012-11-20 08:09:33 +00:00
|
|
|
extern int delay_say_on_overflow;
|
2012-11-13 11:50:48 +00:00
|
|
|
|
2022-03-28 14:18:41 +00:00
|
|
|
enum _say_mode {
|
2012-10-11 06:25:41 +00:00
|
|
|
SAY_DEBUG,
|
|
|
|
SAY_INFO,
|
|
|
|
SAY_WARN,
|
|
|
|
SAY_ERROR,
|
|
|
|
SAY_FATAL,
|
|
|
|
SAY_TOTAL,
|
|
|
|
MAX_SAY_CLASS
|
2022-03-28 14:18:41 +00:00
|
|
|
} __packed;
|
2012-02-02 10:16:06 +00:00
|
|
|
|
2013-04-08 09:44:09 +00:00
|
|
|
extern const char *say_class[MAX_SAY_CLASS];
|
|
|
|
|
2012-10-11 06:25:41 +00:00
|
|
|
struct say_channel;
|
|
|
|
|
|
|
|
extern struct say_channel *default_channel;
|
|
|
|
|
2013-04-08 09:44:09 +00:00
|
|
|
extern struct say_channel *make_channel(const char *name, bool must_exit);
|
2012-10-11 06:25:41 +00:00
|
|
|
|
2013-04-08 07:14:23 +00:00
|
|
|
extern void del_channel(struct say_channel *ch);
|
|
|
|
|
2012-10-11 06:25:41 +00:00
|
|
|
extern void bind_to_channel(struct say_channel *ch, struct task_struct *whom);
|
|
|
|
|
|
|
|
#define bind_me(_name) \
|
|
|
|
bind_to_channel(make_channel(_name), current)
|
|
|
|
|
2012-11-13 11:50:48 +00:00
|
|
|
extern struct say_channel *get_binding(struct task_struct *whom);
|
|
|
|
|
|
|
|
extern void remove_binding_from(struct say_channel *ch, struct task_struct *whom);
|
2012-10-11 06:25:41 +00:00
|
|
|
extern void remove_binding(struct task_struct *whom);
|
2012-02-02 10:16:06 +00:00
|
|
|
|
2012-11-13 11:50:48 +00:00
|
|
|
extern void rollover_channel(struct say_channel *ch);
|
|
|
|
extern void rollover_all(void);
|
|
|
|
|
2012-10-11 06:25:41 +00:00
|
|
|
extern void say_to(struct say_channel *ch, int class, const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
|
2012-01-11 15:16:39 +00:00
|
|
|
|
2012-10-11 06:25:41 +00:00
|
|
|
#define say(_class, _fmt, _args...) \
|
|
|
|
say_to(NULL, _class, _fmt, ##_args)
|
2012-01-09 16:12:06 +00:00
|
|
|
|
2012-10-11 06:25:41 +00:00
|
|
|
extern void brick_say_to(struct say_channel *ch, int class, bool dump, const char *prefix, const char *file, int line, const char *func, const char *fmt, ...) __attribute__ ((format (printf, 8, 9)));
|
|
|
|
|
|
|
|
#define brick_say(_class, _dump, _prefix, _file, _line, _func, _fmt, _args...) \
|
|
|
|
brick_say_to(NULL, _class, _dump, _prefix, _file, _line, _func, _fmt, ##_args)
|
2012-01-09 16:12:06 +00:00
|
|
|
|
2012-01-10 12:55:50 +00:00
|
|
|
extern void init_say(void);
|
2012-01-09 16:12:06 +00:00
|
|
|
extern void exit_say(void);
|
|
|
|
|
2012-02-08 11:44:42 +00:00
|
|
|
#ifdef CONFIG_MARS_DEBUG
|
2011-11-14 17:52:05 +00:00
|
|
|
#define INLINE static inline
|
|
|
|
//#define INLINE __attribute__((__noinline__))
|
|
|
|
extern void brick_dump_stack(void);
|
|
|
|
|
2012-02-08 11:44:42 +00:00
|
|
|
#else // CONFIG_MARS_DEBUG
|
2011-11-14 17:52:05 +00:00
|
|
|
|
|
|
|
#define INLINE static inline
|
|
|
|
#define brick_dump_stack() /*empty*/
|
|
|
|
|
2012-02-08 11:44:42 +00:00
|
|
|
#endif // CONFIG_MARS_DEBUG
|
2011-11-14 17:52:05 +00:00
|
|
|
|
|
|
|
#endif
|