some more patches

Heath Kehoe hakehoe at norand.com
Fri Oct 8 20:20:03 UTC 1999


Here's a patch against the Oct 7th 2.3 snapshot...

* Adds to configure an option to set the syslog facility.  There are a couple
  of reasons for this, both regarding OSs that don't have LOG_NEWS.  While
  the compiled programs (using config.h) will automatically use LOG_LOCAL1
  if configure doesn't see LOG_NEWS, the perl scripts that use syslog will
  not.  They were hard-coded to 'news'.  With the configure option, we can
  insert the specified facility into innshellvars.pl.  Also, there may be
  instances where a sysadmin is already using LOG_LOCAL1 and wants INN to
  use something else.

* Adds a couple of HP/UX-specific tests to configure.in, to turn on some
  necessary flags for the HP compiler.

* Adds some msync calls that are necessary for HP/UX (and other OSs for
  which MMAP_MISSES_WRITES gets defined).  With this fix, reading works
  properly with articlemmap=true on HPUX.

* Plugged a couple of possible memory leaks.



diff -rc ../inn-1999-10-07_03-00/INSTALL ./INSTALL
*** ../inn-1999-10-07_03-00/INSTALL	Sat Jul  3 19:55:50 1999
--- ./INSTALL	Fri Oct  8 14:42:28 1999
***************
*** 213,218 ****
--- 213,225 ----
          binaries.  When this option is used, inews will only be executable
          by users in the news group.
  
+     --with-syslog-facility=LOG_xxxx
+         Allows you to specify a syslog facility that INN programs log to.
+         The default is LOG_NEWS.  Usually, you'll only need this if you
+         are on an OS that doesn't have LOG_NEWS (such as HP/UX).  Be sure
+         to specify a facility that is not used by anything else on your
+         system, such as one of LOG_LOCAL0 through LOG_LOCAL7.
+ 
      For the most common installation, a standalone news server, a suggested
      set of options is:
  
diff -rc ../inn-1999-10-07_03-00/configure.in ./configure.in
*** ../inn-1999-10-07_03-00/configure.in	Thu Sep 30 17:36:01 1999
--- ./configure.in	Thu Oct  7 12:44:22 1999
***************
*** 124,129 ****
--- 124,135 ----
      NEWSMASTER=usenet)
  AC_SUBST(NEWSMASTER)
  
+ AC_ARG_WITH(syslog-facility,
+     [  --with-syslog-facility=LOG_FAC  Syslog facility [LOG_NEWS or LOG_LOCAL1]],
+     SYSLOG_FACILITY=$with_syslog_facility,
+     SYSLOG_FACILITY="LOG_NEWS")
+ AC_SUBST(SYSLOG_FACILITY)
+ 
  NEWSUMASK=02
  FILEMODE=0664
  DIRMODE=0775
***************
*** 1233,1238 ****
--- 1239,1257 ----
        # We are using built-in inline function
        CFLAGS="$CFLAGS -Kalloca"
        CXX="CC -DNO_CPLUSPLUS_ALLOCA"
+     fi
+   ;;
+ 
+   HP-UX)
+     if test "$GCC" != "yes"; then
+       # Need flag to turn on ANSI
+       CFLAGS="$CFLAGS -Ae"
+       # Need -g on link command for debug to work properly
+       case "$CFLAGS" in
+         *-g*)
+           LDFLAGS="$LDFLAGS -g"
+         ;;
+       esac
      fi
    ;;
  esac
diff -rc ../inn-1999-10-07_03-00/include/config.h.in ./include/config.h.in
*** ../inn-1999-10-07_03-00/include/config.h.in	Thu Sep 30 17:38:50 1999
--- ./include/config.h.in	Thu Oct  7 12:46:11 1999
***************
*** 190,211 ****
  /* Syslog Related Settings */
  /* Facility innd should log under. */
  #undef FACILITY_NEWS
! #ifdef FACILITY_NEWS
! # define LOG_FACILITY	LOG_NEWS
! #else
! # define LOG_FACILITY	LOG_LOCAL1
  #endif
  
! /* HP/UX headers define LOG_NEWS, but syslogd doesn't recognize it.  Bleagh!  */
! #ifdef HPUX
! # undef LOG_FACILITY
! # define LOG_FACILITY	LOG_LOCAL1
! #endif
  
- #define LOG_INN_SERVER		LOG_FACILITY
- 
  /* Facility all other programs should log under. */
! #define LOG_INN_PROG		LOG_FACILITY
  
  /* Flags to use in opening the logs; some programs add LOG_PID. */
  #define L_OPENLOG_FLAGS		(LOG_CONS | LOG_NDELAY)
--- 190,203 ----
  /* Syslog Related Settings */
  /* Facility innd should log under. */
  #undef FACILITY_NEWS
! #ifndef FACILITY_NEWS
! # define LOG_NEWS	LOG_LOCAL1
  #endif
  
