From amistry@am-productions.biz  Sun Aug 13 06:06:10 2006
Return-Path: <amistry@am-productions.biz>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id C25E716A4DA;
	Sun, 13 Aug 2006 06:06:10 +0000 (UTC)
	(envelope-from amistry@am-productions.biz)
Received: from smtp2.fuse.net (mail-out2.fuse.net [216.68.8.175])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 4366043D46;
	Sun, 13 Aug 2006 06:06:09 +0000 (GMT)
	(envelope-from amistry@am-productions.biz)
Received: from gx6.fuse.net ([69.61.164.22]) by smtp2.fuse.net
          (InterMail vM.6.01.04.04 201-2131-118-104-20050224) with ESMTP
          id <20060813060605.ZJIH2008.smtp2.fuse.net@gx6.fuse.net>;
          Sun, 13 Aug 2006 02:06:05 -0400
Received: from bigguy.am-productions.biz ([69.61.164.22]) by gx6.fuse.net
          (InterMail vG.1.02.00.02 201-2136-104-102-20041210) with ESMTP
          id <20060813060604.RDPA24896.gx6.fuse.net@bigguy.am-productions.biz>;
          Sun, 13 Aug 2006 02:06:04 -0400
Message-Id: <1155449218.68183@bigguy.am-productions.biz>
Date: Sun, 13 Aug 2006 02:06:58 -0400
From: "Anish Mistry" <amistry@am-productions.biz>
To: "FreeBSD gnats submit" <FreeBSD-gnats-submit@freebsd.org>
Cc: sobomax@FreeBSD.org
Subject: RCify misc/zaptel and cleanup
X-Send-Pr-Version: gtk-send-pr 0.4.7 
X-GNATS-Notify:

>Number:         101958
>Category:       ports
>Synopsis:       RCify misc/zaptel and cleanup
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    sobomax
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Sun Aug 13 06:10:11 GMT 2006
>Closed-Date:    Mon Apr 16 07:59:53 GMT 2007
>Last-Modified:  Mon Apr 16 07:59:53 GMT 2007
>Originator:     Anish Mistry
>Release:        FreeBSD 6.1-RELEASE-p1 i386
>Organization:
AM Productions 
>Environment:


System: FreeBSD 6.1-RELEASE-p1 #0: Thu Jun  1 21:16:20 EDT 2006
    amistry@bigguy.am-productions.biz:/usr/obj/usr/src/sys/BIGGUY



>Description:


RCify the startup so we can allow other scripts to depend on zaptel loading first.  Make use of SUB_FILES for pkg-message.  Also included is patch to fix the panic: sleeping without a mutex problem on CURRENT.  This should probably should have been submitted separately.


>How-To-Repeat:





>Fix:


--- zaptel-rcify.patch begins here ---
diff -ruN zaptel.orig/Makefile zaptel/Makefile
--- zaptel.orig/Makefile	Sun Aug 13 00:29:52 2006
+++ zaptel/Makefile	Sun Aug 13 01:34:42 2006
@@ -20,13 +20,14 @@
 
 ONLY_FOR_ARCHS=	i386
 
-PKGMESSAGE=	${WRKSRC}/.MESSAGE
 MAKE_ENV=	KMODDIR=${PREFIX}/lib/zaptel
+SUB_FILES=	pkg-message
+USE_RC_SUBR=	zaptel
 
 .include <bsd.port.pre.mk>
 
 .if ${OSVERSION} < 500000
-IGNORE=	"does not build on FreeBSD \< 5.x"
+IGNORE=	does not build on FreeBSD \< 5.x
 .endif
 
 pre-everything::
@@ -42,15 +43,10 @@
 		${WRKSRC}/ztcfg/ztcfg.c
 
 pre-su-install:
-	@${SED} 's|%%PREFIX%%|${PREFIX}|g' ${PKGDIR}/pkg-message > \
-		${PKGMESSAGE}
-	@${SED} 's|%%PREFIX%%|${PREFIX}|g' ${FILESDIR}/zaptel.sh > \
-		${WRKDIR}/zaptel.sh.sample
 	@${MKDIR} ${PREFIX}/lib/zaptel
 
 post-install:
 	@${TOUCH} ${PREFIX}/lib/zaptel/linker.hints
