1303 files changed, 32187 insertions, 57138 deletions
diff --git a/runit/svlogd.c b/runit/svlogd.c index c080b9a..3ed13b6 100644 --- a/runit/svlogd.c +++ b/runit/svlogd.c @@ -26,7 +26,6 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* Busyboxed by Denys Vlasenko <vda.linux@googlemail.com> */ -/* TODO: depends on runit_lib.c - review and reduce/eliminate */ /* Config files @@ -125,6 +124,18 @@ log message, you can use a pattern like this instead -*: *: pid * */ +//config:config SVLOGD +//config: bool "svlogd" +//config: default y +//config: help +//config: svlogd continuously reads log data from its standard input, optionally +//config: filters log messages, and writes the data to one or more automatically +//config: rotated logs. + +//applet:IF_SVLOGD(APPLET(svlogd, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_SVLOGD) += svlogd.o + //usage:#define svlogd_trivial_usage //usage: "[-ttv] [-r C] [-R CHARS] [-l MATCHLEN] [-b BUFLEN] DIR..." //usage:#define svlogd_full_usage "\n\n" @@ -144,6 +155,7 @@ log message, you can use a pattern like this instead #include <sys/file.h> #include "libbb.h" +#include "common_bufsiz.h" #include "runit_lib.h" #define LESS(a,b) ((int)((unsigned)(b) - (unsigned)(a)) > 0) @@ -222,7 +234,9 @@ struct globals { #define blocked_sigset (G.blocked_sigset) #define fl_flag_0 (G.fl_flag_0 ) #define dirn (G.dirn ) +#define line bb_common_bufsiz1 #define INIT_G() do { \ + setup_common_bufsiz(); \ SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \ linemax = 1000; \ /*buflen = 1024;*/ \ @@ -230,8 +244,6 @@ struct globals { replace = ""; \ } while (0) -#define line bb_common_bufsiz1 - #define FATAL "fatal: " #define WARNING "warning: " @@ -772,7 +784,7 @@ static NOINLINE unsigned logdir_open(struct logdir *ld, const char *fn) case '!': if (s[1]) { free(ld->processor); - ld->processor = wstrdup(s); + ld->processor = wstrdup(&s[1]); } break; } @@ -1034,9 +1046,9 @@ int svlogd_main(int argc, char **argv) } if (opt & 2) if (!repl) repl = '_'; // -R if (opt & 4) { // -l - linemax = xatou_range(l, 0, BUFSIZ-26); + linemax = xatou_range(l, 0, COMMON_BUFSIZE-26); if (linemax == 0) - linemax = BUFSIZ-26; + linemax = COMMON_BUFSIZE-26; if (linemax < 256) linemax = 256; } |