Signed-off-by: John Crispin <blogic@openwrt.org>
#include <stdio.h>
#include <syslog.h>
-#include <unistd.h>
#include <linux/types.h>
int
main(int argc, char **argv)
{
- int ch, log_size = 0;
-
signal(SIGPIPE, SIG_IGN);
- while ((ch = getopt(argc, argv, "S:")) != -1) {
- switch (ch) {
- case 'S':
- log_size = atoi(optarg);
- if (log_size < 1)
- log_size = 1;
- log_size *= 1024;
- break;
- }
- }
uloop_init();
ubus_timer.cb = ubus_connect_cb;
uloop_timeout_set(&ubus_timer, 1000);
- log_init(log_size);
+ log_init();
uloop_run();
if (_ctx)
ubus_free(_ctx);
#include <libubox/usock.h>
#include <libubox/ustream.h>
-#include <ubusmsg.h>
-
#include "syslog.h"
#define LOG_DEFAULT_SIZE (16 * 1024)
}
void
-log_init(int _log_size)
+log_init(void)
{
- if (_log_size > 0)
- log_size = _log_size;
-
- /* reserve 512 bytes for protocol overhead */
- if (log_size > (UBUS_MAX_MSGLEN - 512))
- log_size = UBUS_MAX_MSGLEN - 512;
-
regcomp(&pat_prio, "^<([0-9]*)>(.*)", REG_EXTENDED);
regcomp(&pat_tstamp, "^\[[ 0]*([0-9]*).([0-9]*)] (.*)", REG_EXTENDED);
char data[];
};
-void log_init(int log_size);
+void log_init(void);
void log_shutdown(void);
typedef void (*log_list_cb)(struct log_head *h);