Date: Tue, 27 Nov 2007 17:49:38 GMT From: Mykola Zubach <zuborg@advancedhosters.com> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/118286: watch(8) allow use up to 10 snp* devices Message-ID: <200711271749.lARHncZv063535@www.freebsd.org> Resent-Message-ID: <200711271750.lARHo242019473@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 118286 >Category: bin >Synopsis: watch(8) allow use up to 10 snp* devices >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Nov 27 17:50:02 UTC 2007 >Closed-Date: >Last-Modified: >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: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200711271749.lARHncZv063535>