From owner-freebsd-stable Sat Oct 26 7:48:54 2002 Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 760D137B401 for ; Sat, 26 Oct 2002 07:48:50 -0700 (PDT) Received: from grosbein.pp.ru (www2.svzserv.kemerovo.su [213.184.65.86]) by mx1.FreeBSD.org (Postfix) with ESMTP id DF53E43E88 for ; Sat, 26 Oct 2002 07:48:45 -0700 (PDT) (envelope-from eugen@grosbein.pp.ru) Received: from grosbein.pp.ru (smmsp@localhost [127.0.0.1]) by grosbein.pp.ru (8.12.6/8.12.5) with ESMTP id g9QEmchG000641 for ; Sat, 26 Oct 2002 22:48:38 +0800 (KRAST) (envelope-from eugen@grosbein.pp.ru) Received: (from eugen@localhost) by grosbein.pp.ru (8.12.6/8.12.6/Submit) id g9QEkk5f000611 for freebsd-stable@FreeBSD.ORG; Sat, 26 Oct 2002 22:46:46 +0800 (KRAST) Date: Sat, 26 Oct 2002 22:46:46 +0800 From: Eugene Grosbein To: freebsd-stable@FreeBSD.ORG Subject: Re: increasing MAXLINE for syslog Message-ID: <20021026224646.A362@grosbein.pp.ru> References: <3DBA4189.2629E3DC@grosbein.pp.ru> <200210261120.g9QBKOXL025814@lurza.secnetix.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200210261120.g9QBKOXL025814@lurza.secnetix.de>; from olli@secnetix.de on Sat, Oct 26, 2002 at 01:20:24PM +0200 Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, Oct 26, 2002 at 01:20:24PM +0200, Oliver Fromme wrote: > > > > I've rebuilt and reinstalled libc, syslogd and logger using 10Kb as limit, ^^^^ > > > > then killed and restarted syslogd. logger still cannot log a message > > > > longer than 1Kb. What else should be done? > > > Did you also resize the 1K buffer in logger.c? > > Yes, I did. > > Did you inrease the sizes of fmt_cpy[] _and_ tbuf[] > in src/lib/libc/gen/syslog.c:vsyslog() accordingly? Yes, I did that too. I see it's time to show my patches. Against libc: --- Makefile.inc.orig Sun Sep 15 08:30:45 2002 +++ Makefile.inc Fri Oct 25 22:14:47 2002 @@ -4,6 +4,10 @@ # machine-independent gen sources .PATH: ${.CURDIR}/../libc/${MACHINE_ARCH}/gen ${.CURDIR}/../libc/gen +.if defined(SYSLOG_MAXLINE) +CFLAGS+=-DMAXLINE=${SYSLOG_MAXLINE} +.endif + SRCS+= _rand48.c _spinlock_stub.c alarm.c arc4random.c assert.c \ basename.c \ clock.c closedir.c confstr.c \ --- syslog.c.orig Thu Apr 11 05:35:50 2002 +++ syslog.c Fri Oct 25 22:15:46 2002 @@ -131,6 +131,10 @@ va_end(ap); } +#ifndef MAXLINE +#define MAXLINE 2048 +#endif + void vsyslog(pri, fmt, ap) int pri; @@ -141,7 +145,7 @@ register char ch, *p; time_t now; int fd, saved_errno; - char *stdp, tbuf[2048], fmt_cpy[1024], timbuf[26]; + char *stdp, tbuf[MAXLINE], fmt_cpy[MAXLINE], timbuf[26]; FILE *fp, *fmt_fp; struct bufcookie tbuf_cookie; struct bufcookie fmt_cookie; Against syslogd: --- Makefile.orig Fri Oct 25 22:07:27 2002 +++ Makefile Fri Oct 25 22:08:16 2002 @@ -10,4 +10,8 @@ CFLAGS+=-DINET6 -I${.CURDIR}/../../usr.bin/wall WARNS?= 1 +.if defined(SYSLOG_MAXLINE) +CFLAGS+=-DMAXLINE=${SYSLOG_MAXLINE} +.endif + .include --- syslogd.c.orig Fri Oct 25 22:07:19 2002 +++ syslogd.c Fri Oct 25 22:08:38 2002 @@ -71,7 +71,10 @@ * Priority comparison code by Harlan Stenn. */ +#ifndef MAXLINE #define MAXLINE 1024 /* maximum line length */ +#endif + #define MAXSVLINE 120 /* maximum saved line length */ #define DEFUPRI (LOG_USER|LOG_NOTICE) #define DEFSPRI (LOG_KERN|LOG_CRIT) And against logger: --- Makefile.orig Sat Oct 26 11:23:32 2002 +++ Makefile Sat Oct 26 11:24:11 2002 @@ -4,4 +4,8 @@ PROG= logger CFLAGS+=-DINET6 +.ifdef SYSLOG_MAXLINE +CFLAGS+=-DMAXLINE=${SYSLOG_MAXLINE} +.endif + .include --- logger.c.orig Sat Oct 26 11:20:58 2002 +++ logger.c Sat Oct 26 11:22:10 2002 @@ -78,6 +78,9 @@ #endif int send_to_all = 0; /* send message to all IPv4/IPv6 addresses */ +#ifndef MAXLINE +#define MAXLINE 1024 +#endif /* * logger -- read and log utility * @@ -90,7 +93,7 @@ char *argv[]; { int ch, logflags, pri; - char *tag, *host, buf[1024]; + char *tag, *host, buf[MAXLINE]; tag = NULL; host = NULL; I've put SYSLOG_MAXLINE=10240 into my /etc/make.conf and saw -DMAXLINE=10240 was here while rebuilding libc, syslogd and logger. I still cannot get more than 1K written to the log. Here is my test script: #!/bin/sh # # write line of dashes, length is passed as $1 # perl -e "print '-' x $1;" | logger -t logger # # See what's written actually sed -E -e '/logger:/!d' -e 's/^.*logger: -(.*)$/\1/' /var/log/messages | \ tail -1 #EOF I run ./test.sh number | wc -c to see. It shows it can write upto 996 dashes, with date and prefix it gives upto 1Kb. No more. What's a trick? Eugene Grosbein To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message