! #define LOG_INN_SERVER		@SYSLOG_FACILITY@
  
  /* Facility all other programs should log under. */
! #define LOG_INN_PROG		@SYSLOG_FACILITY@
  
  /* Flags to use in opening the logs; some programs add LOG_PID. */
  #define L_OPENLOG_FLAGS		(LOG_CONS | LOG_NDELAY)
diff -rc ../inn-1999-10-07_03-00/samples/cnfsstat.in ./samples/cnfsstat.in
*** ../inn-1999-10-07_03-00/samples/cnfsstat.in	Tue Sep 21 04:49:24 1999
--- ./samples/cnfsstat.in	Thu Oct  7 12:46:45 1999
***************
*** 98,104 ****
      ## Comment out this eval line if you don't want to try to syslog
      eval { require Sys::Syslog; import Sys::Syslog; $use_syslog = 1 };
      if ($use_syslog) {
! 	openlog ('cnfsstat', 'pid', 'news');
      } else {
  	print STDERR "Syslog is not available.  -s option is ignored.\n";
      }
--- 98,104 ----
      ## Comment out this eval line if you don't want to try to syslog
      eval { require Sys::Syslog; import Sys::Syslog; $use_syslog = 1 };
      if ($use_syslog) {
! 	openlog ('cnfsstat', 'pid', $inn::syslog_facility);
      } else {
  	print STDERR "Syslog is not available.  -s option is ignored.\n";
      }
diff -rc ../inn-1999-10-07_03-00/samples/controlchan.in ./samples/controlchan.in
*** ../inn-1999-10-07_03-00/samples/controlchan.in	Thu Jun 10 08:12:54 1999
--- ./samples/controlchan.in	Thu Oct  7 12:47:08 1999
***************
*** 62,68 ****
      }
      Sys::Syslog::setlogsock('unix') if $^O =~ /linux|dec_osf/;
    }
!   openlog ('controlchan', 'pid', 'news');
  }
  
  logmsg ('notice', 'starting');
--- 62,68 ----
      }
      Sys::Syslog::setlogsock('unix') if $^O =~ /linux|dec_osf/;
    }
!   openlog ('controlchan', 'pid', $inn::syslog_facility);
  }
  
  logmsg ('notice', 'starting');
diff -rc ../inn-1999-10-07_03-00/samples/innshellvars.pl.in ./samples/innshellvars.pl.in
*** ../inn-1999-10-07_03-00/samples/innshellvars.pl.in	Mon Jun 14 01:07:34 1999
--- ./samples/innshellvars.pl.in	Thu Oct  7 12:47:34 1999
***************
*** 97,102 ****
--- 97,105 ----
  
  $umask = @NEWSUMASK@ ;
  
+ $syslog_facility = lc("@SYSLOG_FACILITY@");
+ $syslog_facility =~ s/log_//;
+ 
  $ENV{'PATH'} = "${newslbin}:${newsbin}:$ENV{'PATH'}:/bin:/usr/bin:/usr/ucb" ;
  
  1 ;
diff -rc ../inn-1999-10-07_03-00/samples/mailpost.in ./samples/mailpost.in
*** ../inn-1999-10-07_03-00/samples/mailpost.in	Tue May 11 16:52:57 1999
--- ./samples/mailpost.in	Thu Oct  7 12:47:57 1999
***************
*** 34,40 ****
  $usage =~ s!.*/!! ;
  my $prog = $usage ;
  
! openlog $usage, "pid", "news" ;
  
  $usage .= "[ -r addr ][ -f addr ][ -a approved ][ -d distribution ]" .
      " [ -m mailing-list ][ -b database ][ -o output-path ] newsgroups" ;
--- 34,40 ----
  $usage =~ s!.*/!! ;
  my $prog = $usage ;
  
! openlog $usage, "pid", $inn::syslog_facility ;
  
  $usage .= "[ -r addr ][ -f addr ][ -a approved ][ -d distribution ]" .
      " [ -m mailing-list ][ -b database ][ -o output-path ] newsgroups" ;
diff -rc ../inn-1999-10-07_03-00/samples/pgpverify.in ./samples/pgpverify.in
*** ../inn-1999-10-07_03-00/samples/pgpverify.in	Thu May 20 09:58:44 1999
--- ./samples/pgpverify.in	Thu Oct  7 12:48:37 1999
***************
*** 81,87 ****
  # For various reasons, it is impossible to economically have the script
  # figure out how to do syslogging correctly on the machine.
  #
! $syslog = 'news.err';
  # $syslog = '';  # an empty value means don't try to do syslogging.
  
  # How should syslog be accessed?
--- 81,89 ----
  # For various reasons, it is impossible to economically have the script
  # figure out how to do syslogging correctly on the machine.
  #
! $syslog = lc("@SYSLOG_FACILITY@");
! $syslog =~ s/log_//;
! $syslog = "$syslog.err";
  # $syslog = '';  # an empty value means don't try to do syslogging.
  
  # How should syslog be accessed?
