From 0eb50e3832b7a420a90a2b6cf9c69d0cbf7c08ca Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 11 Jul 2007 11:58:27 +0000 Subject: removed SYSV preprocessor macro; replaced with autotools equivalent --- ChangeLog | 1 + Makefile | 5 +++-- Makefile.am | 2 +- Makefile.in | 5 +++-- config.h | 6 +++--- config.h.in | 6 +++--- configure | 8 ++------ configure.ac | 3 +-- master.make | 4 ++-- syslogd.c | 42 ++++++++++-------------------------------- 10 files changed, 29 insertions(+), 53 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8a3025b6..4f59e981 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ --------------------------------------------------------------------------- Version 1.16.0 (RGer/Peter Vrabec), 2007-07-1? - build system switched to autotools +- removed SYSV preprocessor macro use, replaced with autotools equivalents --------------------------------------------------------------------------- Version 1.15.1 (RGer), 2007-07-10 - fixed a bug that caused a dynaFile selector to stall when there was diff --git a/Makefile b/Makefile index 913f1ca3..a6f96fcc 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,7 @@ am__installdirs = "$(DESTDIR)$(bindir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am_klogd_OBJECTS = klogd.$(OBJEXT) syslog.$(OBJEXT) pidfile.$(OBJEXT) \ - ksym.$(OBJEXT) + ksym.$(OBJEXT) ksym_mod.$(OBJEXT) klogd_OBJECTS = $(am_klogd_OBJECTS) klogd_LDADD = $(LDADD) am_rfc3195d_OBJECTS = rfc3195d.$(OBJEXT) @@ -174,7 +174,7 @@ target_alias = top_builddir = . top_srcdir = . zlib_libs = -lz -klogd_SOURCES = klogd.c syslog.c pidfile.c ksym.c +klogd_SOURCES = klogd.c syslog.c pidfile.c ksym.c ksym_mod.c rfc3195d_SOURCES = rfc3195d.c syslogd_SOURCES = syslogd.c pidfile.c template.c outchannel.c stringbuf.c srUtils.c parse.c syslogd_CPPFLAGS = $(mysql_includes) @@ -275,6 +275,7 @@ distclean-compile: include ./$(DEPDIR)/klogd.Po include ./$(DEPDIR)/ksym.Po +include ./$(DEPDIR)/ksym_mod.Po include ./$(DEPDIR)/pidfile.Po include ./$(DEPDIR)/rfc3195d.Po include ./$(DEPDIR)/syslog.Po diff --git a/Makefile.am b/Makefile.am index ba0f70e3..59fa2c47 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ bin_PROGRAMS=klogd rfc3195d syslogd -klogd_SOURCES=klogd.c syslog.c pidfile.c ksym.c +klogd_SOURCES=klogd.c syslog.c pidfile.c ksym.c ksym_mod.c rfc3195d_SOURCES=rfc3195d.c diff --git a/Makefile.in b/Makefile.in index d88b85b2..257b84e7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -49,7 +49,7 @@ am__installdirs = "$(DESTDIR)$(bindir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am_klogd_OBJECTS = klogd.$(OBJEXT) syslog.$(OBJEXT) pidfile.$(OBJEXT) \ - ksym.$(OBJEXT) + ksym.$(OBJEXT) ksym_mod.$(OBJEXT) klogd_OBJECTS = $(am_klogd_OBJECTS) klogd_LDADD = $(LDADD) am_rfc3195d_OBJECTS = rfc3195d.$(OBJEXT) @@ -174,7 +174,7 @@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ zlib_libs = @zlib_libs@ -klogd_SOURCES = klogd.c syslog.c pidfile.c ksym.c +klogd_SOURCES = klogd.c syslog.c pidfile.c ksym.c ksym_mod.c rfc3195d_SOURCES = rfc3195d.c syslogd_SOURCES = syslogd.c pidfile.c template.c outchannel.c stringbuf.c srUtils.c parse.c syslogd_CPPFLAGS = $(mysql_includes) @@ -275,6 +275,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/klogd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ksym.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ksym_mod.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pidfile.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfc3195d.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/syslog.Po@am__quote@ diff --git a/config.h b/config.h index 04ac5fec..9634b76c 100644 --- a/config.h +++ b/config.h @@ -72,6 +72,9 @@ /* Define to 1 if you have the `select' function. */ #define HAVE_SELECT 1 +/* Define to 1 if you have the `setsid' function. */ +#define HAVE_SETSID 1 + /* Define to 1 if you have the `socket' function. */ #define HAVE_SOCKET 1 @@ -225,9 +228,6 @@ /* Why there is this macro */ #define SYSLOG_INET 1 -/* I'd like to get rid of this. */ -#define SYSV 1 - /* Define to 1 if you can safely include both and . */ #define TIME_WITH_SYS_TIME 1 diff --git a/config.h.in b/config.h.in index c663c3e6..944c7fae 100644 --- a/config.h.in +++ b/config.h.in @@ -71,6 +71,9 @@ /* Define to 1 if you have the `select' function. */ #undef HAVE_SELECT +/* Define to 1 if you have the `setsid' function. */ +#undef HAVE_SETSID + /* Define to 1 if you have the `socket' function. */ #undef HAVE_SOCKET @@ -224,9 +227,6 @@ /* Why there is this macro */ #undef SYSLOG_INET -/* I'd like to get rid of this. */ -#undef SYSV - /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME diff --git a/configure b/configure index f8e4c08e..9c574093 100755 --- a/configure +++ b/configure @@ -6689,7 +6689,8 @@ fi -for ac_func in alarm gethostbyname gethostname gettimeofday memset regcomp select socket strcasecmp strchr strerror strndup strrchr strstr strtol strtoul uname + +for ac_func in setsid alarm gethostbyname gethostname gettimeofday memset regcomp select socket strcasecmp strchr strerror strndup strrchr strstr strtol strtoul uname do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -6786,11 +6787,6 @@ done # Ugly stuff -cat >>confdefs.h <<\_ACEOF -#define SYSV 1 -_ACEOF - - cat >>confdefs.h <<\_ACEOF #define SYSLOG_INET 1 _ACEOF diff --git a/configure.ac b/configure.ac index b242f8b2..49943f31 100644 --- a/configure.ac +++ b/configure.ac @@ -39,11 +39,10 @@ AC_TYPE_SIGNAL AC_FUNC_STAT AC_FUNC_VPRINTF AC_FUNC_WAIT3 -AC_CHECK_FUNCS([alarm gethostbyname gethostname gettimeofday memset regcomp select socket strcasecmp strchr strerror strndup strrchr strstr strtol strtoul uname]) +AC_CHECK_FUNCS([setsid alarm gethostbyname gethostname gettimeofday memset regcomp select socket strcasecmp strchr strerror strndup strrchr strstr strtol strtoul uname]) # Ugly stuff -AC_DEFINE(SYSV, 1, [I'd like to get rid of this.]) AC_DEFINE(SYSLOG_INET, 1, [Why there is this macro]) diff --git a/master.make b/master.make index 15da2526..8c3ab5df 100644 --- a/master.make +++ b/master.make @@ -55,7 +55,7 @@ template.o: template.c template.h stringbuf.h rsyslog.h outchannel.o: outchannel.c outchannel.h stringbuf.h syslogd.h rsyslog.h rfc3195d.o: rfc3195d.c rsyslog.h -syslogd.o: syslogd.c version.h parse.h template.h stringbuf.h outchannel.h syslogd.h rsyslog.h +syslogd.o: syslogd.c parse.h template.h stringbuf.h outchannel.h syslogd.h rsyslog.h ${CC} ${CFLAGS} ${NETZIP} ${SYSLOGD_FLAGS} -c $(VPATH)syslogd.c klogd: klogd.o syslog.o pidfile.o ksym.o ksym_mod.o @@ -65,7 +65,7 @@ klogd: klogd.o syslog.o pidfile.o ksym.o ksym_mod.o syslog.o: syslog.c ${CC} ${CFLAGS} ${SYSLOG_FLAGS} -c $(VPATH)syslog.c -klogd.o: klogd.c klogd.h version.h +klogd.o: klogd.c klogd.h ${CC} ${CFLAGS} ${KLOGD_FLAGS} ${FEATKLOGD} $(DEB) -c $(VPATH)klogd.c ksym.o: ksym.c klogd.h diff --git a/syslogd.c b/syslogd.c index dcef9fc8..fccca9ed 100644 --- a/syslogd.c +++ b/syslogd.c @@ -202,7 +202,7 @@ #include "mysql/errmsg.h" #endif -#if defined(__linux__) +#if HAVE_PATHS_H #include #endif @@ -4421,14 +4421,13 @@ static char **crunch_list(char *list) static void untty() -#ifdef SYSV +#ifdef HAVE_SETSID { if ( !Debug ) { setsid(); } return; } - #else { int i; @@ -5562,9 +5561,6 @@ void logmsg(int pri, struct msg *pMsg, int flags) textpri(PRItext, sizeof(PRItext) / sizeof(char), pri), flags, getRcvFrom(pMsg), msg); -#ifndef SYSV - omask = sigblock(sigmask(SIGHUP)|sigmask(SIGALRM)); -#endif /* rger 2005-11-24 (happy thanksgiving!): we now need to check if we have * a traditional syslog message or one formatted according to syslog-protocol. * We need to apply different parsers depending on that. We use the @@ -5622,10 +5618,6 @@ void logmsg(int pri, struct msg *pMsg, int flags) pMsg->msgFlags = flags; enqueueMsg(pMsg); - -#ifndef SYSV - (void) sigsetmask(omask); -#endif } @@ -6696,12 +6688,12 @@ static void wallmsg(register struct filed *f) * and doing notty(). */ if (fork() == 0) { - (void) signal(SIGTERM, SIG_DFL); - (void) alarm(0); -#ifndef SYSV - (void) signal(SIGTTOU, SIG_IGN); - (void) sigsetmask(0); -#endif + signal(SIGTERM, SIG_DFL); + alarm(0); +# ifdef SIGTTOU + signal(SIGTTOU, SIG_IGN); +# endif + sigsetmask(0); /* TODO: find a way to limit the max size of the message. hint: this * should go into the template! */ @@ -6769,18 +6761,8 @@ static void wallmsg(register struct filed *f) static void reapchild() { int saved_errno = errno; -#if defined(SYSV) && !defined(linux) - (void) signal(SIGCHLD, reapchild); /* reset signal handler -ASP */ - wait ((int *)0); -#else - union wait status; - - while (wait3(&status, WNOHANG, (struct rusage *) NULL) > 0) - ; -#endif -#ifdef linux - (void) signal(SIGCHLD, reapchild); /* reset signal handler -ASP */ -#endif + signal(SIGCHLD, reapchild); /* reset signal handler -ASP */ + wait(NULL); errno = saved_errno; } @@ -9787,10 +9769,6 @@ int main(int argc, char **argv) else #endif debugging_on = 1; -#ifndef SYSV - else - setlinebuf(stdout); -#endif #ifndef TESTING /* tuck my process id away */ -- cgit