Another patch (2nd Try)

Heath Kehoe hakehoe at norand.com
Thu Nov 4 23:13:38 UTC 1999


Hmm... yesterday I sent this patch to inn-workers, but it didn't
appear to go through.  If y'all saw this once already, I apologize
for making you see it again.

It contians some HP-specific fixes, plus a bugfix to controlchan.

 -Heath


diff -rc ./configure.in ../inn-1999-11-02_03-01.new/configure.in
*** ./configure.in	Mon Nov  1 03:15:36 1999
--- ../inn-1999-11-02_03-01.new/configure.in	Wed Nov  3 16:20:31 1999
***************
*** 224,229 ****
--- 224,230 ----
  dnl FIXME: hostname is more reliable on most systems; uname may truncate.
  HOSTNAME=`uname -n`
  AC_SUBST(HOSTNAME)
+ AC_CANONICAL_HOST
  
  dnl If libtool was requested, configure it now.
  if test x"$EXTOBJ" = xlo ; then
***************
*** 242,247 ****
--- 243,263 ----
  AC_AIX
  AC_ISC_POSIX
  
+ case "$host" in
+   *hpux*)
+     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
+   
  dnl Checks for pathnames.
  
  dnl See if we have ctags; if so, set CTAGS to its full path plus the -t -w
***************
*** 473,481 ****
  dnl and link flags and check for some necessary functions.
  if test x"$DO_LFS" = xDO ; then
      AC_MSG_CHECKING(for largefile linkage)
!     LFS_CFLAGS=`$GETCONF LFS_CFLAGS`
!     LFS_LDFLAGS=`$GETCONF LFS_LDFLAGS`
!     LFS_LIBS=`$GETCONF LFS_LIBS`
      AC_SUBST(LFS_CFLAGS)
      AC_SUBST(LFS_LDFLAGS)
      AC_SUBST(LFS_LIBS)
--- 489,507 ----
  dnl and link flags and check for some necessary functions.
  if test x"$DO_LFS" = xDO ; then
      AC_MSG_CHECKING(for largefile linkage)
!     case "$host" in
!       *hpux*)
!         # HP doesn't have the getconf flags
!         LFS_CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
!         LFS_LDFLAGS=""
!         LFS_LIBS=""
! 	;;
!       *)
!         LFS_CFLAGS=`$GETCONF LFS_CFLAGS`
!         LFS_LDFLAGS=`$GETCONF LFS_LDFLAGS`
!         LFS_LIBS=`$GETCONF LFS_LIBS`
! 	;;
!     esac
      AC_SUBST(LFS_CFLAGS)
      AC_SUBST(LFS_LDFLAGS)
      AC_SUBST(LFS_LIBS)
***************
*** 1101,1118 ****
      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
  AC_SUBST(CFLAGS)
  AC_SUBST(CXX)
