Bug 88535 - emulators/hercules segfaults [patch, and maintainer change]
Summary: emulators/hercules segfaults [patch, and maintainer change]
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Erwin Lansing
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-05 23:50 UTC by trasz
Modified: 2006-02-04 22:19 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description trasz 2005-11-05 23:50:16 UTC
hercules-390 emulator crashes almost immediately after accessing a DASD.
example backtrace:

#0  0x2830531b in pthread_testcancel () from /usr/lib/libpthread.so.1
#1  0x282f6145 in sigaction () from /usr/lib/libpthread.so.1
#2  0x282f01dd in pthread_kill () from /usr/lib/libpthread.so.1
#3  0x282efbac in raise () from /usr/lib/libpthread.so.1
#4  0x081deb92 in ?? ()
#5  0x0000000b in ?? ()
#6  0x00000000 in ?? ()
#7  0xbf1d4a98 in ?? ()
#8  0x081deab2 in ?? ()
#9  0x00000000 in ?? ()
#10 0x00000000 in ?? ()
#11 0x00000000 in ?? ()
#12 0x283084bc in ?? () from /usr/lib/libpthread.so.1
#13 0xbf1d4b00 in ?? ()
#14 0x082b4000 in ?? ()
#15 0xbf1d4ac8 in ?? ()
#16 0x282f4e26 in sigaction () from /usr/lib/libpthread.so.1
Previous frame identical to this frame (corrupt stack?)

How-To-Repeat: launch hercules and load zzsa with config like this:

000d 3505 standalone/zzsacard.bin
030e 1403 log/zzsa.txt
0190 3270
0148 3350 dasd/mvsres.148

launch x3270, enter 'zzsecret' and try to list the VTOC of 0148.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2005-11-05 23:51:13 UTC
Responsible Changed
From-To: freebsd-ports-bugs->phk

Over to maintainer
Comment 2 Bjoern A. Zeeb freebsd_committer freebsd_triage 2006-01-14 15:39:33 UTC
Responsible Changed
From-To: phk->bz

I have an update to Hercules 3.03.1 ready.
Comment 3 Bjoern A. Zeeb freebsd_committer freebsd_triage 2006-01-14 15:52:17 UTC
Could you try hercules 3.03.1 from

http://sources.zabbadoz.net/freebsd/ports/experimental/hercules-3.03.1.tar

It's almost untested but I am going to continue to work on this
and I will happily accept problem reports (with details how to
reproduce) and all positive feedback before I am going to send
patches upstream and to ports.

I know that configure complains about one of the header files atm.

-- 
Bjoern A. Zeeb				bzeeb at Zabbadoz dot NeT
Comment 4 Bjoern A. Zeeb freebsd_committer freebsd_triage 2006-01-25 21:59:55 UTC
Here is an initial update for the hercules port that I'd like to get
committed.

As you can see I started to work on CTCI but it should not be
used yet. There is a problem with the sockio ioctls/tun and
route in FreeBSD.

Also chaged the default from fthreads to pthreads. You may change this
with make config.

You can also find the patch at
http://sources.zabbadoz.net/freebsd/ports/emulators-hercules-20060125-01.diff

