From nobody@FreeBSD.org  Tue Nov 27 17:49:45 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3955016A417
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 27 Nov 2007 17:49:45 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 28F1713C46E
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 27 Nov 2007 17:49:45 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id lARHncTS063536
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 27 Nov 2007 17:49:38 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id lARHncZv063535;
	Tue, 27 Nov 2007 17:49:38 GMT
	(envelope-from nobody)
Message-Id: <200711271749.lARHncZv063535@www.freebsd.org>
Date: Tue, 27 Nov 2007 17:49:38 GMT
From: Mykola Zubach <zuborg@advancedhosters.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: watch(8) allow use up to 10 snp* devices
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         118286
>Category:       bin
>Synopsis:       [patch] watch(8) allow use up to 10 snp* devices
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    rink
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 27 17:50:02 UTC 2007
>Closed-Date:    Mon Feb 11 14:29:26 UTC 2008
>Last-Modified:  Mon Feb 11 14:29:26 UTC 2008
>Originator:     Mykola Zubach
>Release:        6.2-RELEASE-p8
>Organization:
AdvancedHosters.com
>Environment:
FreeBSD advancedhosters.com 6.2-RELEASE-p8 FreeBSD 6.2-RELEASE-p8 #3: Fri Nov 16 12:31:53 UTC 2007     root@advancedhosters.com:/usr/src/sys/i386/compile/Z  i386
>Description:
for (c = '0'; c <= '9'; c++) {
This code is self explanatory

watch(8) do up to 10 tries to find not used /dev/snp*, and then fail
I've rewrite this part so it could use up to 999 snp devices.
>How-To-Repeat:
open 11 watch(8) sessions in parallel
>Fix:
/usr/src/usr.sbin/watch
patch < /path/2/patch

Patch attached with submission follows:

--- watch.c	Tue Nov 27 19:44:33 2007
+++ watch.c.new	Tue Nov 27 19:45:25 2007
@@ -152,19 +152,18 @@
 static int
 open_snp(void)
 {
-	char            snp[] = {_PATH_DEV "snpX"};
-	char            c;
-	int             f, mode, pos;
+	char		snp[] = {_PATH_DEV "snpXXX"};
+	int		f, mode, pos, c;
 
-	pos = strlen(snp) - 1;
+	pos = strlen(snp) - 3;
 	if (opt_write)
 		mode = O_RDWR;
 	else
 		mode = O_RDONLY;
 
 	if (opt_snpdev == NULL)
-		for (c = '0'; c <= '9'; c++) {
-			snp[pos] = c;
+		for (c = 0; c <= 999; c++) {
+			snprintf(snp+pos, 4, "%d", c);
 			if ((f = open(snp, mode)) < 0) {
 				if (errno == EBUSY)
 					continue;


>Release-Note:
>Audit-Trail:

From: Remko Lodder <remko@FreeBSD.org>
To: Mykola Zubach <zuborg@advancedhosters.com>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: bin/118286: watch(8) allow use up to 10 snp* devices
Date: Tue, 27 Nov 2007 18:52:53 +0100

 Mykola Zubach wrote:
 > FreeBSD advancedhosters.com 6.2-RELEASE-p8 FreeBSD 6.2-RELEASE-p8 #3: Fri Nov 16 12:31:53 UTC 2007     root@advancedhosters.com:/usr/src/sys/i386/compile/Z  i386
 >> Description:
 > for (c = '0'; c <= '9'; c++) {
 > This code is self explanatory
 > 
 > watch(8) do up to 10 tries to find not used /dev/snp*, and then fail
 > I've rewrite this part so it could use up to 999 snp devices.
 >> How-To-Repeat:
 > open 11 watch(8) sessions in parallel
 
 So why would we want to open up to 999 snoop sessions?
 
 I see this as a tool to assist someone in case of problems, I dont
 see that many scenarios in which one would do more then 10 sessions
 at all; unless you are perhaps doing more then just assisting someone
 but in that case you can easily override it locally.
 
 //Remko
 
 -- 
 /"\   Best regards,                      | remko@FreeBSD.org
 \ /   Remko Lodder                       | remko@EFnet
  X    http://www.evilcoder.org/          |
 / \   ASCII Ribbon Campaign              | Against HTML Mail and News
Responsible-Changed-From-To: freebsd-bugs->rink 
Responsible-Changed-By: rwatson 
Responsible-Changed-When: Sun Dec 2 16:11:05 UTC 2007 
Responsible-Changed-Why:  
Assign to rink as he has expressed interest in this problem; it's a bit 
surprising we haven't seen more reports of this type as there are, 
apparently, ports that auto-attach snp to all login sessions, and 
presumably run up against this limit on any reasonably busy system. 


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

From: Robert Watson <rwatson@FreeBSD.org>
To: Remko Lodder <remko@FreeBSD.org>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: bin/118286: watch(8) allow use up to 10 snp* devices
Date: Sun, 2 Dec 2007 15:57:38 +0000 (GMT)

 > The following reply was made to PR bin/118286; it has been noted by GNATS.
 >
 > From: Remko Lodder <remko@FreeBSD.org>
 > To: Mykola Zubach <zuborg@advancedhosters.com>
 > Cc: freebsd-gnats-submit@FreeBSD.org
 > Subject: Re: bin/118286: watch(8) allow use up to 10 snp* devices
 > Date: Tue, 27 Nov 2007 18:52:53 +0100
 >
 > Mykola Zubach wrote:
 > > FreeBSD advancedhosters.com 6.2-RELEASE-p8 FreeBSD 6.2-RELEASE-p8 #3: Fri Nov 16 12:31:53 UTC 2007     root@advancedhosters.com:/usr/src/sys/i386/compile/Z  i386
 > >> Description:
 > > for (c = '0'; c <= '9'; c++) {
 > > This code is self explanatory
 > >
 > > watch(8) do up to 10 tries to find not used /dev/snp*, and then fail
 > > I've rewrite this part so it could use up to 999 snp devices.
 > >> How-To-Repeat:
 > > open 11 watch(8) sessions in parallel
 >
 > So why would we want to open up to 999 snoop sessions?
 >
 > I see this as a tool to assist someone in case of problems, I dont see that 
 > many scenarios in which one would do more then 10 sessions at all; unless 
 > you are perhaps doing more then just assisting someone but in that case you 
 > can easily override it locally.
 
 While I've never hit the limit of 10, I have frequently had >4 watch sessions 
 going at once on realizing that I have sessions from another workstation that 
 I need to clean up.  It's certainly possible to imagine scenarios in which 
 three people clean up four sessions each at about the same time.  On the 
 principle that we make tools and not policy, I think there's a reasonable 
 argument to be made for raising the limit significantly, and no real reason 
 not to raise the limit...
 
 Robert N M Watson
 Computer Laboratory
 University of Cambridge

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/118286: commit references a PR
Date: Wed, 30 Jan 2008 13:55:40 +0000 (UTC)

 rink        2008-01-30 13:55:32 UTC
 
   FreeBSD src repository
 
   Modified files:
     usr.sbin/watch       watch.c 
   Log:
   Allow watch(8) to use more than 10 snp* devices. This limitation was purely
   due to the way watch(8) looks for available snoop devices.
   
   PR:             bin/118286
   Submitted by:   Mykola Zubach <zuborg@advancedhosters.com>
   Reviewed by:    rwatson, csjp, imp (all a long time ago)
   Approved by:    imp (mentor) (long time ago)
   MFC after:      1 week
   
   Revision  Changes    Path
   1.35      +5 -6      src/usr.sbin/watch/watch.c
 _______________________________________________
 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"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/118286: commit references a PR
Date: Thu,  7 Feb 2008 07:33:35 +0000 (UTC)

 rink        2008-02-07 07:33:28 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_7)
     usr.sbin/watch       watch.c 
   Log:
   MFC 1.35:
   Allow watch(8) to use more than 10 snp* devices. This limitation was purely
   due to the way watch(8) looks for available snoop devices.
   
   PR:             bin/118286
   Submitted by:   Mykola Zubach <zuborg@advancedhosters.com>
   Reviewed by:    rwatson, csjp, imp (all a long time ago)
   Approved by:    imp (mentor) (long time ago)
   
   Revision  Changes    Path
   1.34.2.1  +5 -6      src/usr.sbin/watch/watch.c
 _______________________________________________
 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"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/118286: commit references a PR
Date: Thu,  7 Feb 2008 07:36:37 +0000 (UTC)

 rink        2008-02-07 07:36:31 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_6)
     usr.sbin/watch       watch.c 
   Log:
   MFC 1.35:
   Allow watch(8) to use more than 10 snp* devices. This limitation was purely
   due to the way watch(8) looks for available snoop devices.
   
   PR:             bin/118286
   Submitted by:   Mykola Zubach <zuborg@advancedhosters.com>
   Reviewed by:    rwatson, csjp, imp (all a long time ago)
   Approved by:    imp (mentor) (long time ago)
   
   Revision  Changes    Path
   1.31.8.2  +5 -6      src/usr.sbin/watch/watch.c
 _______________________________________________
 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: rink 
State-Changed-When: Mon Feb 11 14:29:12 UTC 2008 
State-Changed-Why:  
Committed, thanks! 

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