Index: Makefile =================================================================== RCS file: /home/ncvs/ports/emulators/kqemu-kmod/Makefile,v --- Makefile 28 Aug 2006 22:52:42 -0000 1.8 +++ Makefile 14 Dec 2006 19:43:44 -0000 @@ -7,7 +7,7 @@ PORTNAME= kqemu PORTVERSION= 1.3.0.p9 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= emulators MASTER_SITES= http://qemu.org/ PKGNAMESUFFIX= -kmod @@ -20,6 +20,8 @@ ONLY_FOR_ARCHS= i386 amd64 NO_PACKAGE= Depends on kernel, and module not redistributable +USE_RC_SUBR= kqemu + .include PLIST_FILES= "include/kqemu/kqemu.h" Index: files/patch-kqemu-freebsd.c =================================================================== RCS file: /home/ncvs/ports/emulators/kqemu-kmod/files/patch-kqemu-freebsd.c,v --- files/patch-kqemu-freebsd.c 9 Apr 2006 16:57:59 -0000 1.3 +++ files/patch-kqemu-freebsd.c 14 Dec 2006 19:33:37 -0000 @@ -7,3 +7,14 @@ static struct kqemu_global_state *kqemu_gs = NULL; #if __FreeBSD_version < 500000 +@@ -321,6 +321,9 @@ + #if __FreeBSD_version >= 500000 + dev->si_drv1 = NULL; + TAILQ_REMOVE(&kqemuhead, ks, kqemu_ent); ++#if __FreeBSD_version >= 700024 ++ dev_relthread(dev); ++#endif + destroy_dev(dev); + #endif + free(ks, M_KQEMU); + --- files/kqemu.in +++ files/kqemu.in @@ -0,0 +1,49 @@ +#!/bin/sh +# $FreeBSD: $ +# +# PROVIDE: kqemu +# KEYWORD: nojail +# +# Add the following line to /etc/rc.conf[.local] to enable kqemu +# +# kqemu_enable="YES" +# + +. /etc/rc.subr + +name="kqemu" +load_rc_config $name +rcvar=`set_rcvar` +start_cmd=kqemu_start +stop_cmd=kqemu_stop + +kqemu_start() +{ + # load aio if needed + if ! kldstat -qm aio; then + if kldload aio; then + info 'aio module loaded.' + else + warn 'aio module failed to load.' + return 1 + fi + fi + if ! kldstat -qm kqemu; then + if kldload kqemu; then + echo 'kqemu module loaded.' + else + warn 'kqemu module failed to load.' + return 1 + fi + fi + return 0 +} + +kqemu_stop() +{ + if kldstat -qm kqemu && kldunload kqemu; then + echo 'kqemu module unloaded.' + fi +} + +run_rc_command "$1"