Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Jul 1999 22:30:23 -0500 (CDT)
From:      Chris Dillon <cdillon@wolves.k12.mo.us>
To:        Marcel Moolenaar <marcel@scc.nl>
Cc:        stable@FreeBSD.ORG
Subject:   Re: Linux emulation
Message-ID:  <Pine.BSF.4.10.9907022216050.57187-100000@mail.wolves.k12.mo.us>
In-Reply-To: <377CA267.7F64B97@scc.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 2 Jul 1999, Marcel Moolenaar wrote:

> Andrij Korud wrote:
> > 
> > Hi.
> > While trying to run PowerAlert plus for Linux on FreeBSD 3.2-STABLE box I
> > got a message:
> > "LINUX: 'ioctl' fd=0, typ=0x54(T), num=0x17 not implemented"
> > Any ideas?
> 
> Can you apply the following patch and tell me if it solves your problem
> without creating new problems? :-)
> 
> Index: linux_ioctl.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/i386/linux/linux_ioctl.c,v
> retrieving revision 1.33
> diff -r1.33 linux_ioctl.c
> 599a600,612
> >     case LINUX_TIOCMGET:
> >       args->cmd = TIOCMGET;
> >       return ioctl(p, (struct ioctl_args *)args);
> >     case LINUX_TIOCMBIS:
> >       args->cmd = TIOCMBIS;
> >       return ioctl(p, (struct ioctl_args *)args);
> >     case LINUX_TIOCMBIC:
> >       args->cmd = TIOCMBIC;
> >       return ioctl(p, (struct ioctl_args *)args);
> >     case LINUX_TIOCMSET:
> >       args->cmd = TIOCMSET;
> >       return ioctl(p, (struct ioctl_args *)args);
> > 

I just tried this patch on my server and it does the job, almost.
There is no "unsupported ioctl" error message, but the daemon can't
communicate with the UPS _unless_ I frob the port with tip(1) while
the daemon is running.  The exact moment that I tip the serial port,
the daemon comes alive and tells me UPS communications were
established and its happy.  tip(1) isn't able to actually talk to the
UPS, though it doesn't give me any errors of any kind, and I just ~.
to exit out.  This would be acceptable if I could find an automated
way of frobbing the serial port so that the daemon works.  :-)

BTW, I haven't tested to see if this breaks Linux emulation in any
other way, since that is the only thing I'm using it for on that
machine.  I may take PowerAlert home and play with it there and see if
the X client works under emulation, too.

Here are the patches I have so far to make it install and work fairly
cleanly under FreeBSD.  Yes, the patches are quite "hackey", but
that's all you're gonna get without a rewrite of all the scripts to be
more portable or just plain BSD-aware (there are only provisions for
SysV-style startup scripts).  The one bit where I changed a
"no_nl_echo" to a printf was purely cosmetic so that things looked
right on system startup.


--- pap_inst.orig	Tue Jun 29 15:27:23 1999
+++ pap_inst	Fri Jul  2 20:55:30 1999
@@ -268,6 +268,7 @@
 		echo "	7) Silicon Graphics IRIX"
 		echo "	8) Digital UNIX"
 		echo "	9) Linux"
+		echo " 10) FreeBSD/i386 [uses Linux binaries under emulation]"
 	
 
 		echo
@@ -314,6 +315,10 @@
 			break
 			;;
 
+		10)	TARGET_SYSTEM=FREEBSD_I386
+			break
+			;;
+
 		*)	echo
 			echo "Please respond with a number corresponding to the above selections"
 			echo
@@ -379,6 +384,14 @@
 	TARGET_SYSTEM=LINUX
 	;;
 
+FreeBSD)
+	case "`uname -m`" in
+	i386)
+		TARGET_SYSTEM=FREEBSD_I386
+		;;
+	esac
+	;;
+
 esac
 
  
@@ -429,6 +442,10 @@
 		echo "Your system appears to be running Linux."
 		;;
 
+	FREEBSD_I386)
+		echo "Your system appears to be running FreeBSD/i386."
+		;;
+
 	esac
 
 	echo
@@ -603,6 +620,37 @@
 
 	FILES_THAT_SHOULD_BE_REMOVED="$RC0_K_FILE $RC2_S_FILE $RC2_K_FILE $RC3_S_FILE $RC3_K_FILE $RC5_S_FILE $RC5_K_FILE $PAPLUS_CMD_DIR/pap"
 	;;
+
+FREEBSD_I386)
+
+	SYSTEM="FreeBSD/i386"
+
+	PAP_OS="FREEBSD_I386"
+
+	RC2_DIR="/usr/local/etc/rc.d"
+
+	RC2_S_FILE="$RC2_DIR/paplus.sh"
+
+	PAPLUS_CMD_DIR="/usr/local/sbin"
+
+	DEFAULT_UPS_COMM_PORT="/dev/cuaa0"
+
+	DEFAULT_INSTALLATION_DIR="/usr/local/paplus"
+
+	DEFAULT_LOGGING_DIR="/var/log/paplus"
+
+	PAPLUS_INPUT_FILE_LOWER="$CDROM_DIR/linux.pap"
+	PAPLUS_INPUT_FILE_LOWER_EXT="$CDROM_DIR/linux.pap;1"
+	PAPLUS_INPUT_FILE_UPPER="$CDROM_DIR/LINUX.PAP"
+	PAPLUS_INPUT_FILE_UPPER_EXT="$CDROM_DIR/LINUX.PAP;1"
+
+	CPIO_FLAGS="icdumB"
+
+	BROADCAST_COMMAND="/usr/bin/wall"
+
+	FILES_THAT_SHOULD_BE_REMOVED="$RC0_K_FILE $RC2_S_FILE $RC2_K_FILE $RC3_S_FILE $RC3_K_FILE $RC5_S_FILE $RC5_K_FILE $PAPLUS_CMD_DIR/pap"
+	;;
+
 
 DEC_UNIX)
 

--- pap.orig	Fri Jul  2 21:19:53 1999
+++ pap	Fri Jul  2 21:20:43 1999
@@ -59,7 +59,7 @@
 fi
 
 # Linux uses modified bsd ps command line args, but no '-' 
-if [ $TRIPPLITE_PAP_OS = LINUX ]
+if [ $TRIPPLITE_PAP_OS = LINUX -o $TRIPPLITE_PAP_OS = FREEBSD_I386 ]
 then
 	PS="ps ax "
 else
@@ -102,7 +102,7 @@
 		fi
 	done
 
-	no_nl_echo "PowerAlert Plus startup: "
+	printf "\nPowerAlert Plus startup: "
 
 	if [ -x "$PAP_HOME/bin/pap_upsd" ]
 	then


--- /usr/local/paplus/bin/pap_shutdown	Wed Mar 24 11:07:13 1999
+++ pap_shutdown	Fri Jul  2 20:51:35 1999
@@ -40,7 +40,7 @@
 		exec shutdown -g0 -y
 		;;
 
-LINUX)
+LINUX|FREEBSD_I386)
 		exec shutdown -h now
 		;;
 esac



-- Chris Dillon - cdillon@wolves.k12.mo.us - cdillon@inter-linc.net
   FreeBSD: The fastest and most stable server OS on the planet.
   For Intel x86 and Alpha architectures (SPARC under development).
   ( http://www.freebsd.org )

   "One should admire Windows users.  It takes a great deal of
    courage to trust Windows with your data."



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.9907022216050.57187-100000>