-	@${INSTALL_SCRIPT} ${WRKDIR}/zaptel.sh.sample ${PREFIX}/etc/rc.d
 	@${CAT} ${PKGMESSAGE}
 
 .include <bsd.port.post.mk>
diff -ruN zaptel.orig/files/patch-zaptel_zaptel.c zaptel/files/patch-zaptel_zaptel.c
--- zaptel.orig/files/patch-zaptel_zaptel.c	Wed Dec 31 19:00:00 1969
+++ zaptel/files/patch-zaptel_zaptel.c	Fri Aug 11 11:57:02 2006
@@ -0,0 +1,11 @@
+--- zaptel/zaptel.c.orig	Sun Jun 25 14:21:49 2006
++++ zaptel/zaptel.c	Fri Aug 11 11:56:20 2006
+@@ -397,7 +397,7 @@
+ 
+ int schluffen(void *q)
+ {
+-	int rc = tsleep(q, PZERO | PCATCH, "schluffen", 0);
++	int rc = tsleep(q, PZERO | PCATCH, "schluffen", 10);
+ 	switch(rc)
+ 	{
+ 		case EINTR:
diff -ruN zaptel.orig/files/pkg-message.in zaptel/files/pkg-message.in
--- zaptel.orig/files/pkg-message.in	Wed Dec 31 19:00:00 1969
+++ zaptel/files/pkg-message.in	Sun Aug 13 01:09:17 2006
@@ -0,0 +1,27 @@
+-------------------------------------------------------------------------------
+IMPORTANT! MAKE SURE TO READ THE FOLLOWING!
+
+To use the driver set zaptel_enable="YES" in your rc.conf.
+
+To load the driver run (as root):
+
+# %%PREFIX%%/etc/rc.d/zaptel start
+
+To unload it:
+
+# %%PREFIX%%/etc/rc.d/zaptel stop
+
+It'll also load the driver automatically when the system is started.
+
+Report problems to Alexander Timoshenko <gonzo@pbxpress.com>. Please note that
+it is still "work in progress" so that your bug reports are welcome and will
+help to improve quality of the drivers.
+
+Great thanks to all companies and individuals who made this driver happen,
+including but not limited to, John Todd, Chris Coleman, Alexander Timoshenko,
+PBXpress, Inc, Max Khon, LF.net, Luigi Rizzo and others contributors.
+
+Thanks and enjoy!
+
+-Maxim
+-------------------------------------------------------------------------------
diff -ruN zaptel.orig/files/zaptel.in zaptel/files/zaptel.in
--- zaptel.orig/files/zaptel.in	Wed Dec 31 19:00:00 1969
+++ zaptel/files/zaptel.in	Sun Aug 13 01:49:33 2006
@@ -0,0 +1,51 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: zaptel
+# REQUIRE: NETWORKING
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# zaptel_enable (bool):         Set to NO by default.
+#                               Set it to YES to enable zaptel.
+#
+
+. %%RC_SUBR%%
+
+kmod_dir=%%PREFIX%%/lib/zaptel
+
+kmod_load="qozap.ko wcfxs.ko wcfxo.ko wct1xxp.ko wct4xxp.ko wcte11xp.ko"
+name="zaptel"
+rcvar=${name}_enable
+
+start_cmd="zaptel_start"
+stop_cmd="zaptel_stop"
+
+zaptel_start()
+{
+        echo "Starting ${name}."
+	kldload ${kmod_dir}/${name}.ko
+	for kmod in ${kmod_load}
+	do
+		kldload ${kmod_dir}/${kmod}
+	done
+}
+
+zaptel_stop()
+{
+        echo "Stopping ${name}."
+	for kmod in ${kmod_load}
+	do
+	        kldunload ${kmod}
+	done
+	kldunload ${name}.ko
+}
+load_rc_config $name
+
+: ${zaptel_enable="NO"}
+
+run_rc_command "$1"
+
diff -ruN zaptel.orig/files/zaptel.sh zaptel/files/zaptel.sh
--- zaptel.orig/files/zaptel.sh	Sun Aug 13 00:29:46 2006
+++ zaptel/files/zaptel.sh	Wed Dec 31 19:00:00 1969
@@ -1,36 +0,0 @@
-#!/bin/sh
-
-PREFIX=%%PREFIX%%
-LIBDIR=${PREFIX}/lib/zaptel
-
-case "$1" in
-	start)
-		/sbin/kldload ${LIBDIR}/zaptel.ko || exit 1
-		/sbin/kldload ${LIBDIR}/qozap.ko || exit 1
-		/sbin/kldload ${LIBDIR}/wcfxo.ko || exit 1
-		/sbin/kldload ${LIBDIR}/wcfxs.ko || exit 1
-		/sbin/kldload ${LIBDIR}/wct1xxp.ko || exit 1
-		/sbin/kldload ${LIBDIR}/wct4xxp.ko || exit 1
-		/sbin/kldload ${LIBDIR}/wcte11xp.ko || exit 1
-		${PREFIX}/bin/ztcfg
-		echo -n " zaptel"
-		;;
-
-	stop)
-		/sbin/kldunload qozap.ko || exit 1
-		/sbin/kldunload wcfxs.ko || exit 1
-		/sbin/kldunload wcfxo.ko || exit 1
-		/sbin/kldunload wct1xxp.ko || exit 1
-		/sbin/kldunload wct4xxp.ko || exit 1
-		/sbin/kldunload wcte11xp.ko || exit 1
-		/sbin/kldunload zaptel.ko || exit 1
-		echo -n " zaptel"
-		;;
-
-	*)
-		echo ""
-		echo "Usage: `basename $0` { start | stop }"
-		echo ""
-		exit 64
-		;;
-esac
diff -ruN zaptel.orig/pkg-message zaptel/pkg-message
--- zaptel.orig/pkg-message	Sun Aug 13 00:29:52 2006
+++ zaptel/pkg-message	Wed Dec 31 19:00:00 1969
@@ -1,28 +0,0 @@
--------------------------------------------------------------------------------
-IMPORTANT! MAKE SURE TO READ THE FOLLOWING!
-
-To use the driver, make a copy of %%PREFIX%%/etc/rc.d/zaptel.sh.sample
-under %%PREFIX%%/etc/rc.d/zaptel.sh.
-
-To load the driver run (as root):
-
-# %%PREFIX%%/etc/rc.d/zaptel.sh start
-
-To unload it:
-
-# %%PREFIX%%/etc/rc.d/zaptel.sh stop
-
-It'll also load the driver automatically when the system is started.
-
-Report problems to Alexander Timoshenko <gonzo@pbxpress.com>. Please note that
-it is still "work in progress" so that your bug reports are welcome and will
-help to improve quality of the drivers.
-
-Great thanks to all companies and individuals who made this driver happen,
-including but not limited to, John Todd, Chris Coleman, Alexander Timoshenko,
-PBXpress, Inc, Max Khon, LF.net, Luigi Rizzo and others contributors.
-
-Thanks and enjoy!
-
--Maxim
--------------------------------------------------------------------------------
diff -ruN zaptel.orig/pkg-plist zaptel/pkg-plist
--- zaptel.orig/pkg-plist	Sun Aug 13 00:29:52 2006
+++ zaptel/pkg-plist	Sun Aug 13 00:52:56 2006
@@ -3,7 +3,6 @@
 bin/ztmonitor
 bin/zttest
 bin/zttool
