CVS commit: src/usr.sbin/altq/altqstat

2021-07-20 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Jul 21 06:48:28 UTC 2021

Modified Files:
src/usr.sbin/altq/altqstat: qdisc_cbq.c

Log Message:
altqstat, cbq: follow uint64_t changes

PR kern/56319


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/altq/altqstat/qdisc_cbq.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/altq/altqstat/qdisc_cbq.c
diff -u src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.10 src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.11
--- src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.10	Wed Jul 21 06:45:10 2021
+++ src/usr.sbin/altq/altqstat/qdisc_cbq.c	Wed Jul 21 06:48:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: qdisc_cbq.c,v 1.10 2021/07/21 06:45:10 ozaki-r Exp $	*/
+/*	$NetBSD: qdisc_cbq.c,v 1.11 2021/07/21 06:48:28 ozaki-r Exp $	*/
 /*	$KAME: qdisc_cbq.c,v 1.7 2003/09/17 14:27:37 kjc Exp $	*/
 /*
  * Copyright (C) 1999-2000
@@ -105,9 +105,9 @@ cbq_stat_loop(int fd, const char *ifname
 
 			printf("\tpriority: %d depth: %d",
 			   sp->priority, sp->depth);
-			printf(" offtime: %ld [ns] wrr_allot: %d bytes\n",
+			printf(" offtime: %"PRIi64" [ns] wrr_allot: %d bytes\n",
 			   sp->offtime, sp->wrr_allot);
-			printf("\tpsPerByte: %ld", sp->ps_per_byte);
+			printf("\tpsPerByte: %"PRIu64, sp->ps_per_byte);
 			printf("\t(%sbps)", rate2str(flow_bps));
 			if (lp->handle != NULL_CLASS_HANDLE) {
 printf(",\tMeasured: %s [bps]\n",
@@ -139,7 +139,7 @@ cbq_stat_loop(int fd, const char *ifname
 			   sp->maxidle >> RM_FILTER_GAIN,
 			   sp->minidle / RM_POWER);
 #else
-			printf("\tAvgIdle: %ld [ns],\t(maxidle: %ld minidle: %ld [ns])\n",
+			printf("\tAvgIdle: %"PRIi64" [ns],\t(maxidle: %"PRIi64" minidle: %"PRIi64" [ns])\n",
 			   sp->avgidle, sp->maxidle, sp->minidle);
 #endif
 		}



CVS commit: src/usr.sbin/altq/altqstat

2021-07-20 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Jul 21 06:45:10 UTC 2021

Modified Files:
src/usr.sbin/altq/altqstat: qdisc_cbq.c

Log Message:
altqstat: follow changes of types of variables

PR kern/56319


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/altq/altqstat/qdisc_cbq.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/altq/altqstat/qdisc_cbq.c
diff -u src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.9 src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.10
--- src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.9	Wed Jul 21 06:42:07 2021
+++ src/usr.sbin/altq/altqstat/qdisc_cbq.c	Wed Jul 21 06:45:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: qdisc_cbq.c,v 1.9 2021/07/21 06:42:07 ozaki-r Exp $	*/
+/*	$NetBSD: qdisc_cbq.c,v 1.10 2021/07/21 06:45:10 ozaki-r Exp $	*/
 /*	$KAME: qdisc_cbq.c,v 1.7 2003/09/17 14:27:37 kjc Exp $	*/
 /*
  * Copyright (C) 1999-2000
@@ -105,7 +105,7 @@ cbq_stat_loop(int fd, const char *ifname
 
 			printf("\tpriority: %d depth: %d",
 			   sp->priority, sp->depth);
-			printf(" offtime: %d [us] wrr_allot: %d bytes\n",
+			printf(" offtime: %ld [ns] wrr_allot: %d bytes\n",
 			   sp->offtime, sp->wrr_allot);
 			printf("\tpsPerByte: %ld", sp->ps_per_byte);
 			printf("\t(%sbps)", rate2str(flow_bps));
@@ -139,7 +139,7 @@ cbq_stat_loop(int fd, const char *ifname
 			   sp->maxidle >> RM_FILTER_GAIN,
 			   sp->minidle / RM_POWER);
 #else
-			printf("\tAvgIdle: %d [us],\t(maxidle: %d minidle: %d [us])\n",
+			printf("\tAvgIdle: %ld [ns],\t(maxidle: %ld minidle: %ld [ns])\n",
 			   sp->avgidle, sp->maxidle, sp->minidle);
 #endif
 		}



CVS commit: src/usr.sbin/altq/altqstat

2021-07-20 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Jul 21 06:42:07 UTC 2021

Modified Files:
src/usr.sbin/altq/altqstat: qdisc_cbq.c

Log Message:
altqstat: show raw values of avgidle, maxidle and minidle

The values are sometimes small and cooked values of them can be less
informative such as 0 or -1.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/altq/altqstat/qdisc_cbq.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/altq/altqstat/qdisc_cbq.c
diff -u src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.8 src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.9
--- src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.8	Wed Jul 21 06:38:57 2021
+++ src/usr.sbin/altq/altqstat/qdisc_cbq.c	Wed Jul 21 06:42:07 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: qdisc_cbq.c,v 1.8 2021/07/21 06:38:57 ozaki-r Exp $	*/
+/*	$NetBSD: qdisc_cbq.c,v 1.9 2021/07/21 06:42:07 ozaki-r Exp $	*/
 /*	$KAME: qdisc_cbq.c,v 1.7 2003/09/17 14:27:37 kjc Exp $	*/
 /*
  * Copyright (C) 1999-2000
@@ -133,10 +133,15 @@ cbq_stat_loop(int fd, const char *ifname
 
 			printf("\tQCount: %d,\t(qmax: %d)\n",
 			   sp->qcnt, sp->qmax);
+#if 0
 			printf("\tAvgIdle: %d [us],\t(maxidle: %d minidle: %d [us])\n",
 			   sp->avgidle >> RM_FILTER_GAIN,
 			   sp->maxidle >> RM_FILTER_GAIN,
 			   sp->minidle / RM_POWER);
+#else
+			printf("\tAvgIdle: %d [us],\t(maxidle: %d minidle: %d [us])\n",
+			   sp->avgidle, sp->maxidle, sp->minidle);
+#endif
 		}
 
 		/* swap the buffer pointers */