--- 1127,1132 ----
diff -rc ./backends/controlchan.in ../inn-1999-11-02_03-01.new/backends/controlchan.in
*** ./backends/controlchan.in	Mon Nov  1 03:08:17 1999
--- ../inn-1999-11-02_03-01.new/backends/controlchan.in	Wed Nov  3 15:44:14 1999
***************
*** 423,434 ****
  
  
  # Open an article appropriately to our storage method (or lack thereof).
  sub open_article {
    my $token = shift;
    local(*ART);
    
    my $fail = 0;
!   if ($SM eq "cat") {
      $fail = 1 if (!open(ART,"<$token"));
    } else {
      $fail = 1 if (!open(ART, "$SM $token|"));
--- 423,436 ----
  
  
  # Open an article appropriately to our storage method (or lack thereof).
+ # If the token starts with a /, it is assumed to be a regular file,
+ # even if we're using sm.
  sub open_article {
    my $token = shift;
    local(*ART);
    
    my $fail = 0;
!   if ($SM eq "cat" or $token =~ /^\//) {
      $fail = 1 if (!open(ART,"<$token"));
    } else {
      $fail = 1 if (!open(ART, "$SM $token|"));
diff -rc ./innd/chan.c ../inn-1999-11-02_03-01.new/innd/chan.c
*** ./innd/chan.c	Wed Oct 27 01:42:33 1999
--- ../inn-1999-11-02_03-01.new/innd/chan.c	Wed Nov  3 01:11:05 1999
***************
*** 213,219 ****
  
      /* Make the descriptor close-on-exec and non-blocking. */
      CloseOnExec(fd, TRUE);
! #if !defined(HPUX)
      /* Stupid HPUX 11.0 has a broken listen/accept where setting the
       * listensocket to nonblocking prevents you from successfully setting the
       * socket returned by accept(2) back to blocking mode, no matter what,
--- 213,219 ----
  
      /* Make the descriptor close-on-exec and non-blocking. */
      CloseOnExec(fd, TRUE);
! #if !defined(_HPUX_SOURCE)
      /* Stupid HPUX 11.0 has a broken listen/accept where setting the
       * listensocket to nonblocking prevents you from successfully setting the
       * socket returned by accept(2) back to blocking mode, no matter what,
diff -rc ./lib/dbz.c ../inn-1999-11-02_03-01.new/lib/dbz.c
*** ./lib/dbz.c	Sun Oct 10 04:39:41 1999
--- ../inn-1999-11-02_03-01.new/lib/dbz.c	Wed Nov  3 13:22:19 1999
***************
*** 1666,1672 ****
      FILE *fpi;
      char ibuf[2048], *p;
      HASH key;
!     long where, val;
      int  initialize = 0, size = 2500000;
      char *history = NULL;
      dbzoptions opt;
--- 1666,1672 ----
      FILE *fpi;
      char ibuf[2048], *p;
      HASH key;
!     OFFSET_T where;
      int  initialize = 0, size = 2500000;
      char *history = NULL;
      dbzoptions opt;
diff -rc ./nnrpd/loadave.c ../inn-1999-11-02_03-01.new/nnrpd/loadave.c
*** ./nnrpd/loadave.c	Fri Oct 23 23:35:08 1998
--- ../inn-1999-11-02_03-01.new/nnrpd/loadave.c	Wed Nov  3 01:09:12 1999
***************
*** 57,63 ****
      if (fd < 0)
  	return -1;
  
! #if	defined(HPUX)
      (void)nlist("/hp-ux", NameList);
  #else
  #if	defined(SUNOS5)
--- 57,63 ----
      if (fd < 0)
  	return -1;
  
! #if	defined(_HPUX_SOURCE)
      (void)nlist("/hp-ux", NameList);
  #else
  #if	defined(SUNOS5)
diff -rc ./nnrpd/nnrpd.c ../inn-1999-11-02_03-01.new/nnrpd/nnrpd.c
*** ./nnrpd/nnrpd.c	Sun Oct 31 04:06:29 1999
--- ../inn-1999-11-02_03-01.new/nnrpd/nnrpd.c	Wed Nov  3 01:10:17 1999
***************
*** 16,24 ****
  #include <pwd.h>
  #include <grp.h>
  #include <signal.h>
! #if	defined(HPUX)
  #include <sys/pstat.h>
! #endif	/* defined(HPUX) */
  #if HAVE_GETSPNAM
  #  include <shadow.h>
  #endif /* HAVE_GETSPNAM */
--- 16,24 ----
  #include <pwd.h>
  #include <grp.h>
  #include <signal.h>
! #if	defined(_HPUX_SOURCE)
  #include <sys/pstat.h>
! #endif	/* defined(_HPUX_SOURCE) */
  #if HAVE_GETSPNAM
  #  include <shadow.h>
  #endif /* HAVE_GETSPNAM */
***************
*** 63,72 ****
  STATIC double	STATstart;
  STATIC double	STATfinish;
  STATIC char	*PushedBack;
! #if	!defined(HPUX)
  STATIC char	*TITLEstart;
  STATIC char	*TITLEend;
! #endif	/* !defined(HPUX) */
  STATIC sig_atomic_t	ChangeTrace;
  BOOL	DaemonMode = FALSE;
  #if HAVE_GETSPNAM
--- 63,72 ----
  STATIC double	STATstart;
  STATIC double	STATfinish;
  STATIC char	*PushedBack;
! #if	!defined(_HPUX_SOURCE)
  STATIC char	*TITLEstart;
  STATIC char	*TITLEend;
! #endif	/* !defined(_HPUX_SOURCE) */
  STATIC sig_atomic_t	ChangeTrace;
  BOOL	DaemonMode = FALSE;
  #if HAVE_GETSPNAM
***************
*** 263,269 ****
  #if defined(HAVE_SETPROCTITLE)
      setproctitle("%s %s", ClientHost, what);
  #else
! #if	!defined(HPUX)
      register char	*p;
      register int	i;
      char		buff[BUFSIZ];
--- 263,269 ----
  #if defined(HAVE_SETPROCTITLE)
      setproctitle("%s %s", ClientHost, what);
  #else
! #if	!defined(_HPUX_SOURCE)
      register char	*p;
      register int	i;
      char		buff[BUFSIZ];
***************
*** 288,294 ****
      (void)sprintf(buff, "(nnrpd) %s %s", ClientHost, what);
      un.pst_command = buff;
      (void)pstat(PSTAT_SETCMD, un, strlen(buff), 0, 0);
! #endif	/* defined(HPUX) */
  #endif	/* defined(HAVE_SETPROCTITLE) */
  }
  
--- 288,294 ----
      (void)sprintf(buff, "(nnrpd) %s %s", ClientHost, what);
      un.pst_command = buff;
      (void)pstat(PSTAT_SETCMD, un, strlen(buff), 0, 0);
! #endif	/* !defined(_HPUX_SOURCE) */
  #endif	/* defined(HAVE_SETPROCTITLE) */
  }
  
***************
*** 614,624 ****
      GID_T		shadowgid;
  #endif /* HAVE_GETSPNAM */
  
! #if	!defined(HPUX)
      /* Save start and extent of argv for TITLEset. */
      TITLEstart = argv[0];
      TITLEend = argv[argc - 1] + strlen(argv[argc - 1]) - 1;
! #endif	/* !defined(HPUX) */
  
      /* Parse arguments.   Must COPY() optarg if used because the
       * TITLEset() routine would clobber it! */
--- 614,624 ----
      GID_T		shadowgid;
  #endif /* HAVE_GETSPNAM */
  
! #if	!defined(_HPUX_SOURCE)
      /* Save start and extent of argv for TITLEset. */
      TITLEstart = argv[0];
      TITLEend = argv[argc - 1] + strlen(argv[argc - 1]) - 1;
! #endif	/* !defined(_HPUX_SOURCE) */
  
      /* Parse arguments.   Must COPY() optarg if used because the
       * TITLEset() routine would clobber it! */
diff -rc ./storage/buffindexed/buffindexed.c ../inn-1999-11-02_03-01.new/storage/buffindexed/buffindexed.c
*** ./storage/buffindexed/buffindexed.c	Sun Oct 31 00:55:03 1999
--- ../inn-1999-11-02_03-01.new/storage/buffindexed/buffindexed.c	Tue Nov  2 15:20:11 1999
***************
*** 260,266 ****
  STATIC char	*Gib;
  STATIC char	*Gdb;
  
! #ifdef HPUX
  /* With HP/UX, you definitely do not want to mix mmap-accesses of
     a file with read()s and write()s of the same file */
  STATIC OFFSET_T mmapwrite(int fd, void *buf, OFFSET_T nbyte, OFFSET_T offset) {
--- 260,266 ----
  STATIC char	*Gib;
  STATIC char	*Gdb;
  
! #ifdef MMAP_MISSES_WRITES
  /* With HP/UX, you definitely do not want to mix mmap-accesses of
     a file with read()s and write()s of the same file */
  STATIC OFFSET_T mmapwrite(int fd, void *buf, OFFSET_T nbyte, OFFSET_T offset) {
***************
*** 279,285 ****
    munmap(addr, len);
    return nbyte;
  }
! #endif /* HPUX */
  
  STATIC BOOL ovparse_part_line(char *l) {
    char		*p;
--- 279,285 ----
    munmap(addr, len);
    return nbyte;
  }
! #endif /* MMAP_MISSES_WRITES */
  
  STATIC BOOL ovparse_part_line(char *l) {
    char		*p;
***************
*** 719,725 ****
  }
  
  /* just search ov, do not set curindex */
! #ifdef HPUX
  STATIC OV getsrchov(OV ov, ARTNUM artnum, OVINDEXHEAD *ovihp, SRCH type) {
    OVBUFF	*ovbuff;
    OVINDEXHEAD	*ovindexhead;
--- 719,725 ----
  }
  
  /* just search ov, do not set curindex */
! #ifdef MMAP_MISSES_WRITES
  STATIC OV getsrchov(OV ov, ARTNUM artnum, OVINDEXHEAD *ovihp, SRCH type) {
    OVBUFF	*ovbuff;
    OVINDEXHEAD	*ovindexhead;
***************
*** 786,792 ****
    }
    return ovnull;
  }
! #endif /* HPUX */
  
  #ifdef OV_DEBUG
  STATIC OV ovblocknew(GROUPENTRY *ge) {
--- 786,792 ----
    }
    return ovnull;
  }
! #endif /* MMAP_MISSES_WRITES */
  
  #ifdef OV_DEBUG
  STATIC OV ovblocknew(GROUPENTRY *ge) {
***************
*** 1297,1307 ****
      ovblock.ovindexhead.prev = ovnull;
      ovblock.ovindexhead.next = ovnull;
      ovblock.ovindexhead.base = base;
! #ifdef HPUX
      if (mmapwrite(ovbuff->fd, (POINTER)&ovblock, sizeof(ovblock), ovbuff->base + (ov.blocknum * OV_BLOCKSIZE)) != sizeof(ovblock)) {
  #else
      if (pwrite(ovbuff->fd, (POINTER)&ovblock, sizeof(ovblock), ovbuff->base + (ov.blocknum * OV_BLOCKSIZE)) != sizeof(ovblock)) {
! #endif /* HPUX */
        syslog(L_ERROR, "%s: ovsetcurindexblock could not initialize ovbuff block index '%d', blocknum '%d': %m", LocalLogName, ov.index, ov.blocknum);
        return FALSE;
      }
--- 1297,1307 ----
      ovblock.ovindexhead.prev = ovnull;
      ovblock.ovindexhead.next = ovnull;
      ovblock.ovindexhead.base = base;
! #ifdef MMAP_MISSES_WRITES
      if (mmapwrite(ovbuff->fd, (POINTER)&ovblock, sizeof(ovblock), ovbuff->base + (ov.blocknum * OV_BLOCKSIZE)) != sizeof(ovblock)) {
  #else
      if (pwrite(ovbuff->fd, (POINTER)&ovblock, sizeof(ovblock), ovbuff->base + (ov.blocknum * OV_BLOCKSIZE)) != sizeof(ovblock)) {
! #endif /* MMAP_MISSES_WRITES */
        syslog(L_ERROR, "%s: ovsetcurindexblock could not initialize ovbuff block index '%d', blocknum '%d': %m", LocalLogName, ov.index, ov.blocknum);
        return FALSE;
      }
***************
*** 1413,1423 ****
      abort();
    }
  #endif /* OV_DEBUG */
! #ifdef HPUX
    if (mmapwrite(ovbuff->fd, data, len, ovbuff->base + ge->curdata.blocknum * OV_BLOCKSIZE + ge->curoffset) != len) {
  #else
    if (pwrite(ovbuff->fd, data, len, ovbuff->base + ge->curdata.blocknum * OV_BLOCKSIZE + ge->curoffset) != len) {
! #endif /* HPUX */
      syslog(L_ERROR, "%s: could not append overview record index '%d', blocknum '%d': %m", LocalLogName, ge->curdata.index, ge->curdata.blocknum);
      return FALSE;
    }
--- 1413,1423 ----
      abort();
    }
  #endif /* OV_DEBUG */
! #ifdef MMAP_MISSES_WRITES
    if (mmapwrite(ovbuff->fd, data, len, ovbuff->base + ge->curdata.blocknum * OV_BLOCKSIZE + ge->curoffset) != len) {
  #else
    if (pwrite(ovbuff->fd, data, len, ovbuff->base + ge->curdata.blocknum * OV_BLOCKSIZE + ge->curoffset) != len) {
! #endif /* MMAP_MISSES_WRITES */
      syslog(L_ERROR, "%s: could not append overview record index '%d', blocknum '%d': %m", LocalLogName, ge->curdata.index, ge->curdata.blocknum);
      return FALSE;
    }
***************
*** 1448,1458 ****
      abort();
    }
  #endif /* OV_DEBUG */
! #ifdef HPUX
    if (mmapwrite(ovbuff->fd, &ie, sizeof(ie), ovbuff->base + ge->curindex.blocknum * OV_BLOCKSIZE + sizeof(OVINDEXHEAD) + sizeof(ie) * (artnum - ge->baseinblock + baseoffset)) != sizeof(ie)) {
  #else
    if (pwrite(ovbuff->fd, &ie, sizeof(ie), ovbuff->base + ge->curindex.blocknum * OV_BLOCKSIZE + sizeof(OVINDEXHEAD) + sizeof(ie) * (artnum - ge->baseinblock + baseoffset)) != sizeof(ie)) {
! #endif /* HPUX */
      syslog(L_ERROR, "%s: could not write index record index '%d', blocknum '%d': %m", LocalLogName, ge->curindex.index, ge->curindex.blocknum);
      return TRUE;
    }
--- 1448,1458 ----
      abort();
    }
  #endif /* OV_DEBUG */
! #ifdef MMAP_MISSES_WRITES
    if (mmapwrite(ovbuff->fd, &ie, sizeof(ie), ovbuff->base + ge->curindex.blocknum * OV_BLOCKSIZE + sizeof(OVINDEXHEAD) + sizeof(ie) * (artnum - ge->baseinblock + baseoffset)) != sizeof(ie)) {
  #else
    if (pwrite(ovbuff->fd, &ie, sizeof(ie), ovbuff->base + ge->curindex.blocknum * OV_BLOCKSIZE + sizeof(OVINDEXHEAD) + sizeof(ie) * (artnum - ge->baseinblock + baseoffset)) != sizeof(ie)) {
! #endif /* MMAP_MISSES_WRITES */
      syslog(L_ERROR, "%s: could not write index record index '%d', blocknum '%d': %m", LocalLogName, ge->curindex.index, ge->curindex.blocknum);
      return TRUE;
    }
***************
*** 2192,2202 ****
        ov = ovblks[i].indexov;
        if ((ovbuff = getovbuff(ov)) == NULL)
  	break;
! #ifdef HPUX
        if (mmapwrite(ovbuff->fd, (POINTER)ovblks[i].ovblock, sizeof(OVBLOCK), ovbuff->base + (ov.blocknum * OV_BLOCKSIZE)) != sizeof(OVBLOCK)) {
  #else
        if (pwrite(ovbuff->fd, (POINTER)ovblks[i].ovblock, sizeof(OVBLOCK), ovbuff->base + (ov.blocknum * OV_BLOCKSIZE)) != sizeof(OVBLOCK)) {
! #endif /* HPUX */
  	syslog(L_ERROR, "%s: ovaddblk could not append overview record index '%d', blocknum '%d': %m", LocalLogName, ov.index, ov.blocknum);
  	break;
        }
--- 2192,2202 ----
        ov = ovblks[i].indexov;
        if ((ovbuff = getovbuff(ov)) == NULL)
  	break;
! #ifdef MMAP_MISSES_WRITES
        if (mmapwrite(ovbuff->fd, (POINTER)ovblks[i].ovblock, sizeof(OVBLOCK), ovbuff->base + (ov.blocknum * OV_BLOCKSIZE)) != sizeof(OVBLOCK)) {
  #else
        if (pwrite(ovbuff->fd, (POINTER)ovblks[i].ovblock, sizeof(OVBLOCK), ovbuff->base + (ov.blocknum * OV_BLOCKSIZE)) != sizeof(OVBLOCK)) {
! #endif /* MMAP_MISSES_WRITES */
  	syslog(L_ERROR, "%s: ovaddblk could not append overview record index '%d', blocknum '%d': %m", LocalLogName, ov.index, ov.blocknum);
  	break;
        }



More information about the inn-workers mailing list