From f2fc13115a90ba2ca575352b04bd8abf7af64d23 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 28 Jun 2005 12:41:03 +0000 Subject: fixed some issues on FreeBSD --- Makefile | 5 +++-- NEWS | 5 +++++ outchannel.c | 7 ------- syslogd.c | 62 +++--------------------------------------------------------- syslogd.h | 7 +++++++ 5 files changed, 18 insertions(+), 68 deletions(-) diff --git a/Makefile b/Makefile index c6dda15a..898d1b99 100644 --- a/Makefile +++ b/Makefile @@ -12,8 +12,8 @@ CC= gcc # enables the MySQL code. By default, that one is commented out # change the comment chars to activate it if you need MySQL! # In this case, also look down further to uncomment the libs -CFLAGS= $(RPM_OPT_FLAGS) -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce -#CFLAGS= $(RPM_OPT_FLAGS) -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce -DWITH_DB +#CFLAGS= $(RPM_OPT_FLAGS) -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce +CFLAGS= $(RPM_OPT_FLAGS) -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce -DWITH_DB -I/usr/local/include LDFLAGS= -s INSTALL = install @@ -22,6 +22,7 @@ MANDIR = /usr/share/man # Uncomment the following to use mysql. #LIBS = -lmysqlclient #/var/lib/mysql/mysql +LIBS = -lmysqlclient -L/usr/local/lib/mysql # thid define for FreeBSD # There is one report that under an all ELF system there may be a need to # explicilty link with libresolv.a. If linking syslogd fails you may wish diff --git a/NEWS b/NEWS index 57d5af7c..2906aa2a 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +--------------------------------------------------------------------------- +Version 0.9.1 (RGer) +- fixed code so that it compiles without errors under FreeBSD +- removed now unused function "allocate_log()" from syslogd.c + --------------------------------------------------------------------------- Version 0.9.0 (RGer) - changed the filed structure to be a linked list. Previously, it diff --git a/outchannel.c b/outchannel.c index 6efd0256..cade0492 100644 --- a/outchannel.c +++ b/outchannel.c @@ -1,10 +1,3 @@ -#ifndef NOLARGEFILE -# define _GNU_SOURCE -# define _LARGEFILE_SOURCE -# define _LARGEFILE64_SOURCE -# define _FILE_OFFSET_BITS 64 -#endif - /* This is the output channel processing code of rsyslog. * Output channels - in the long term - will define how * messages will be sent to whatever file or other medium. diff --git a/syslogd.c b/syslogd.c index 410d10f4..612a11a2 100644 --- a/syslogd.c +++ b/syslogd.c @@ -101,13 +101,6 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -#ifndef NOLARGEFILE -# define _GNU_SOURCE -# define _LARGEFILE_SOURCE -# define _LARGEFILE64_SOURCE -# define _FILE_OFFSET_BITS 64 -#endif - #if !defined(lint) && !defined(NO_SCCS) char copyright2[] = "@(#) Copyright (c) 1983, 1988 Regents of the University of California.\n\ @@ -617,7 +610,6 @@ void doexit(int sig); void init(); void cfline(char *line, register struct filed *f); int decode(char *name, struct code *codetab); -static void allocate_log(void); void sighup_handler(); #ifdef WITH_DB void initMySQL(register struct filed *f); @@ -3034,14 +3026,14 @@ again: /* didn't work out, so disable... */ f->f_type = F_UNUSED; snprintf(errMsg, sizeof(errMsg), - "no longer writing to file %s; grown beyond configured file size of %lu bytes, actual size %lu - configured command did not resolve situation\n", + "no longer writing to file %s; grown beyond configured file size of %llu bytes, actual size %llu - configured command did not resolve situation\n", f->f_un.f_fname, f->f_sizeLimit, actualFileSize); errno = 0; logerror(errMsg); return; } else { snprintf(errMsg, sizeof(errMsg), - "file %s had grown beyond configured file size of %lu bytes, actual size was %lu - configured command resolved situation\n", + "file %s had grown beyond configured file size of %llu bytes, actual size was %llu - configured command resolved situation\n", f->f_un.f_fname, f->f_sizeLimit, actualFileSize); errno = 0; logerror(errMsg); @@ -4624,52 +4616,6 @@ void dprintf(char *fmt, ...) } -/* - * The following function is responsible for allocating/reallocating the - * array which holds the structures which define the logging outputs. - */ -static void allocate_log() - -{ - dprintf("Called allocate_log, nlogs = %d.\n", nlogs); - - /* - * Decide whether the array needs to be initialized or needs to - * grow. - */ - if ( nlogs == -1 ) - { - Files = (struct filed *) malloc(sizeof(struct filed)); - if ( Files == (void *) 0 ) - { - dprintf("Cannot initialize log structure."); - logerror("Cannot initialize log structure."); - return; - } - } - else - { - /* Re-allocate the array. */ - Files = (struct filed *) realloc(Files, (nlogs+2) * \ - sizeof(struct filed)); - if ( Files == (struct filed *) 0 ) - { - dprintf("Cannot grow log structure."); - logerror("Cannot grow log structure."); - return; - } - } - - /* - * Initialize the array element, bump the number of elements in the - * the array and return. - */ - ++nlogs; - memset(&Files[nlogs], '\0', sizeof(struct filed)); - return; -} - - /* * The following function is resposible for handling a SIGHUP signal. Since * we are now doing mallocs/free as part of init we had better not being @@ -4688,7 +4634,7 @@ void sighup_handler() /* * The following function is responsible for initiatlizing a * MySQL connection. - * Initially added 2004-10-28 + * Initially added 2004-10-28 mmeckelein */ void initMySQL(register struct filed *f) { @@ -4698,8 +4644,6 @@ void initMySQL(register struct filed *f) if (checkDBErrorState(f)) return; - dprintf("in initMysql() \n"); - mysql_init(&f->f_hmysql); do { iCounter++; diff --git a/syslogd.h b/syslogd.h index 9ff9be9c..39e79da4 100644 --- a/syslogd.h +++ b/syslogd.h @@ -3,3 +3,10 @@ #define dprintf mydprintf #endif /* __GLIBC__ */ void dprintf(char *, ...); + +#ifndef NOLARGEFILE +# define _GNU_SOURCE +# define _LARGEFILE_SOURCE +# define _LARGEFILE64_SOURCE +# define _FILE_OFFSET_BITS 64 +#endif -- cgit