HP/UX port fixes for 2.3
Heath Kehoe
hakehoe at norand.com
Wed Sep 8 03:45:52 UTC 1999
I have the inn-1999-09-04_03-00 snapshot running on an HP/UX system,
using cnfs and tradindexed.
Here are some notes...
* I have to turn off articlemmap. For some reason, innfeed was
producing "mmap: No space" errors (the man page doesn't document
ENOSPC as a possible error return for an mmap, so this may be
due to kernel bugs)
* cnfs buffer headers were not updating. This was because the cnfs
code has the header mmap()'d, but it was using write() to update
the buffer header. In HP/UX, if a process write()s under an area
it has mmap()'d, it doesn't automatically invalidate the mmap()'d
area, so the writes get lost. To fix this, I modified the
flushheader function to memcpy the data into the mmap()'d area
(which is what the buffindexed code does, anyway).
* Added msync calls to cnfs.c and buffindexed.c
* Cleaned up HPUX define tests a little in clibrary.h.in. Most
of the "#ifdef HPUX" tests are looking for the symbol "HPUX"
which HP's compiler doesn't automatically define (it defines
"__hpux" instead).
* buffindexed overview seems to work OK... as long as you don't
run expireover. It caused both innd and itself to lock up
hard. I couldn't even kill -KILL them (which means it's almost
certainly a kernel bug).
Inclosed is a diff showing my patches to clibrary.h.in, cnfs.c,
and buffindexed.c
diff -rc inn-1999-09-04_03-00/include/clibrary.h.in inn-1999-09-04_03-00.patched/include/clibrary.h.in
*** inn-1999-09-04_03-00/include/clibrary.h.in Thu Jun 3 01:20:01 1999
--- inn-1999-09-04_03-00.patched/include/clibrary.h.in Sun Sep 5 00:48:05 1999
***************
*** 186,191 ****
--- 186,195 ----
#define strtoul(a,b,c) strtol (a,b,c)
#endif
+ #if (defined(__hpux) || defined(__hpux__)) && ! defined(HPUX)
+ #define HPUX
+ #endif
+
#if defined(UIO_MAXIOV) && !defined(IOV_MAX)
#define IOV_MAX UIO_MAXIOV
#endif
***************
*** 208,214 ****
#define IOV_MAX 16
#endif
! #if (defined(HPUX) || defined(__hpux__)) && !defined(IOV_MAX)
#define IOV_MAX 16
#endif
--- 212,218 ----
#define IOV_MAX 16
#endif
! #if defined(HPUX) && !defined(IOV_MAX)
#define IOV_MAX 16
#endif
***************
*** 222,228 ****
#endif
! #if (defined(__hpux) || defined(hpux)) && defined(HAVE_UNION_WAIT)
/* Even though hpux defines a union wait, it's better to not use it.
*/
#undef HAVE_UNION_WAIT
--- 226,232 ----
#endif
! #if defined(HPUX) && defined(HAVE_UNION_WAIT)
/* Even though hpux defines a union wait, it's better to not use it.
*/
#undef HAVE_UNION_WAIT
diff -rc inn-1999-09-04_03-00/storage/buffindexed/buffindexed.c inn-1999-09-04_03-00.patched/storage/buffindexed/buffindexed.c
*** inn-1999-09-04_03-00/storage/buffindexed/buffindexed.c Thu Sep 2 10:03:43 1999
--- inn-1999-09-04_03-00.patched/storage/buffindexed/buffindexed.c Sun Sep 5 10:53:40 1999
***************
*** 485,490 ****
--- 485,497 ----
strncpy(rpx.freea, offt2hex(ovbuff->freeblk, TRUE), OVBUFFLASIZ);
strncpy(rpx.updateda, offt2hex(ovbuff->updated, TRUE), OVBUFFLASIZ);
memcpy(ovbuff->bitfield, &rpx, sizeof(OVBUFFHEAD));
+ #if defined (DO_MMAP_SYNC)
+ #if defined (HAVE_MSYNC_3_ARG)
+ msync(ovbuff->bitfield, ovbuff->base, MS_ASYNC);
+ #else
+ msync(ovbuff->bitfield, ovbuff->base);
+ #endif
+ #endif
ovbuff->needflush = FALSE;
return;
}
diff -rc inn-1999-09-04_03-00/storage/cnfs/cnfs.c inn-1999-09-04_03-00.patched/storage/cnfs/cnfs.c
*** inn-1999-09-04_03-00/storage/cnfs/cnfs.c Fri Aug 27 23:04:19 1999
--- inn-1999-09-04_03-00.patched/storage/cnfs/cnfs.c Sun Sep 5 10:56:48 1999
***************
*** 234,242 ****
if (!cycbuff->needflush)
return TRUE;
memset(&rpx, 0, sizeof(CYCBUFFEXTERN));
! if (CNFSseek(cycbuff->fd, (CYCBUFF_OFF_T) 0, SEEK_SET) < 0) {
! syslog(L_ERROR, "CNFSflushhead: magic CNFSseek failed: %m");
! return FALSE;
}
if (cycbuff->magicver == 3) {
cycbuff->updated = time(NULL);
--- 234,244 ----
if (!cycbuff->needflush)
return TRUE;
memset(&rpx, 0, sizeof(CYCBUFFEXTERN));
! if (cycbuff->bitfield == NULL) {
! if (CNFSseek(cycbuff->fd, (CYCBUFF_OFF_T) 0, SEEK_SET) < 0) {
! syslog(L_ERROR, "CNFSflushhead: magic CNFSseek failed: %m");
! return FALSE;
! }
}
if (cycbuff->magicver == 3) {
cycbuff->updated = time(NULL);
***************
*** 255,263 ****
} else {
strncpy(rpx.currentbuff, "FALSE", CNFSMASIZ);
}
! if ((b = write(cycbuff->fd, &rpx, sizeof(CYCBUFFEXTERN))) != sizeof(CYCBUFFEXTERN)) {
! syslog(L_ERROR, "%s: CNFSflushhead: write failed (%d bytes): %m", LocalLogName, b);
! return FALSE;
}
cycbuff->needflush = FALSE;
} else {
--- 257,276 ----
} else {
strncpy(rpx.currentbuff, "FALSE", CNFSMASIZ);
}
! if (cycbuff->bitfield == NULL) {
! if ((b = write(cycbuff->fd, &rpx, sizeof(CYCBUFFEXTERN))) != sizeof(CYCBUFFEXTERN)) {
! syslog(L_ERROR, "%s: CNFSflushhead: write failed (%d bytes): %m", LocalLogName, b);
! return FALSE;
! }
! } else {
! memcpy(cycbuff->bitfield, &rpx, sizeof(CYCBUFFEXTERN));
! #if defined (DO_MMAP_SYNC)
! #if defined (HAVE_MSYNC_3_ARG)
! msync(cycbuff->bitfield, cycbuff->minartoffset, MS_ASYNC);
! #else
! msync(cycbuff->bitfield, cycbuff->minartoffset);
! #endif
! #endif
}
cycbuff->needflush = FALSE;
} else {
***************
*** 287,301 ****
CYCBUFFEXTERN rpx;
char buf[64];
! if (CNFSseek(cycbuff->fd, (CYCBUFF_OFF_T) 0, SEEK_SET) < 0) {
! syslog(L_ERROR, "CNFSReadFreeAndCycle: magic lseek failed: %m");
! SMseterror(SMERR_UNDEFINED, NULL);
! return;
! }
! if (read(cycbuff->fd, &rpx, sizeof(CYCBUFFEXTERN)) != sizeof(rpx)) {
! syslog(L_ERROR, "CNFSReadFreeAndCycle: magic read failed: %m");
! SMseterror(SMERR_UNDEFINED, NULL);
! return;
}
/* Sanity checks are not needed since CNFSinit_disks() has already done. */
buf[CNFSLASIZ] = '\0';
--- 300,318 ----
CYCBUFFEXTERN rpx;
char buf[64];
! if (cycbuff->bitfield == NULL) {
! if (CNFSseek(cycbuff->fd, (CYCBUFF_OFF_T) 0, SEEK_SET) < 0) {
! syslog(L_ERROR, "CNFSReadFreeAndCycle: magic lseek failed: %m");
! SMseterror(SMERR_UNDEFINED, NULL);
! return;
! }
! if (read(cycbuff->fd, &rpx, sizeof(CYCBUFFEXTERN)) != sizeof(rpx)) {
! syslog(L_ERROR, "CNFSReadFreeAndCycle: magic read failed: %m");
! SMseterror(SMERR_UNDEFINED, NULL);
! return;
! }
! } else {
! memcpy(&rpx, cycbuff->bitfield, sizeof(CYCBUFFEXTERN));
}
/* Sanity checks are not needed since CNFSinit_disks() has already done. */
buf[CNFSLASIZ] = '\0';
More information about the inn-workers
mailing list