diff -rc ../inn-1999-10-07_03-00/storage/cnfs/cnfs.c ./storage/cnfs/cnfs.c
*** ../inn-1999-10-07_03-00/storage/cnfs/cnfs.c	Mon Sep 13 00:55:03 1999
--- ./storage/cnfs/cnfs.c	Fri Oct  8 11:34:57 1999
***************
*** 1349,1354 ****
--- 1349,1357 ----
  	    if (!SMpreopen) CNFSshutdowncycbuff(cycbuff);
  	    return NULL;
  	}
+ #ifdef MMAP_MISSES_WRITES
+ 	msync(private->base, private->len, MS_INVALIDATE);
+ #endif
  #if defined(MADV_SEQUENTIAL) && defined(HAVE_MADVISE)
  	madvise(private->base, private->len, MADV_SEQUENTIAL);
  #endif
***************
*** 1669,1674 ****
--- 1672,1680 ----
  	    if (!SMpreopen) CNFSshutdowncycbuff(cycbuff);
  	    return art;
  	}
+ #ifdef MMAP_MISSES_WRITES
+ 	msync(private->base, private->len, MS_INVALIDATE);
+ #endif
  #if defined(MADV_SEQUENTIAL) && defined(HAVE_MADVISE)
  	madvise(private->base, private->len, MADV_SEQUENTIAL);
  #endif
diff -rc ../inn-1999-10-07_03-00/storage/timecaf/timecaf.c ./storage/timecaf/timecaf.c
*** ../inn-1999-10-07_03-00/storage/timecaf/timecaf.c	Mon Sep 13 00:55:20 1999
--- ./storage/timecaf/timecaf.c	Fri Oct  8 11:35:26 1999
***************
*** 446,451 ****
--- 446,454 ----
  	    DISPOSE(art);
  	    return NULL;
  	}
+ #ifdef MMAP_MISSES_WRITES
+ 	msync(private->mmapbase, private->mmaplen, MS_INVALIDATE);
+ #endif
  	private->artdata = private->mmapbase + delta;
      } else {
          private->artdata = NEW(char, private->artlen);
***************
*** 477,482 ****
--- 480,493 ----
      
      if ((p = SMFindBody(private->artdata, private->artlen)) == NULL) {
  	SMseterror(SMERR_NOBODY, NULL);
+ 	if (innconf->articlemmap) {
+ #if defined(MADV_DONTNEED) && defined(HAVE_MADVISE)
+ 	    madvise(private->mmapbase, private->mmaplen, MADV_DONTNEED);
+ #endif
+ 	    munmap(private->mmapbase, private->mmaplen);
+ 	} else {
+ 	    DISPOSE(private->artdata);
+ 	}
  	DISPOSE(art->private);
  	DISPOSE(art);
  	return NULL;
***************
*** 494,499 ****
--- 505,518 ----
  	return art;
      }
      SMseterror(SMERR_UNDEFINED, "Invalid retrieve request");
+     if (innconf->articlemmap) {
+ #if defined(MADV_DONTNEED) && defined(HAVE_MADVISE)
+ 	madvise(private->mmapbase, private->mmaplen, MADV_DONTNEED);
+ #endif
+ 	munmap(private->mmapbase, private->mmaplen);
+     } else {
+ 	DISPOSE(private->artdata);
+     }
      DISPOSE(art->private);
      DISPOSE(art);
      return NULL;
diff -rc ../inn-1999-10-07_03-00/storage/timehash/timehash.c ./storage/timehash/timehash.c
*** ../inn-1999-10-07_03-00/storage/timehash/timehash.c	Mon Sep 13 00:55:37 1999
--- ./storage/timehash/timehash.c	Thu Oct  7 12:55:44 1999
***************
*** 245,250 ****
--- 245,258 ----
      
      if ((p = SMFindBody(private->base, private->len)) == NULL) {
  	SMseterror(SMERR_NOBODY, NULL);
+ 	if (innconf->articlemmap) {
+ #if defined(MADV_DONTNEED) && defined(HAVE_MADVISE)
+ 	    madvise(private->base, private->len, MADV_DONTNEED);
+ #endif
+ 	    munmap(private->base, private->len);
+ 	} else {
+ 	    DISPOSE(private->base);
+ 	}
  	DISPOSE(art->private);
  	DISPOSE(art);
  	return NULL;
***************
*** 262,267 ****
--- 270,283 ----
  	return art;
      }
      SMseterror(SMERR_UNDEFINED, "Invalid retrieve request");
+     if (innconf->articlemmap) {
+ #if defined(MADV_DONTNEED) && defined(HAVE_MADVISE)
+ 	madvise(private->base, private->len, MADV_DONTNEED);
+ #endif
+ 	munmap(private->base, private->len);
+     } else {
+ 	DISPOSE(private->base);
+     }
      DISPOSE(art->private);
      DISPOSE(art);
      return NULL;


More information about the inn-workers mailing list