Patches in files/* changed.

phk ok'ed that I take over maintainership for this port.


Index: Makefile
===================================================================
RCS file: /local/mirror/FreeBSD/r/pcvs/ports/emulators/hercules/Makefile,v
retrieving revision 1.15
diff -u -p -r1.15 Makefile
--- Makefile	4 Feb 2004 04:35:56 -0000	1.15
+++ Makefile	25 Jan 2006 20:29:06 -0000
@@ -6,36 +6,46 @@
  #

  PORTNAME=	hercules
-PORTVERSION=	2.17.1
-PORTREVISION=	2
+PORTVERSION=	3.03.1
  CATEGORIES=	emulators
  MASTER_SITES=	http://www.conmicro.cx/hercules/

-MAINTAINER=	phk@FreeBSD.org
+MAINTAINER=	bzeeb+freebsdports@zabbadoz.net
  COMMENT=	The Hercules System/370, ESA/390, and z/Architecture Emulator

-GNU_CONFIGURE=	yes
-USE_GETTEXT=	yes
-USE_REINPLACE=	yes
+OPTIONS=	PTHREADS "Build with pthreads instead of fthreads." on \
+		NLS "Build with native language support." on \
+		DEBUG "Enable for debugging hercules itself." off
+
+GNU_CONFIGURE=		yes
+.if defined(WITH_DEBUG)
+CONFIGURE_ENV+=		CFLAGS=-g
+.endif
+.if defined(WITH_PTHREADS)
+CONFIGURE_ARGS+=	--disable-fthreads
+.endif
+.if defined(WITHOUT_NLS)
+CONFIGURE_ARGS+=	--disable-nls
+USE_GETTEXT=		yes
+.endif
+USE_REINPLACE=		yes

  post-patch:
  	@${REINPLACE_CMD} -e 's@-lpthread@${PTHREAD_LIBS}@g' ${WRKSRC}/configure
+.if defined(NOPORTDOCS)
+	@${REINPLACE_CMD} -e 's,intl m4 po util html man,intl m4 po util man,g' ${WRKSRC}/Makefile.in
+.else
+	@${REINPLACE_CMD} -e 's,^datadir = @datadir@,datadir = ${PREFIX}/share/doc/,' ${WRKSRC}/html/Makefile.in
+.endif

-do-install:
-.for i in hercules dasdinit dasdisup dasdload dasdls dasdpdsu \
-	tapecopy tapemap tapesplt cckd2ckd cckdcdsk ckd2cckd \
-	cckdcomp cckdswap hetget hetinit hetmap hetupd dmap2hrc
-	${INSTALL_PROGRAM} ${WRKSRC}/$i ${PREFIX}/bin
-.endfor
+MAN1=			cckddiag.1 dasdseq.1
+MAN4=			cckd.4

  .if !defined(NOPORTDOCS)
-	@${MKDIR} ${DOCSDIR}
-.for i in ../hercules.cnf cckddasd.html hercconf.html hercfaq.html \
-	hercinst.html herclic.html hercload.html hercnew.html herctcp.html \
-	hercules.css index.html
-	${INSTALL_DATA} ${WRKSRC}/html/$i ${DOCSDIR}
-.endfor
+PORTDOCS=		*
  .endif
+
+post-install:
  	@${CAT} ${PKGMESSAGE}

  .include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /local/mirror/FreeBSD/r/pcvs/ports/emulators/hercules/distinfo,v
retrieving revision 1.4
diff -u -p -r1.4 distinfo
--- distinfo	18 Mar 2004 18:00:21 -0000	1.4
+++ distinfo	25 Jan 2006 20:29:06 -0000
@@ -1,2 +1,3 @@
-MD5 (hercules-2.17.1.tar.gz) = e98138eb45d114f2c4a805db91fe308c
-SIZE (hercules-2.17.1.tar.gz) = 1172656
+MD5 (hercules-3.03.1.tar.gz) = 8576461fff6ed642fc69350826cf3c1d
+SHA256 (hercules-3.03.1.tar.gz) = f654785f1a12a39707ed66bc54b202dc70b90ecf3102660182d7f1ddddb7eba9
+SIZE (hercules-3.03.1.tar.gz) = 2071850
Index: pkg-plist
===================================================================
RCS file: /local/mirror/FreeBSD/r/pcvs/ports/emulators/hercules/pkg-plist,v
retrieving revision 1.2
diff -u -p -r1.2 pkg-plist
--- pkg-plist	25 Jun 2002 05:22:10 -0000	1.2
+++ pkg-plist	25 Jan 2006 20:29:06 -0000
@@ -1,14 +1,25 @@
  bin/cckd2ckd
  bin/cckdcdsk
  bin/cckdcomp
+bin/cckddiag
  bin/cckdswap
+bin/cfba2fba
  bin/ckd2cckd
+bin/cvslvlck
+bin/dasdcat
+bin/dasdconv
+bin/dasdcopy
  bin/dasdinit
  bin/dasdisup
+bin/dasdlist
  bin/dasdload
  bin/dasdls
  bin/dasdpdsu
+bin/dasdseq
  bin/dmap2hrc
+bin/fba2cfba
+bin/hercifc
+bin/herclin
  bin/hercules
  bin/hetget
  bin/hetinit
@@ -17,15 +28,52 @@ bin/hetupd
  bin/tapecopy
  bin/tapemap
  bin/tapesplt
-%%PORTDOCS%%share/doc/hercules/cckddasd.html
-%%PORTDOCS%%share/doc/hercules/hercconf.html
-%%PORTDOCS%%share/doc/hercules/hercfaq.html
-%%PORTDOCS%%share/doc/hercules/hercinst.html
-%%PORTDOCS%%share/doc/hercules/herclic.html
-%%PORTDOCS%%share/doc/hercules/hercload.html
-%%PORTDOCS%%share/doc/hercules/hercnew.html
-%%PORTDOCS%%share/doc/hercules/herctcp.html
-%%PORTDOCS%%share/doc/hercules/hercules.cnf
-%%PORTDOCS%%share/doc/hercules/hercules.css
-%%PORTDOCS%%share/doc/hercules/index.html
-%%PORTDOCS%%@dirrm share/doc/hercules
+lib/libherc.la
+lib/libherc.so
+lib/libhercd.la
+lib/libhercd.so
+lib/libhercs.la
+lib/libhercs.so
+lib/libherct.la
+lib/libherct.so
+lib/libhercu.la
+lib/libhercu.so
+lib/hercules/dyncrypt.la
+lib/hercules/dyncrypt.so
+lib/hercules/dyngui.la
+lib/hercules/dyngui.so
+lib/hercules/dyninst.la
+lib/hercules/dyninst.so
+lib/hercules/hdt1052c.la
+lib/hercules/hdt1052c.so
+lib/hercules/hdt1403.la
+lib/hercules/hdt1403.so
+lib/hercules/hdt2703.la
+lib/hercules/hdt2703.so
+lib/hercules/hdt2880.la
+lib/hercules/hdt2880.so
+lib/hercules/hdt3088.la
+lib/hercules/hdt3088.so
+lib/hercules/hdt3270.la
+lib/hercules/hdt3270.so
+lib/hercules/hdt3420.la
+lib/hercules/hdt3420.so
+lib/hercules/hdt3505.la
+lib/hercules/hdt3505.so
+lib/hercules/hdt3525.la
+lib/hercules/hdt3525.so
+lib/hercules/hdteq.la
+lib/hercules/hdteq.so
+lib/hercules/hdtqeth.la
+lib/hercules/hdtqeth.so
+@dirrm lib/hercules
+share/hercules/awssl-v19g
+share/hercules/awswrite.jcl
+share/hercules/cckddump.hla
+share/hercules/cckdload.hla
+share/hercules/rawstape.jcl
+share/hercules/tapeconv.jcl
+share/hercules/zzsacard.bin
+@dirrm share/hercules
+share/locale/de/LC_MESSAGES/hercules.mo
+share/locale/nl/LC_MESSAGES/hercules.mo
Index: files/patch-compile.h
===================================================================
RCS file: files/patch-compile.h
diff -N files/patch-compile.h
--- files/patch-compile.h	29 Apr 2003 05:17:56 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,151 +0,0 @@
-diff -ur ./cckddasd.c ../../work/hercules-2.17.1/cckddasd.c
---- ./cckddasd.c	Fri Jan 24 16:53:54 2003
-+++ ../../work/hercules-2.17.1/cckddasd.c	Mon Apr 28 20:41:10 2003
-@@ -2987,7 +2987,11 @@
-     if (rc < hrc) hrc = rc;
- 
-     if (cckdblk.fsync)
-+#if defined(__linux__)
-         rc = fdatasync (cckd->fd[cckd->sfn]);
-+#else
-+	rc = fsync(cckd->fd[cckd->sfn]);
-+#endif
- 
-     return hrc;
- } /* cckd_harden */
-@@ -4268,7 +4272,11 @@
-             {
-                 obtain_lock (&cckd->filelock);
-                 if (cckdblk.fsync)
-+#if defined(__linux__)
-                     rc = fdatasync (cckd->fd[cckd->sfn]);
-+#else
-+                    rc = fsync (cckd->fd[cckd->sfn]);
-+#endif
-                 cckd_flush_space (dev);
-                 cckd_truncate (dev, 0);
-                 release_lock (&cckd->filelock);
-diff -ur ./ctc_ctci.c ../../work/hercules-2.17.1/ctc_ctci.c
---- ./ctc_ctci.c	Sat Feb  1 20:34:57 2003
-+++ ../../work/hercules-2.17.1/ctc_ctci.c	Mon Apr 28 20:38:32 2003
-@@ -9,7 +9,7 @@
- // linux 2.4 modifications (c) Copyright Fritz Elfert, 2001-2003
- //
- 
--#if !defined(__APPLE__)
-+#if !defined(__APPLE__) && !defined(__FreeBSD__)
- 
- #include "hercules.h"
- #include "devtype.h"
-@@ -1302,4 +1302,4 @@
- 
-     return 0;
- }
--#endif /* !defined(__APPLE__) */
-+#endif /* !defined(__APPLE__) && !defined(__FreeBSD__) */
-diff -ur ./ctc_lcs.c ../../work/hercules-2.17.1/ctc_lcs.c
---- ./ctc_lcs.c	Sat Feb  1 20:34:57 2003
-+++ ../../work/hercules-2.17.1/ctc_lcs.c	Mon Apr 28 20:38:00 2003
-@@ -5,7 +5,7 @@
- // Copyright (C) 2002-2003 by James A. Pierson
- //
- 
--#if !defined(__APPLE__)
-+#if !defined(__APPLE__) && !defined(__FreeBSD__)
- 
- #include "hercules.h"
- #include "devtype.h"
-@@ -1976,4 +1983,4 @@
- 
-     return pszBuff;
- }
--#endif /* !defined(__APPLE__) */
-+#endif /* !defined(__APPLE__) && !defined(__FreeBSD__) */
-diff -ur ./ctcadpt.c ../../work/hercules-2.17.1/ctcadpt.c
---- ./ctcadpt.c	Sat Feb  1 20:34:57 2003
-+++ ../../work/hercules-2.17.1/ctcadpt.c	Mon Apr 28 20:39:09 2003
-@@ -17,7 +17,7 @@
- //
- //   Please read README.NETWORKING for more info.
- //
--#if !defined(__APPLE__)
-+#if !defined(__APPLE__) && !defined(__FreeBSD__)
- 
- #include "hercules.h"
- #include "devtype.h"
-@@ -1561,4 +1561,4 @@
-         logmsg( " %s\n", print_chars );
-     }
- }
--#endif /* !defined(__APPLE__) */
-+#endif /* !defined(__APPLE__) && !defined(__FreeBSD__) */
-diff -ur ./ctcadpt.h ../../work/hercules-2.17.1/ctcadpt.h
---- ./ctcadpt.h	Mon Jan 20 04:23:51 2003
-+++ ../../work/hercules-2.17.1/ctcadpt.h	Mon Apr 28 20:24:47 2003
-@@ -93,7 +93,9 @@
- #define FRAME_TYPE_IP   0x0800
- #define FRAME_TYPE_ARP  0x0806
- #define FRAME_TYPE_SNA  0x80D5
--
-+#ifndef IFHWADDRLEN
-+#define IFHWADDRLEN	6
-+#endif
- typedef uint8_t MAC[IFHWADDRLEN];       // Data Type for MAC Addresses
- 
- // ---------------------------------------------------------------------
-diff -ur ./devtype.c ../../work/hercules-2.17.1/devtype.c
---- ./devtype.c	Sat Feb  1 20:34:57 2003
-+++ ../../work/hercules-2.17.1/devtype.c	Mon Apr 28 20:39:35 2003
-@@ -51,13 +51,13 @@
-     { "3270", 0x3270, &loc3270_device_hndinfo },
-     { "3287", 0x3287, &loc3270_device_hndinfo },
- 
--#   if !defined(__APPLE__)
-+#   if !defined(__APPLE__) && !defined(__FreeBSD__)
-     /* Communications devices */
-     { "3088",  0x3088, &ctcadpt_device_hndinfo },
-     { "CTCI",  0x3088, &ctcadpt_device_hndinfo },
-     { "CTCT",  0x3088, &ctcadpt_device_hndinfo },
-     { "LCS",   0x3088, &ctcadpt_device_hndinfo },
-     { "VMNET", 0x3088, &ctcadpt_device_hndinfo },
--#   endif /* !defined(__APPLE__) */
-+#   endif /* !defined(__APPLE__) && !defined(__FreeBSD__) */
- 
-     { NULL, 0, NULL } };
-diff -ur ./tapedev.c ../../work/hercules-2.17.1/tapedev.c
---- ./tapedev.c	Sat Feb  1 20:34:57 2003
-+++ ../../work/hercules-2.17.1/tapedev.c	Mon Apr 28 20:37:20 2003
-@@ -2,6 +2,9 @@
- /* JCS - minor changes by John Summerfield                           */
- /*              ESA/390 Tape Device Handler                          */
- 
-+#if defined(__FreeBSD__)
-+#define __APPLE__
-+#endif
- /*-------------------------------------------------------------------*/
- /* This module contains device handling functions for emulated       */
- /* 3420 magnetic tape devices for the Hercules ESA/390 emulator.     */
-diff -ur ./tuntap.c ../../work/hercules-2.17.1/tuntap.c
---- ./tuntap.c	Sat Feb  1 20:34:57 2003
-+++ ../../work/hercules-2.17.1/tuntap.c	Mon Apr 28 20:35:31 2003
-@@ -14,13 +14,13 @@
- // This abstraction layer is an attempt to create a common API set
- // that works on all platforms with (hopefully) equal results.
- 
--#if !defined(__APPLE__) 
-+#if !defined(__APPLE__) && !defined(__FreeBSD__)
- #include "hercules.h"
- #include "tuntap.h"
- #include "devtype.h"
- #include "ctcadpt.h"
- #include "hercifc.h"
- 
- #if defined( WIN32 )
- #include "w32ctca.h"
- #endif
-@@ -609,4 +610,4 @@
- }
- 
- #endif // !defined( WIN32 )
--#endif /* !defined(__APPLE__) */
-+#endif /* !defined(__APPLE__) && !defined(__FreeBSD__) */
Index: files/patch-configure
===================================================================
RCS file: files/patch-configure
diff -N files/patch-configure
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-configure	25 Jan 2006 20:29:06 -0000
@@ -0,0 +1,257 @@
+--- config.h.in.orig	Thu Dec 29 03:37:47 2005
++++ config.h.in	Wed Jan 25 20:05:14 2006
+@@ -433,6 +433,9 @@
+    */
+ #undef HAVE_SYS_NDIR_H
+ 
++/* Define to 1 if you have the <sys/param.h> header file. */
++#undef HAVE_SYS_PARAM_H
++
+ /* Define to 1 if you have the <sys/resource.h> header file. */
+ #undef HAVE_SYS_RESOURCE_H
+ 
+--- configure.orig	Wed Jan 25 20:04:35 2006
++++ configure	Wed Jan 25 20:05:14 2006
+@@ -24562,6 +24562,14 @@ case "$host_os" in
+         hc_cv_is_apple=no
+         ;;
+ 
++    freebsd*)
++
++        hc_cv_is_nix=yes
++        hc_cv_is_windows=no
++        hc_cv_is_mingw32=no
++        hc_cv_is_apple=no
++        ;;
++
+     mingw*)
+ 
+         hc_cv_is_nix=no
+@@ -27941,6 +27949,158 @@ fi
+ done
+ 
+ 
++for ac_header in sys/param.h
++do
++as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
++if eval "test \"\${$as_ac_Header+set}\" = set"; then
++  echo "$as_me:$LINENO: checking for $ac_header" >&5
++echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
++if eval "test \"\${$as_ac_Header+set}\" = set"; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
++fi
++echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
++echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
++else
++  # Is the header compilable?
++echo "$as_me:$LINENO: checking $ac_header usability" >&5
++echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
++cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h.  */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h.  */
++$ac_includes_default
++#include <$ac_header>
++_ACEOF
++rm -f conftest.$ac_objext
++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
++  (eval $ac_compile) 2>conftest.er1
++  ac_status=$?
++  grep -v '^ *+' conftest.er1 >conftest.err
++  rm -f conftest.er1
++  cat conftest.err >&5
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); } &&
++	 { ac_try='test -z "$ac_c_werror_flag"
++			 || test ! -s conftest.err'
++  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++  (eval $ac_try) 2>&5
++  ac_status=$?
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }; } &&
++	 { ac_try='test -s conftest.$ac_objext'
++  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++  (eval $ac_try) 2>&5
++  ac_status=$?
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }; }; then
++  ac_header_compiler=yes
++else
++  echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++ac_header_compiler=no
++fi
++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
++echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
++echo "${ECHO_T}$ac_header_compiler" >&6
++
++# Is the header present?
++echo "$as_me:$LINENO: checking $ac_header presence" >&5
++echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
++cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h.  */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h.  */
++#include <$ac_header>
++_ACEOF
++if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
++  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
++  ac_status=$?
++  grep -v '^ *+' conftest.er1 >conftest.err
++  rm -f conftest.er1
++  cat conftest.err >&5
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); } >/dev/null; then
++  if test -s conftest.err; then
++    ac_cpp_err=$ac_c_preproc_warn_flag
++    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
++  else
++    ac_cpp_err=
++  fi
++else
++  ac_cpp_err=yes
++fi
++if test -z "$ac_cpp_err"; then
++  ac_header_preproc=yes
++else
++  echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++  ac_header_preproc=no
++fi
++rm -f conftest.err conftest.$ac_ext
++echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
++echo "${ECHO_T}$ac_header_preproc" >&6
++
++# So?  What about this header?
++case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
++  yes:no: )
++    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
++echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
++    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
++echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
++    ac_header_preproc=yes
++    ;;
++  no:yes:* )
++    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
++echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
++    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
++echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
++    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
++echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
++    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
++echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
++    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
++echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
++    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
++echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
++    (
++      cat <<\_ASBOX
++## ------------------------------------------ ##
++## Report this to the AC_PACKAGE_NAME lists.  ##
++## ------------------------------------------ ##
++_ASBOX
++    ) |
++      sed "s/^/$as_me: WARNING:     /" >&2
++    ;;
++esac
++echo "$as_me:$LINENO: checking for $ac_header" >&5
++echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
++if eval "test \"\${$as_ac_Header+set}\" = set"; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
++else
++  eval "$as_ac_Header=\$ac_header_preproc"
++fi
++echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
++echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
++
++fi
++if test `eval echo '${'$as_ac_Header'}'` = yes; then
++  cat >>confdefs.h <<_ACEOF
++#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
++_ACEOF
++ hc_cv_have_sys_param_h=yes
++else
++  hc_cv_have_sys_param_h=no
++fi
++
++done
++
++
+ for ac_header in sys/mount.h
+ do
+ as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+@@ -27963,6 +28123,11 @@ cat confdefs.h >>conftest.$ac_ext
+ cat >>conftest.$ac_ext <<_ACEOF
+ /* end confdefs.h.  */
+ $ac_includes_default
++
++   #if HAVE_SYS_PARAM_H
++   #include <sys/param.h>
++   #endif
++
+ #include <$ac_header>
+ _ACEOF
+ rm -f conftest.$ac_objext
+--- configure.ac.orig	Thu Dec 29 19:47:06 2005
++++ configure.ac	Wed Jan 25 20:05:14 2006
+@@ -280,6 +280,14 @@ case "$host_os" in
+         hc_cv_is_apple=no
+         ;;
+ 
++    freebsd*)
++
++        hc_cv_is_nix=yes
++        hc_cv_is_windows=no
++        hc_cv_is_mingw32=no
++        hc_cv_is_apple=no
++        ;;
++
+     mingw*)
+ 
+         hc_cv_is_nix=no
+@@ -450,13 +458,24 @@ AC_CHECK_HEADERS( net/route.h,    [hc_cv
+     #include <sys/socket.h>
+     #endif
+ ] )
++
++#------------------------------------------------------------------------------
++#  PROGRAMMING NOTE: on FreeBSD sys/param.h must be included before
++#  sys/mount.h.
++AC_CHECK_HEADERS( sys/param.h,    [hc_cv_have_sys_param_h=yes],    [hc_cv_have_sys_param_h=no]    )
++AC_CHECK_HEADERS( sys/mount.h,    [hc_cv_have_sys_mount_h=yes],    [hc_cv_have_sys_mount_h=no],
++[
++   #if HAVE_SYS_PARAM_H
++   #include <sys/param.h>
++   #endif
++] )
++
+ #------------------------------------------------------------------------------
+ 
+ AC_CHECK_HEADERS( arpa/inet.h,    [hc_cv_have_arpa_inet_h=yes],    [hc_cv_have_arpa_inet_h=no]    )
+ AC_CHECK_HEADERS( linux/if_tun.h, [hc_cv_have_linux_if_tun_h=yes], [hc_cv_have_linux_if_tun_h=no] )
+ AC_CHECK_HEADERS( sys/ioctl.h,    [hc_cv_have_sys_ioctl_h=yes],    [hc_cv_have_sys_ioctl_h=no]    )
+ AC_CHECK_HEADERS( sys/mman.h,     [hc_cv_have_sys_mman_h=yes],     [hc_cv_have_sys_mman_h=no]     )
+-AC_CHECK_HEADERS( sys/mount.h,    [hc_cv_have_sys_mount_h=yes],    [hc_cv_have_sys_mount_h=no]    )
+ AC_CHECK_HEADERS( sys/mtio.h,     [hc_cv_have_sys_mtio_h=yes],     [hc_cv_have_sys_mtio_h=no]     )
+ AC_CHECK_HEADERS( sys/resource.h, [hc_cv_have_sys_resource_h=yes], [hc_cv_have_sys_resource_h=no] )
+ AC_CHECK_HEADERS( sys/uio.h,      [hc_cv_have_sys_uio_h=yes],      [hc_cv_have_sys_uio_h=no]      )
+--- hstdinc.h.orig	Wed Dec  7 13:42:19 2005
++++ hstdinc.h	Wed Jan 25 20:05:14 2006
+@@ -102,6 +102,11 @@
+ #ifdef HAVE_SYS_MMAN_H
+   #include <sys/mman.h>
+ #endif
++/* PROGRAMMING NOTE: On FreeBSD, <sys/param.h> must be included before
++   <sys/mount.h> */
++#ifdef HAVE_SYS_PARAM_H
++  #include <sys/param.h>
++#endif
+ #ifdef HAVE_SYS_MOUNT_H
+   #include <sys/mount.h>
+ #endif
Index: files/patch-fbdcompile
===================================================================
RCS file: files/patch-fbdcompile
diff -N files/patch-fbdcompile
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-fbdcompile	25 Jan 2006 20:29:06 -0000
@@ -0,0 +1,36 @@
+! Found by: jemalloc
+--- fillfnam.c.orig	Sat Dec  3 13:49:43 2005
++++ fillfnam.c	Wed Jan 25 20:05:14 2006
+@@ -4,7 +4,7 @@
+ 
+ char *filterarray;
+ 
+-int filter(const struct dirent *ent) {
++int filter(struct dirent *ent) {
+   if (filterarray == NULL)
+     return(1);
+   if (strncmp(ent->d_name, filterarray, strlen(filterarray)) == 0)
+@@ -50,7 +50,11 @@ int tab_pressed(char *cmdlinefull, int *
+   strncpy(part2, cmdlinefull + i + 1, cmdoff - i - 1);
+   part2[cmdoff - i - 1] = '\0';
+ 
+-  path = (char*)malloc(strlen(part2) + 1);
++  len = strlen(part2);
++  /* We need at least 2+1 characters for ./\0 in else path. */
++  if (len < 2)
++    len = 2;
++  path = (char*)malloc(len + 1);
+   filename = part2;
+   /* is it pure filename or is there whole path ? */
+   tmp = strrchr(part2, '/');
+--- hercifc.h.orig	Thu Dec  1 17:37:25 2005
++++ hercifc.h	Wed Jan 25 20:05:14 2006
+@@ -88,7 +88,7 @@ typedef struct _CTLREQ
+   union
+   {
+     struct ifreq     ifreq;
+-#if !defined(__APPLE__)
++#if !defined(__APPLE__) && !defined(__FreeBSD__)
+     struct rtentry   rtentry;
+ #endif
+   }
Index: files/patch-feature.h
===================================================================
RCS file: files/patch-feature.h
diff -N files/patch-feature.h
--- files/patch-feature.h	10 Oct 2002 19:36:41 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
---- feature.h.orig	Mon Sep  2 11:36:09 2002
-+++ feature.h	Mon Sep  2 11:36:55 2002
-@@ -479,4 +479,9 @@
-  #define XSTORE_PAGEMASK	0x7FFFF000
- #endif
- 
-+#if defined(__FreeBSD__)
-+ #define HAVE_MTIO_H
-+#else
-+ #define GNU_MTIO_SUPPORT
-+#endif
- /* end of FEATURES.H */
Index: files/patch-hc-hack
===================================================================
RCS file: files/patch-hc-hack
diff -N files/patch-hc-hack
--- files/patch-hc-hack	28 Apr 2003 19:43:06 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,96 +0,0 @@
-diff -ur ./Makefile.in ../../work/hercules-2.16.5/Makefile.in
---- ./Makefile.in	Mon Jul  8 14:55:57 2002
-+++ ../../work/hercules-2.16.5/Makefile.in	Mon Dec 16 17:17:45 2002
-@@ -116,7 +116,7 @@
- 	   ipl.c assist.c dat.c \
- 	   stack.c cpu.c vstore.c \
- 	   general1.c general2.c plo.c \
--	   control.c io.c \
-+	   control.c io.c hc.c \
- 	   decimal.c service.c opcode.c \
- 	   diagnose.c diagmssf.c vm.c \
- 	   channel.c ckddasd.c fbadasd.c \
-@@ -327,7 +327,7 @@
- 	version.$(OBJEXT) ipl.$(OBJEXT) assist.$(OBJEXT) dat.$(OBJEXT) \
- 	stack.$(OBJEXT) cpu.$(OBJEXT) vstore.$(OBJEXT) \
- 	general1.$(OBJEXT) general2.$(OBJEXT) plo.$(OBJEXT) \
--	control.$(OBJEXT) io.$(OBJEXT) decimal.$(OBJEXT) \
-+	control.$(OBJEXT) io.$(OBJEXT) hc.$(OBJEXT) decimal.$(OBJEXT) \
- 	service.$(OBJEXT) opcode.$(OBJEXT) diagnose.$(OBJEXT) \
- 	diagmssf.$(OBJEXT) vm.$(OBJEXT) channel.$(OBJEXT) \
- 	ckddasd.$(OBJEXT) fbadasd.$(OBJEXT) tapedev.$(OBJEXT) \
-@@ -402,6 +402,7 @@
- @AMDEP_TRUE@	./$(DEPDIR)/ckddasd.Po ./$(DEPDIR)/cmpsc.Po \
- @AMDEP_TRUE@	./$(DEPDIR)/codepage.Po ./$(DEPDIR)/config.Po \
- @AMDEP_TRUE@	./$(DEPDIR)/console.Po ./$(DEPDIR)/control.Po \
-+@AMDEP_TRUE@	./$(DEPDIR)/hc.Po \
- @AMDEP_TRUE@	./$(DEPDIR)/cpu.Po ./$(DEPDIR)/ctc_ctci.Po \
- @AMDEP_TRUE@	./$(DEPDIR)/ctc_lcs.Po ./$(DEPDIR)/ctcadpt.Po \
- @AMDEP_TRUE@	./$(DEPDIR)/dasdcat.Po ./$(DEPDIR)/dasdcopy.Po \
-@@ -608,6 +609,7 @@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/config.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/console.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/control.Po@am__quote@
-+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hc.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctcadpt.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dasdcat.Po@am__quote@
-diff -ur ./configure.ac ../../work/hercules-2.16.5/configure.ac
---- ./configure.ac	Mon Jul  8 14:55:42 2002
-+++ ../../work/hercules-2.16.5/configure.ac	Mon Dec 16 17:17:45 2002
-@@ -153,6 +153,16 @@
-                                [AC_DEFINE([HAVE_U_INT])],
-                                [AC_MSG_ERROR([Unable to find fixed-size data types])] )] )
- 
-+dnl AC_MSG_NOTICE([Checking for SCSI tape support and what type])
-+AC_CHECK_HEADER(sys/mtio.h,
-+		[AC_DEFINE([HAVE_MTIO_H])])
-+
-+AC_TRY_COMPILE([#include mtio.h],
-+		[mtget test;
-+		 int result;
-+		 result = test.mt_gstat; ],
-+		[AC_DEFINE([GNU_MTIO_SUPPORT])])
-+
- # Compiler characteristics
- 
- AC_C_BIGENDIAN
-@@ -375,5 +385,9 @@
-             [Define to debug correct fthreads LOCK handling (requires fthreads)])
- AH_TEMPLATE([PKGDATADIR],
-             [Directory where the HTTP server will find documents])
-+AH_TEMPLATE([HAVE_MTIO_H],
-+	    Define if your system has sys/mtio.h])
-+AH_TEMPLATE([GNU_MTIO_SUPPORT],
-+	    [Define if you have the GNU version of mtio.h (Linux)])
- 
- AC_OUTPUT(Makefile util/Makefile html/Makefile)
-diff -ur ./opcode.c ../../work/hercules-2.16.5/opcode.c
---- ./opcode.c	Wed Jul  3 04:04:41 2002
-+++ ../../work/hercules-2.16.5/opcode.c	Mon Dec 16 17:17:45 2002
-@@ -1276,8 +1276,8 @@
-  /*0100*/ GENx___x___x___ ,
-  /*0101*/ GENx___x390x900 (program_return,E,"PR"),
-  /*0102*/ GENx___x390x900 (update_tree,E,"UPT"),
-- /*0103*/ GENx___x___x___ ,
-- /*0104*/ GENx___x___x___ ,
-+ /*0103*/ GENx370x390x900 (hconsole_get_char,E,"HCGC"),
-+ /*0104*/ GENx370x390x900 (hconsole_put_char,E,"HCPC"),
-  /*0105*/ GENx___x___x___ ,                                     /* CMSG      */
-  /*0106*/ GENx___x___x___ ,                                     /* TMSG      */
-  /*0107*/ GENx___x390x900 (set_clock_programmable_field,E,"SCKPF"),
-diff -ur ./opcode.h ../../work/hercules-2.16.5/opcode.h
---- ./opcode.h	Mon Mar 11 18:40:40 2002
-+++ ../../work/hercules-2.16.5/opcode.h	Mon Dec 16 17:17:45 2002
-@@ -1599,6 +1599,11 @@
- DEF_INST(dummy_instruction);
- 
- 
-+/* Instructions in hc.c */
-+DEF_INST(hconsole_get_char);
-+DEF_INST(hconsole_put_char);
-+
-+
- /* Instructions in assist.c */
- DEF_INST(svc_assist);
- DEF_INST(obtain_local_lock);
Index: files/patch-hc.c
===================================================================
RCS file: files/patch-hc.c
diff -N files/patch-hc.c
--- files/patch-hc.c	17 Dec 2002 09:20:34 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,54 +0,0 @@
---- /dev/null	Mon Dec 16 17:18:27 2002
-+++ hc.c	Mon Dec 16 17:21:15 2002
-@@ -0,0 +1,51 @@
-+#include "hercules.h"
-+
-+#include "opcode.h"
-+
-+#include "inline.h"
-+
-+static int hcd;
-+
-+DEF_INST(hconsole_get_char)
-+{
-+	char ch;
-+
-+	E(inst, execflag, regs);
-+
-+	if (hcd == 0)
-+		hcd = open("/home/tzukanov/hercules/hc",
-+			   O_RDWR | O_NONBLOCK | O_CREAT, 0);
-+	if (read(hcd, &ch, 1) == 1)
-+		regs->GR_LHLCL(1) = ch;
-+	else
-+		regs->GR_L(1) = -1;
-+}
-+
-+DEF_INST(hconsole_put_char)
-+{
-+	char ch;
-+
-+	E(inst, execflag, regs);
-+
-+
-+	if (hcd == 0)
-+		hcd = open("/home/tzukanov/hercules/hc",
-+			   O_RDWR | O_NONBLOCK | O_CREAT, 0);
-+	ch = regs->GR_LHLCL(1);
-+	write(hcd, &ch, 1);
-+}
-+
-+#if !defined(_GEN_ARCH)
-+
-+#if defined(_ARCHMODE2)
-+ #define  _GEN_ARCH _ARCHMODE2
-+ #include "hc.c"
-+#endif 
-+
-+#if defined(_ARCHMODE3)
-+ #undef   _GEN_ARCH
-+ #define  _GEN_ARCH _ARCHMODE3
-+ #include "hc.c"
-+#endif 
-+
-+#endif /*!defined(_GEN_ARCH)*/
Index: files/patch-herconf
===================================================================
RCS file: files/patch-herconf
diff -N files/patch-herconf
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-herconf	25 Jan 2006 20:29:06 -0000
@@ -0,0 +1,36 @@
+--- hostopts.h.orig	Wed Nov 30 23:46:13 2005
++++ hostopts.h	Wed Jan 25 20:05:14 2006
+@@ -199,6 +199,33 @@
+ #define HOW_TO_IMPLEMENT_SH_COMMAND       USE_ANSI_SYSTEM_API_FOR_SH_COMMAND
+ #define SET_CONSOLE_CURSOR_SHAPE_METHOD   CURSOR_SHAPE_NOT_SUPPORTED
+ 
++
++/*-------------------------------------------------------------------*/
++/* Hard-coded FreeBSD-specific features and options...               */
++/*-------------------------------------------------------------------*/
++#elif defined(__FreeBSD__)              /* "FreeBSD" options         */
++
++#define DLL_IMPORT   extern
++#define DLL_EXPORT
++
++#undef  OPTION_SCSI_ERASE_TAPE          /* (NOT supported)           */
++#undef  OPTION_SCSI_ERASE_GAP           /* (NOT supported)           */
++
++#undef  OPTION_TUNTAP_SETMACADDR        /* TUNTAP_SetMACAddr broken  */
++#undef  OPTION_TUNTAP_DELADD_ROUTES     /* Del/Add Routes    broken  */
++
++#define MAX_DEVICE_THREADS          0   /* (0 == unlimited)          */
++#define MIXEDCASE_FILENAMES_ARE_UNIQUE  /* ("Foo" and "fOo" unique)  */
++
++#define DEFAULT_HERCPRIO    0
++#define DEFAULT_TOD_PRIO  -20
++#define DEFAULT_CPU_PRIO   15
++#define DEFAULT_DEV_PRIO    8
++
++#define HOW_TO_IMPLEMENT_SH_COMMAND       USE_ANSI_SYSTEM_API_FOR_SH_COMMAND
++#define SET_CONSOLE_CURSOR_SHAPE_METHOD   CURSOR_SHAPE_NOT_SUPPORTED
++
++
+ /*-------------------------------------------------------------------*/
+ /* Hard-coded OTHER host-specific features and options...            */
+ /*-------------------------------------------------------------------*/
Index: files/patch-hercules.h
===================================================================
RCS file: files/patch-hercules.h
diff -N files/patch-hercules.h
--- files/patch-hercules.h	10 Oct 2002 19:36:41 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
---- hercules.h.orig	Mon Sep  2 11:43:46 2002
-+++ hercules.h	Mon Sep  2 11:44:56 2002
-@@ -333,6 +333,9 @@
-         BYTE *iobuf, BYTE *more, BYTE *unitstat, U16 *residual);
- typedef int DEVCF (struct _DEVBLK *dev);
- 
-+#if defined(HAVE_MTIO_H)
-+ #include <sys/mtio.h>
-+#endif
- 
- /*-------------------------------------------------------------------*/
- /* Structure definition for the Vector Facility                      */
Index: files/patch-tapecopy.c
===================================================================
RCS file: files/patch-tapecopy.c
diff -N files/patch-tapecopy.c
--- files/patch-tapecopy.c	28 Apr 2003 19:43:06 -0000	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,63 +0,0 @@
---- tapecopy.c	Sat Feb  1 20:34:57 2003
-+++ ../work/hercules-2.17.1/tapecopy.c	Mon Apr 28 21:21:15 2003
-@@ -42,6 +42,7 @@
- static BYTE hdrlbl[] = "\xC8\xC4\xD9";  /* EBCDIC characters "HDR"   */
- static BYTE eoflbl[] = "\xC5\xD6\xC6";  /* EBCDIC characters "EOF"   */
- static BYTE eovlbl[] = "\xC5\xD6\xE5";  /* EBCDIC characters "EOV"   */
-+#ifdef GNU_MTIO_SUPPORT
- static struct mt_tape_info tapeinfo[] = MT_TAPE_INFO;
- static struct mt_tape_info densinfo[] = {
-     {0x01, "NRZI (800 bpi)"},
-@@ -69,6 +70,7 @@
-     {0x8C, "EXB-8505 compressed"},
-     {0x90, "EXB-8205 compressed"},
-     {0, NULL}};
-+#endif
- static BYTE buf[65500];
- 
- /*-------------------------------------------------------------------*/
-@@ -76,6 +78,7 @@
- /*-------------------------------------------------------------------*/
- static void print_status (BYTE *devname, long stat)
- {
-+#ifdef GNU_MTIO_SUPPORT
-     printf ("HHCTC015I %s status: %8.8lX", devname, stat);
-     if (GMT_EOF(stat)) printf (" EOF");
-     if (GMT_BOT(stat)) printf (" BOT");
-@@ -89,6 +92,7 @@
-     if (GMT_D_800(stat)) printf (" 800");
-     if (GMT_DR_OPEN(stat)) printf (" NOTAPE");
-     printf ("\n");
-+#endif
- 
- } /* end function print_status */
- 
-@@ -109,10 +113,12 @@
-         return -1;
-     }
- 
-+#ifdef GNU_MTIO_SUPPORT
-     print_status (devname, stblk.mt_gstat);
- 
-     if (GMT_EOD(stblk.mt_gstat)) return 1;
-     if (GMT_EOT(stblk.mt_gstat)) return 1;
-+#endif
- 
-     return 0;
- } /* end function print_status */
-@@ -205,6 +211,7 @@
-         exit (7);
-     }
- 
-+#ifdef GNU_MTIO_SUPPORT
-     /* Display tape status information */
-     for (i = 0; tapeinfo[i].t_type != 0
-                 && tapeinfo[i].t_type != stblk.mt_type; i++);
-@@ -233,6 +240,7 @@
- 
-     /* Set the tape device to process variable length blocks */
-     opblk.mt_op = MTSETBLK;
-+#endif
-     opblk.mt_count = 0;
-     rc = ioctl (devfd, MTIOCTOP, (char*)&opblk);
-     if (rc < 0)
Index: files/patch-tapedev.c
===================================================================
RCS file: files/patch-tapedev.c
diff -N files/patch-tapedev.c
--- files/patch-tapedev.c	10 Oct 2002 19:36:41 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,275 +0,0 @@
---- tapedev.c.orig	Wed Jul  3 13:21:52 2002
-+++ tapedev.c	Mon Sep  2 11:43:24 2002
-@@ -195,6 +195,7 @@
- /*-------------------------------------------------------------------*/
- /* Static data areas                                                 */
- /*-------------------------------------------------------------------*/
-+#ifdef GNU_MTIO_SUPPORT
- static struct mt_tape_info tapeinfo[] = MT_TAPE_INFO;
- static struct mt_tape_info densinfo[] = {
-     {0x01, "NRZI (800 bpi)"},
-@@ -222,6 +223,7 @@
-     {0x8C, "EXB-8505 compressed"},
-     {0x90, "EXB-8205 compressed"},
-     {0, NULL}};
-+#endif
- 
- static PARSER ptab[] =
- {
-@@ -1143,6 +1145,7 @@
- /*-------------------------------------------------------------------*/
- static U32 status_scsitape (DEVBLK *dev)
- {
-+#ifdef HAVE_MTIO_H
- U32             stat;                   /* Tape status bits          */
- int             rc;                     /* Return code               */
- struct mtget    stblk;                  /* Area for MTIOCGET ioctl   */
-@@ -1159,6 +1162,7 @@
-                 dev->filename, strerror(errno));
-         return 0;
-     }
-+#ifdef GNU_MTIO_SUPPORT
-     stat = stblk.mt_gstat;
- 
-     /* Display tape status */
-@@ -1191,10 +1195,14 @@
-         dev->prvblkpos = -1;
-         dev->blockid = 0;
-     }
-+#else
-+	 stat = 0;
-+#endif
- 
-     /* Return tape status */
-     return stat;
- 
-+#endif
- } /* end function status_scsitape */
- 
- /*-------------------------------------------------------------------*/
-@@ -1205,6 +1213,7 @@
- /*-------------------------------------------------------------------*/
- static int open_scsitape (DEVBLK *dev, BYTE *unitstat)
- {
-+#ifdef HAVE_MTIO_H
- int             rc;                     /* Return code               */
- int             i;                      /* Array subscript           */
- struct mtop     opblk;                  /* Area for MTIOCTOP ioctl   */
-@@ -1249,6 +1258,7 @@
-         return -1;
-     }
- 
-+#ifdef GNU_MTIO_SUPPORT
-     /* Intervention required if no tape is mounted */
-     if (GMT_DR_OPEN(stblk.mt_gstat))
-     {
-@@ -1284,6 +1294,7 @@
- 
-     /* Set the tape device to process variable length blocks */
-     opblk.mt_op = MTSETBLK;
-+#endif
-     opblk.mt_count = 0;
-     rc = ioctl (dev->fd, MTIOCTOP, (char*)&opblk);
-     if (rc < 0)
-@@ -1312,6 +1323,12 @@
- 
-     return 0;
- 
-+#else
-+
-+	 logmsg ("HHC286I SCSI Support is disabled\n");
-+	 return -1
-+
-+#endif
- } /* end function open_scsitape */
- 
- /*-------------------------------------------------------------------*/
-@@ -1324,6 +1341,7 @@
- /*-------------------------------------------------------------------*/
- static int read_scsitape (DEVBLK *dev, BYTE *buf, BYTE *unitstat)
- {
-+#ifdef HAVE_MTIO_H
- int             rc;                     /* Return code               */
- 
-     /* Read data block from SCSI tape device */
-@@ -1347,6 +1365,12 @@
-     /* Return block length or zero if tapemark  */
-     return rc;
- 
-+#else
-+
-+	 logmsg ("HHC286I SCSI Support is disabled\n");
-+	 return -1;
-+
-+#endif
- } /* end function read_scsitape */
- 
- /*-------------------------------------------------------------------*/
-@@ -1358,6 +1382,7 @@
- static int write_scsitape (DEVBLK *dev, BYTE *buf, U16 len,
-                         BYTE *unitstat)
- {
-+#ifdef HAVE_MTIO_H
- int             rc;                     /* Return code               */
- 
-     /* Write data block to SCSI tape device */
-@@ -1377,6 +1402,12 @@
-     /* Return normal status */
-     return 0;
- 
-+#else
-+
-+	 logmsg ("HHC286I SCSI Support is disabled\n");
-+	 return -1;
-+
-+#endif
- } /* end function write_scsitape */
- 
- /*-------------------------------------------------------------------*/
-@@ -1387,6 +1418,7 @@
- /*-------------------------------------------------------------------*/
- static int write_scsimark (DEVBLK *dev, BYTE *unitstat)
- {
-+#ifdef HAVE_MTIO_H
- int             rc;                     /* Return code               */
- struct mtop     opblk;                  /* Area for MTIOCTOP ioctl   */
- 
-@@ -1409,6 +1441,12 @@
-     /* Return normal status */
-     return 0;
- 
-+#else
-+
-+	 logmsg ("HHC286I SCSI Support is disabled\n");
-+	 return -1;
-+
-+#endif
- } /* end function write_scsimark */
- 
- /*-------------------------------------------------------------------*/
-@@ -1421,6 +1459,7 @@
- /*-------------------------------------------------------------------*/
- static int fsb_scsitape (DEVBLK *dev, BYTE *unitstat)
- {
-+#ifdef HAVE_MTIO_H
- int             rc;                     /* Return code               */
- int             fsrerrno;               /* Value of errno after MTFSR*/
- U32             stat;                   /* Tape status bits          */
-@@ -1435,6 +1474,7 @@
-     /* Obtain tape status after forward space */
-     stat = status_scsitape (dev);
- 
-+#ifdef GNU_MTIO_SUPPORT
-     /* If I/O error and status indicates EOF, then a tapemark
-        was detected, so increment the file number and return 0 */
-     if (rc < 0 && fsrerrno == EIO && GMT_EOF(stat))
-@@ -1443,6 +1483,7 @@
-         dev->blockid++;
-         return 0;
-     }
-+#endif
- 
-     /* Handle MTFSR error condition */
-     if (rc < 0)
-@@ -1461,6 +1502,12 @@
-     /* Return +1 to indicate forward space successful */
-     return +1;
- 
-+#else
-+
-+	 logmsg ("HHC286I SCSI Support is disabled\n");
-+	 return -1;
-+
-+#endif
- } /* end function fsb_scsitape */
- 
- /*-------------------------------------------------------------------*/
-@@ -1473,6 +1520,7 @@
- /*-------------------------------------------------------------------*/
- static int bsb_scsitape (DEVBLK *dev, BYTE *unitstat)
- {
-+#ifdef HAVE_MTIO_H
- int             rc;                     /* Return code               */
- int             bsrerrno;               /* Value of errno after MTBSR*/
- U32             stat;                   /* Tape status bits          */
-@@ -1481,6 +1529,7 @@
-     /* Obtain tape status before backward space */
-     stat = status_scsitape (dev);
- 
-+#ifdef GNU_MTIO_SUPPORT
-     /* Unit check if already at start of tape */
-     if (GMT_BOT(stat))
-     {
-@@ -1489,6 +1538,7 @@
-         *unitstat = CSW_CE | CSW_DE | CSW_UC;
-         return -1;
-     }
-+#endif
- 
-     /* Backspace block on SCSI tape */
-     opblk.mt_op = MTBSR;
-@@ -1527,6 +1577,12 @@
-     /* Return +1 to indicate backspace successful */
-     return +1;
- 
-+#else
-+
-+	 logmsg ("HHC286I SCSI Support is disabled\n");
-+	 return -1;
-+
-+#endif
- } /* end function bsb_scsitape */
- 
- /*-------------------------------------------------------------------*/
-@@ -1538,6 +1594,7 @@
- /*-------------------------------------------------------------------*/
- static int fsf_scsitape (DEVBLK *dev, BYTE *unitstat)
- {
-+#ifdef HAVE_MTIO_H
- int             rc;                     /* Return code               */
- struct mtop     opblk;                  /* Area for MTIOCTOP ioctl   */
- 
-@@ -1563,6 +1620,12 @@
-     /* Return normal status */
-     return 0;
- 
-+#else
-+
-+	 logmsg ("HHC286I SCSI Support is disabled\n");
-+	 return -1;
-+
-+#endif
- } /* end function fsf_scsitape */
- 
- /*-------------------------------------------------------------------*/
-@@ -1574,6 +1637,7 @@
- /*-------------------------------------------------------------------*/
- static int bsf_scsitape (DEVBLK *dev, BYTE *unitstat)
- {
-+#ifdef HAVE_MTIO_H
- int             rc;                     /* Return code               */
- struct mtop     opblk;                  /* Area for MTIOCTOP ioctl   */
- 
-@@ -1600,6 +1664,12 @@
-     /* Return normal status */
-     return 0;
- 
-+#else
-+
-+	 logmsg("HHC286I SCSI Support is disabled\n");
-+	 return -1;
-+
-+#endif
- } /* end function bsf_scsitape */
- 
- /*-------------------------------------------------------------------*/
-@@ -2726,7 +2796,9 @@
- 
-         case TAPEDEVT_SCSITAPE:
-             stat = status_scsitape (dev);
-+#ifdef GNU_MTIO_SUPPORT
-             if (GMT_BOT(stat)) dev->sense[1] |= SENSE1_TAPE_LOADPT;
-+#endif
-             break;
- 
-         case TAPEDEVT_OMATAPE:
Index: files/patch-tuntap
===================================================================
RCS file: files/patch-tuntap
diff -N files/patch-tuntap
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-tuntap	25 Jan 2006 20:29:06 -0000
@@ -0,0 +1,62 @@
+--- ctc_ctci.c.orig	Wed Dec 14 17:17:22 2005
++++ ctc_ctci.c	Wed Jan 25 20:05:14 2006
+@@ -1114,7 +1114,7 @@ static int  ParseArgs( DEVBLK* pDEVBLK, 
+ #if defined( WIN32 )
+     strcpy( pCTCBLK->szTUNCharName,  tt32_get_default_iface() );
+ #else
+-    strcpy( pCTCBLK->szTUNCharName,  "/dev/net/tun" );
++    strcpy( pCTCBLK->szTUNCharName,  HERCTUN_DEV );
+ #endif
+ 
+ #if defined( WIN32 )
+--- ctc_lcs.c.orig	Thu Dec 29 19:47:06 2005
++++ ctc_lcs.c	Wed Jan 25 20:05:14 2006
+@@ -1024,7 +1024,9 @@ static void  LCS_Shutdown( PLCSDEV pLCSD
+ static void  LCS_StartLan( PLCSDEV pLCSDEV, PLCSHDR pHeader )
+ {
+     PLCSPORT    pPort;
++#ifdef OPTION_TUNTAP_DELADD_ROUTES
+     PLCSRTE     pRoute;
++#endif
+     PLCSSTDFRM  pReply;
+ 
+     pPort = &pLCSDEV->pLCSBLK->Port[pLCSDEV->bPort];
+--- hercifc.h.orig	Thu Dec  1 17:37:25 2005
++++ hercifc.h	Wed Jan 25 20:05:14 2006
+@@ -77,7 +77,7 @@
+ // --------------------------------------------------------------------
+ 
+ #define  HERCIFC_CMD  "hercifc"           // Interface config command
+-#define  HERCTUN_DEV  "/dev/net/tun"      // Default TUN/TAP char dev
++#define  HERCTUN_DEV  "/dev/tun"          // Default TUN/TAP char dev
+ 
+ typedef struct _CTLREQ
+ {
+--- tuntap.c.orig	Sun Dec 11 16:44:16 2005
++++ tuntap.c	Wed Jan 25 20:05:14 2006
+@@ -159,6 +159,25 @@ int             TUNTAP_CreateInterface( 
+         strcpy( pszNetDevName, ifr.ifr_name );
+     }
+ #if !defined( OPTION_W32_CTCI )
++    else if ( strncasecmp( utsbuf.sysname, "FreeBSD",  7 ) == 0 )
++    {
++        struct stat sb;
++
++        if ( ( iFlags & IFF_TAP ) == IFF_TAP )
++        {
++            logmsg( _("HHCTU011E TAP device not yet supported\n") );
++            return -1;
++        }
++
++        if ( fstat(fd, &sb) == 0 )
++                devname_r(sb.st_rdev, S_IFCHR, pszNetDevName, IFNAMSIZ);
++        else
++        {
++            logmsg( _("HHCTU010E Error getting TUN/TAP device name: %s\n"),
++                    strerror( errno ) );
++            return -1;
++        }
++    }
+     else
+     {
+         // Other OS: Simply use basename of the device
Index: files/patch-version.c
===================================================================
RCS file: files/patch-version.c
diff -N files/patch-version.c
--- files/patch-version.c	10 Oct 2002 19:36:41 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,17 +0,0 @@
---- version.c.orig	Mon Sep  2 11:15:53 2002
-+++ version.c	Mon Sep  2 11:17:51 2002
-@@ -106,6 +106,14 @@
-     "No HET BZIP2 support",
- #endif
- 
-+#if defined(GNU_MTIO_SUPPORT)
-+	 "Using GNU tape handling",
-+#elif defined(HAVE_MTIO_H)
-+	 "Using generic Unix tape handling",
-+#else
-+	 "No SCSI tape support",
-+#endif
-+
-   " "
- 
- };
Comment 5 Bjoern A. Zeeb freebsd_committer freebsd_triage 2006-01-25 22:16:34 UTC
Responsible Changed
From-To: bz->freebsd-ports-bugs

I am not a ports committer. Could someone please pick it up 
and check if it's ok and commit. If you have any questions 
please come back to me.
Comment 6 Erwin Lansing freebsd_committer freebsd_triage 2006-02-04 21:00:49 UTC
Responsible Changed
From-To: freebsd-ports-bugs->erwin

I'll have a look.
Comment 7 Erwin Lansing freebsd_committer freebsd_triage 2006-02-04 22:19:17 UTC
State Changed
From-To: open->closed

Committed in a slightly modified version, thanks!