Plex86 does not build on NetBSD because of use of loff_t. I don't know
what loff_t is, but I guess it is a long off_t? This is not needed for
NetBSD, since its off_t type is 64 bits.
The patch below adds a configure test for loff_t, and uses off_t if
no loff_t was found.
/Krister
Index: plex86/config.h.in
===================================================================
RCS file: /cvsroot-plex86/plex86/config.h.in,v
retrieving revision 1.7
diff -c -r1.7 config.h.in
*** plex86/config.h.in 2000/12/14 06:13:36 1.7
--- plex86/config.h.in 2001/02/14 20:44:02
***************
*** 41,46 ****
--- 41,48 ----
# error "can't find data type of 8 bytes"
#endif
+ #define LOFF_T loff_t
+
typedef unsigned int Boolean;
#define PLEX86 1
Index: plex86/configure.in
===================================================================
RCS file: /cvsroot-plex86/plex86/configure.in,v
retrieving revision 1.22
diff -c -r1.22 configure.in
*** plex86/configure.in 2001/01/21 16:17:15 1.22
--- plex86/configure.in 2001/02/14 20:44:03
***************
*** 26,31 ****
--- 26,37 ----
LIBDL='')
AC_SUBST(LIBDL)
+ dnl Use loff_t if available
+ AC_MSG_CHECKING(type of file offsets)
+ AC_EGREP_CPP(loff_t, [#include <sys/types.h>], LOFF_T=loff_t, LOFF_T=off_t)
+ AC_MSG_RESULT($LOFF_T)
+ AC_DEFINE_UNQUOTED(LOFF_T, $LOFF_T)
+
dnl When compiling with gcc, use appropriate warning level
if test "$GCC" = "yes"; then
CFLAGS="$CFLAGS -Wall -Wstrict-prototypes"
Index: plex86/user/plugins/bochs/iodev/harddrv.cc
===================================================================
RCS file: /cvsroot-plex86/plex86/user/plugins/bochs/iodev/harddrv.cc,v
retrieving revision 1.6
diff -c -r1.6 harddrv.cc
*** plex86/user/plugins/bochs/iodev/harddrv.cc 2001/01/01 15:58:28 1.6
--- plex86/user/plugins/bochs/iodev/harddrv.cc 2001/02/14 20:44:32
***************
*** 313,326 ****
}
else { /* read next one into controller buffer */
unsigned long logical_sector;
! loff_t ret;
BX_SELECTED_CONTROLLER.status.drq = 1;
BX_SELECTED_CONTROLLER.status.seek_complete = 1;
logical_sector = calculate_logical_address();
! ret = BX_SELECTED_HD.hard_drive->lseek((loff_t)logical_sector * 512,
SEEK_SET);
if (ret == -1)
bx_panic("disk: could lseek() hard drive image file\n");
--- 313,326 ----
}
else { /* read next one into controller buffer */
unsigned long logical_sector;
! LOFF_T ret;
BX_SELECTED_CONTROLLER.status.drq = 1;
BX_SELECTED_CONTROLLER.status.seek_complete = 1;
logical_sector = calculate_logical_address();
! ret = BX_SELECTED_HD.hard_drive->lseek((LOFF_T)logical_sector * 512,
SEEK_SET);
if (ret == -1)
bx_panic("disk: could lseek() hard drive image file\n");
***************
*** 668,678 ****
/* if buffer completely writtten */
if (BX_SELECTED_CONTROLLER.buffer_index >= 512) {
unsigned long logical_sector;
! loff_t ret;
logical_sector = calculate_logical_address();
! ret = BX_SELECTED_HD.hard_drive->lseek((loff_t)logical_sector * 512,
SEEK_SET);
if (ret == -1)
bx_panic("disk: could lseek() hard drive image file\n");
--- 668,678 ----
/* if buffer completely writtten */
if (BX_SELECTED_CONTROLLER.buffer_index >= 512) {
unsigned long logical_sector;
! LOFF_T ret;
logical_sector = calculate_logical_address();
! ret = BX_SELECTED_HD.hard_drive->lseek((LOFF_T)logical_sector * 512,
SEEK_SET);
if (ret == -1)
bx_panic("disk: could lseek() hard drive image file\n");
***************
*** 1293,1299 ****
logical_sector = calculate_logical_address();
! ret = BX_SELECTED_HD.hard_drive->lseek((loff_t)logical_sector * 512,
SEEK_SET);
if (ret == -1) {
bx_panic("disk: could not lseek() hard drive image file\n");
--- 1293,1299 ----
logical_sector = calculate_logical_address();
! ret = BX_SELECTED_HD.hard_drive->lseek((LOFF_T)logical_sector * 512,
SEEK_SET);
if (ret == -1) {
bx_panic("disk: could not lseek() hard drive image file\n");
***************
*** 2307,2313 ****
}
}
! loff_t default_image_t::lseek (loff_t offset, int whence)
{
return pluginWCLSeek(fd, offset, whence);
}
--- 2307,2313 ----
}
}
! LOFF_T default_image_t::lseek (LOFF_T offset, int whence)
{
return pluginWCLSeek(fd, offset, whence);
}
Index: plex86/user/plugins/bochs/iodev/harddrv.h
===================================================================
RCS file: /cvsroot-plex86/plex86/user/plugins/bochs/iodev/harddrv.h,v
retrieving revision 1.2
diff -c -r1.2 harddrv.h
*** plex86/user/plugins/bochs/iodev/harddrv.h 2001/01/01 15:58:28 1.2
--- plex86/user/plugins/bochs/iodev/harddrv.h 2001/02/14 20:44:35
***************
*** 45,51 ****
// Position ourselves. Return the resulting offset from the
// beginning of the file.
! virtual loff_t lseek (loff_t offset, int whence) = 0;
// Read count bytes to the buffer buf. Return the number of
// bytes read (count).
--- 45,51 ----
// Position ourselves. Return the resulting offset from the
// beginning of the file.
! virtual LOFF_T lseek (LOFF_T offset, int whence) = 0;
// Read count bytes to the buffer buf. Return the number of
// bytes read (count).
***************
*** 71,77 ****
// Position ourselves. Return the resulting offset from the
// beginning of the file.
! loff_t lseek (loff_t offset, int whence);
// Read count bytes to the buffer buf. Return the number of
// bytes read (count).
--- 71,77 ----
// Position ourselves. Return the resulting offset from the
// beginning of the file.
! LOFF_T lseek (LOFF_T offset, int whence);
// Read count bytes to the buffer buf. Return the number of
// bytes read (count).
Index: plex86/user/plugins/write-cache/write-cache.cc
===================================================================
RCS file: /cvsroot-plex86/plex86/user/plugins/write-cache/write-cache.cc,v
retrieving revision 1.2
diff -c -r1.2 write-cache.cc
*** plex86/user/plugins/write-cache/write-cache.cc 2001/01/07 04:38:16 1.2
--- plex86/user/plugins/write-cache/write-cache.cc 2001/02/14 20:44:44
***************
*** 167,173 ****
void WriteCache::DoSeek()
{
! loff_t result;
#if 1
if (!mustseek)
--- 167,173 ----
void WriteCache::DoSeek()
{
! LOFF_T result;
#if 1
if (!mustseek)