-etc/rc.d/zaptel.sh.sample
 include/tonezone.h
 include/zaptel.h
 lib/libtonezone.a
--- zaptel-rcify.patch ends here ---



>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->sobomax 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Sun Aug 13 06:10:29 UTC 2006 
Responsible-Changed-Why:  
Over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=101958 

From: Anish Mistry <amistry@am-productions.biz>
To: bug-followup@freebsd.org, amistry@am-productions.biz
Cc:  
Subject: Re: ports/101958: RCify misc/zaptel and cleanup
Date: Sun, 13 Aug 2006 03:02:45 -0400

 --nextPart2172687.L0cx4bqTpN
 Content-Type: text/plain;
   charset="us-ascii"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: inline
 
 Argh, I suck.  Try #2.  Fix RC script to use PREFIX and run ztcfg. =20
 Bump PORTREVISION.
 
 http://am-productions.biz/docs/zaptel-rcify.patch
 
 =2D-=20
 Anish Mistry
 amistry@am-productions.biz
 AM Productions http://am-productions.biz/
 
 --nextPart2172687.L0cx4bqTpN
 Content-Type: application/pgp-signature
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.3 (FreeBSD)
 
 iD8DBQBE3s6hxqA5ziudZT0RAhngAJ9yvtjI/dPFJMP9WVjUbAovfqOz/ACgpJ6K
 74Ki4gZHIkBo0xfhkHX6PWs=
 =uTCw
 -----END PGP SIGNATURE-----
 
 --nextPart2172687.L0cx4bqTpN--