CVS commit: src/usr.sbin/altq/altqstat

2021-07-20 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Jul 21 06:38:57 UTC 2021

Modified Files:
src/usr.sbin/altq/altqstat: qdisc_cbq.c

Log Message:
altqstat: adopt ps_per_byte

PR kern/56319


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/altq/altqstat/qdisc_cbq.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/altq/altqstat/qdisc_cbq.c
diff -u src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.7 src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.8
--- src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.7	Sat Oct 28 11:43:02 2006
+++ src/usr.sbin/altq/altqstat/qdisc_cbq.c	Wed Jul 21 06:38:57 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: qdisc_cbq.c,v 1.7 2006/10/28 11:43:02 peter Exp $	*/
+/*	$NetBSD: qdisc_cbq.c,v 1.8 2021/07/21 06:38:57 ozaki-r Exp $	*/
 /*	$KAME: qdisc_cbq.c,v 1.7 2003/09/17 14:27:37 kjc Exp $	*/
 /*
  * Copyright (C) 1999-2000
@@ -100,14 +100,14 @@ cbq_stat_loop(int fd, const char *ifname
 			printf("Class %d on Interface %s: %s\n",
 			sp->handle, ifname, clnames[i]);
 
-			flow_bps = 8.0 / (double)sp->ns_per_byte
-			* 1000*1000*1000;
+			flow_bps = 8.0 / (double)sp->ps_per_byte
+			* 1000*1000*1000*1000;
 
 			printf("\tpriority: %d depth: %d",
 			   sp->priority, sp->depth);
 			printf(" offtime: %d [us] wrr_allot: %d bytes\n",
 			   sp->offtime, sp->wrr_allot);
-			printf("\tnsPerByte: %d", sp->ns_per_byte);
+			printf("\tpsPerByte: %ld", sp->ps_per_byte);
 			printf("\t(%sbps)", rate2str(flow_bps));
 			if (lp->handle != NULL_CLASS_HANDLE) {
 printf(",\tMeasured: %s [bps]\n",



CVS commit: src/usr.sbin/altq/altqstat

2020-02-07 Thread Santhosh Raju
Module Name:src
Committed By:   fox
Date:   Sat Feb  8 01:01:31 UTC 2020

Modified Files:
src/usr.sbin/altq/altqstat: Makefile

Log Message:
usr.sbin/altq: Suppress -Werror=stringop-truncation error.

Add GCC_NO_STRINGOP_TRUNCATION to quip_client.c to prevent build failure.

Error was reported when build.sh was run with MKLIBCSANITIZER=yes flag.

Reviewed by: kamil@


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/altq/altqstat/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/altq/altqstat/Makefile
diff -u src/usr.sbin/altq/altqstat/Makefile:1.4 src/usr.sbin/altq/altqstat/Makefile:1.5
--- src/usr.sbin/altq/altqstat/Makefile:1.4	Sat Feb  6 23:45:26 2010
+++ src/usr.sbin/altq/altqstat/Makefile	Sat Feb  8 01:01:31 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.4 2010/02/06 23:45:26 he Exp $
+#	$NetBSD: Makefile,v 1.5 2020/02/08 01:01:31 fox Exp $
 
 PROG=	altqstat
 SRCS=	altqstat.c quip_client.c qdisc_conf.c qdisc_cbq.c qdisc_hfsc.c \
@@ -10,4 +10,6 @@ CPPFLAGS+= -DALTQ -I${.CURDIR}/../libalt
 DPADD+=	${LIBCURSES} ${LIBTERMINFO} ${LIBMATH}
 LDADD+=	-lcurses -lterminfo -lm
 
+COPTS.quip_client.c+=	${GCC_NO_STRINGOP_TRUNCATION}
+
 .include 



CVS commit: src/usr.sbin/altq/altqstat

2020-02-07 Thread Santhosh Raju
Module Name:src
Committed By:   fox
Date:   Fri Feb  7 21:53:20 UTC 2020

Modified Files:
src/usr.sbin/altq/altqstat: quip_client.c

Log Message:
usr.sbin/altq: Revert the strlcpy(3) change since this changes expected 
behavior from strncpy(3).

Reviewed by: kamil@


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/altq/altqstat/quip_client.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/altq/altqstat/quip_client.c
diff -u src/usr.sbin/altq/altqstat/quip_client.c:1.13 src/usr.sbin/altq/altqstat/quip_client.c:1.14
--- src/usr.sbin/altq/altqstat/quip_client.c:1.13	Fri Feb  7 20:13:26 2020
+++ src/usr.sbin/altq/altqstat/quip_client.c	Fri Feb  7 21:53:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: quip_client.c,v 1.13 2020/02/07 20:13:26 fox Exp $	*/
+/*	$NetBSD: quip_client.c,v 1.14 2020/02/07 21:53:20 fox Exp $	*/
 /*	$KAME: quip_client.c,v 1.9 2003/05/17 05:59:00 itojun Exp $	*/
 /*
  * Copyright (C) 1999-2000
@@ -454,7 +454,8 @@ extract_ifname(const char *name)
 	else
 		len = strlen(name);
 	len = MIN(len, 63);
-	strlcpy(ifname, name, len);
+	strncpy(ifname, name, len);
+	ifname[len] = '\0';
 	return (ifname);
 }
 



CVS commit: src/usr.sbin/altq/altqstat

2020-02-07 Thread Santhosh Raju
Module Name:src
Committed By:   fox
Date:   Fri Feb  7 20:13:26 UTC 2020

Modified Files:
src/usr.sbin/altq/altqstat: quip_client.c

Log Message:
usr.sbin/altq: Fix -Wstringop-truncation warning.

Looks like the original intention was to truncate the string at len.

Replace strncpy(3) with strlcpy(3).

Error was reported when build.sh was run with MKLIBCSANITIZER=yes flag.

Reviewed by: kamil@


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/altq/altqstat/quip_client.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/altq/altqstat/quip_client.c
diff -u src/usr.sbin/altq/altqstat/quip_client.c:1.12 src/usr.sbin/altq/altqstat/quip_client.c:1.13
--- src/usr.sbin/altq/altqstat/quip_client.c:1.12	Wed Feb 17 19:51:29 2016
+++ src/usr.sbin/altq/altqstat/quip_client.c	Fri Feb  7 20:13:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: quip_client.c,v 1.12 2016/02/17 19:51:29 christos Exp $	*/
+/*	$NetBSD: quip_client.c,v 1.13 2020/02/07 20:13:26 fox Exp $	*/
 /*	$KAME: quip_client.c,v 1.9 2003/05/17 05:59:00 itojun Exp $	*/
 /*
  * Copyright (C) 1999-2000
@@ -454,8 +454,7 @@ extract_ifname(const char *name)
 	else
 		len = strlen(name);
 	len = MIN(len, 63);
-	strncpy(ifname, name, len);
-	ifname[len] = '\0';
+	strlcpy(ifname, name, len);
 	return (ifname);
 }
 



CVS commit: src/usr.sbin/altq/altqstat

2019-04-09 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Tue Apr  9 18:21:15 UTC 2019

Modified Files:
src/usr.sbin/altq/altqstat: altqstat.1

Log Message:
New sentence, new line


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/altq/altqstat/altqstat.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/altq/altqstat/altqstat.1
diff -u src/usr.sbin/altq/altqstat/altqstat.1:1.6 src/usr.sbin/altq/altqstat/altqstat.1:1.7
--- src/usr.sbin/altq/altqstat/altqstat.1:1.6	Sat Jan 19 03:05:35 2002
+++ src/usr.sbin/altq/altqstat/altqstat.1	Tue Apr  9 18:21:15 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: altqstat.1,v 1.6 2002/01/19 03:05:35 wiz Exp $
+.\"	$NetBSD: altqstat.1,v 1.7 2019/04/09 18:21:15 sevan Exp $
 .\"	$KAME: altqstat.1,v 1.6 2001/08/22 08:50:49 itojun Exp $
 .\"
 .\" Copyright (C) 2000
@@ -25,7 +25,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd December 24, 1999
+.Dd April 9, 2019
 .Dt ALTQSTAT 1
 .Os
 .Sh NAME
@@ -41,8 +41,8 @@
 .Sh DESCRIPTION
 The
 .Nm altqstat
-command displays the status of a queueing discipline.  The contents
-displayed by
+command displays the status of a queueing discipline.
+The contents displayed by
 .Nm
 is specific to each queueing discipline.
 .Pp
@@ -51,7 +51,8 @@ The options are as follows:
 .It Fl e
 Echo communication with
 .Xr altqd 8
-to standard output.  This option is for debugging.
+to standard output.
+This option is for debugging.
 .It Fl n
 Disable communication with
 .Xr altqd 8 .
@@ -69,24 +70,27 @@ List all interfaces, classes and filters
 .Nm
 exits after displaying
 .Ar count
-times.  If no repeat
+times.
+If no repeat
 .Ar count
 is specified, the default is infinity.
 .It Fl w Ar wait
 Pause
 .Ar wait
-seconds between each display.  If no repeat
+seconds between each display.
+If no repeat
 .Ar wait
 interval is specified, the default is 5 seconds.
 .It Fl i Ar interface
-Show information about the specified interface.  If no
+Show information about the specified interface.
+If no
 .Ar interface
 is specified, the default interface is the first interface returned
 from
 .Xr altqd 8 .
 .It Fl I Ar input_interface
-Show information about the specified input interface.  This option is
-used to specify
+Show information about the specified input interface.
+This option is used to specify
 .Em traffic conditioner
 at an input interface.
 .El



CVS commit: src/usr.sbin/altq/altqstat

2016-02-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb 17 19:51:29 UTC 2016

Modified Files:
src/usr.sbin/altq/altqstat: quip_client.c

Log Message:
PR/50824: David Binderman: Limit scanf width


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/altq/altqstat/quip_client.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/altq/altqstat/quip_client.c
diff -u src/usr.sbin/altq/altqstat/quip_client.c:1.11 src/usr.sbin/altq/altqstat/quip_client.c:1.12
--- src/usr.sbin/altq/altqstat/quip_client.c:1.11	Tue Jun 16 19:04:14 2015
+++ src/usr.sbin/altq/altqstat/quip_client.c	Wed Feb 17 14:51:29 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: quip_client.c,v 1.11 2015/06/16 23:04:14 christos Exp $	*/
+/*	$NetBSD: quip_client.c,v 1.12 2016/02/17 19:51:29 christos Exp $	*/
 /*	$KAME: quip_client.c,v 1.9 2003/05/17 05:59:00 itojun Exp $	*/
 /*
  * Copyright (C) 1999-2000
@@ -357,7 +357,7 @@ quip_selectqdisc(char *ifname, char *qdi
 	if (result_code != 200)
 		errx(1, "can't get qdisc info");
 
-	if (sscanf(buf, "%s", qdisc) != 1)
+	if (sscanf(buf, "%63s", qdisc) != 1)
 		errx(1, "can't get qdisc name");
 
 	if (qdisc_name != NULL && strcmp(qdisc, qdisc_name) != 0)



CVS commit: src/usr.sbin/altq/altqstat

2011-01-04 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Jan  4 09:13:23 UTC 2011

Modified Files:
src/usr.sbin/altq/altqstat: qdisc_conf.c

Log Message:
Close fd in error case. Found by cppcheck.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/altq/altqstat/qdisc_conf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/altq/altqstat/qdisc_conf.c
diff -u src/usr.sbin/altq/altqstat/qdisc_conf.c:1.5 src/usr.sbin/altq/altqstat/qdisc_conf.c:1.6
--- src/usr.sbin/altq/altqstat/qdisc_conf.c:1.5	Fri May  2 19:07:44 2008
+++ src/usr.sbin/altq/altqstat/qdisc_conf.c	Tue Jan  4 09:13:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: qdisc_conf.c,v 1.5 2008/05/02 19:07:44 xtraeme Exp $	*/
+/*	$NetBSD: qdisc_conf.c,v 1.6 2011/01/04 09:13:22 wiz Exp $	*/
 /*	$KAME: qdisc_conf.c,v 1.5 2002/10/26 06:59:54 kjc Exp $	*/
 /*
  * Copyright (C) 1999-2000
@@ -91,6 +91,7 @@
 	}
 	if (ioctl(fd, ALTQGTYPE, &qtypereq) < 0) {
 		warn("ALTQGQTYPE");
+		close(fd);
 		return (0);
 	}
 	close(fd);