From: Anish Mistry <amistry@am-productions.biz>
To: bug-followup@freebsd.org, amistry@am-productions.biz
Cc:  
Subject: Re: ports/101958: RCify misc/zaptel and cleanup
Date: Mon, 14 Aug 2006 14:45:43 -0400

 --nextPart1552587.oi5IvY4A99
 Content-Type: text/plain;
   charset="us-ascii"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: inline
 
 Thanks for the commit.  Any comments on the zaptel.c tsleep patch? =20
 I've been running it here for about a week with a decent amount of=20
 calling and faxing.  Let me know if you have a better patch.
 
 Thanks,
 =2D-=20
 Anish Mistry
 amistry@am-productions.biz
 AM Productions http://am-productions.biz/
 
 --nextPart1552587.oi5IvY4A99
 Content-Type: application/pgp-signature
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.3 (FreeBSD)
 
 iD8DBQBE4MTfxqA5ziudZT0RAmrOAKCCUdJCcPoADKOyY48ZLh16X+FtRwCgr27E
 y0BBmf9Yu8TYESJmBNmfyYc=
 =anKs
 -----END PGP SIGNATURE-----
 
 --nextPart1552587.oi5IvY4A99--

From: Maxim Sobolev <sobomax@FreeBSD.org>
To: Anish Mistry <amistry@am-productions.biz>, bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/101958: RCify misc/zaptel and cleanup
Date: Mon, 14 Aug 2006 13:14:47 -0700

 I am waiting to hear from the zaptel/BSD maintainer on this. My own 
 kernel-foo is insufficient to make decision on this patch.
 
 -Maxim
 
 Anish Mistry wrote:
 > The following reply was made to PR ports/101958; it has been noted by GNATS.
 > 
 > From: Anish Mistry <amistry@am-productions.biz>
 > To: bug-followup@freebsd.org, amistry@am-productions.biz
 > Cc:  
 > Subject: Re: ports/101958: RCify misc/zaptel and cleanup
 > Date: Mon, 14 Aug 2006 14:45:43 -0400
 > 
 >  --nextPart1552587.oi5IvY4A99
 >  Content-Type: text/plain;
 >    charset="us-ascii"
 >  Content-Transfer-Encoding: quoted-printable
 >  Content-Disposition: inline
 >  
 >  Thanks for the commit.  Any comments on the zaptel.c tsleep patch? =20
 >  I've been running it here for about a week with a decent amount of=20
 >  calling and faxing.  Let me know if you have a better patch.
 >  
 >  Thanks,
 >  =2D-=20
 >  Anish Mistry
 >  amistry@am-productions.biz
 >  AM Productions http://am-productions.biz/
 >  
 >  --nextPart1552587.oi5IvY4A99
 >  Content-Type: application/pgp-signature
 >  
 >  -----BEGIN PGP SIGNATURE-----
 >  Version: GnuPG v1.4.3 (FreeBSD)
 >  
 >  iD8DBQBE4MTfxqA5ziudZT0RAmrOAKCCUdJCcPoADKOyY48ZLh16X+FtRwCgr27E
 >  y0BBmf9Yu8TYESJmBNmfyYc=
 >  =anKs
 >  -----END PGP SIGNATURE-----
 >  
 >  --nextPart1552587.oi5IvY4A99--
 > 
 > 
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/101958: commit references a PR
Date: Mon, 29 Jan 2007 18:59:58 +0000 (UTC)

 sobomax     2007-01-29 18:59:51 UTC
 
   FreeBSD ports repository
 
   Modified files:
     misc/zaptel          Makefile 
   Added files:
     misc/zaptel/files    patch-zaptel::zaptel.c 
   Log:
   Fix the panic: sleeping without a mutex problem on CURRENT.
   
   PR:             ports/101958
   Submitted by:   Anish Mistry
   
   Revision  Changes    Path
   1.24      +1 -0      ports/misc/zaptel/Makefile
   1.3       +11 -0     ports/misc/zaptel/files/patch-zaptel::zaptel.c (new)
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: sobomax 
State-Changed-When: Mon Apr 16 07:59:37 UTC 2007 
State-Changed-Why:  
Changes commited, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=101958 
>Unformatted:
