CVS commit: src/tests/lib/libutil

2017-03-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Mar 22 05:35:33 UTC 2017

Modified Files:
src/tests/lib/libutil: t_parsedate.c

Log Message:
Fix typo in a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/tests/lib/libutil/t_parsedate.c

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

Modified files:

Index: src/tests/lib/libutil/t_parsedate.c
diff -u src/tests/lib/libutil/t_parsedate.c:1.29 src/tests/lib/libutil/t_parsedate.c:1.30
--- src/tests/lib/libutil/t_parsedate.c:1.29	Wed Mar 22 01:50:22 2017
+++ src/tests/lib/libutil/t_parsedate.c	Wed Mar 22 05:35:33 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: t_parsedate.c,v 1.29 2017/03/22 01:50:22 kre Exp $ */
+/* $NetBSD: t_parsedate.c,v 1.30 2017/03/22 05:35:33 kre Exp $ */
 /*-
  * Copyright (c) 2010, 2015 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_parsedate.c,v 1.29 2017/03/22 01:50:22 kre Exp $");
+__RCSID("$NetBSD: t_parsedate.c,v 1.30 2017/03/22 05:35:33 kre Exp $");
 
 #include 
 #include 
@@ -209,7 +209,7 @@ ATF_TC_BODY(times, tc)
 	parsecheck("12pm", NULL, NULL, localtime_r,
 		ANY, ANY, ANY, 12, 0, 0);
 
-	/* end 52010 bug tests */
+	/* end 52101 bug tests */
 
 	parsecheck("12 noon", NULL, NULL, localtime_r,
 		ANY, ANY, ANY, 12, 0, 0);



CVS commit: src/tests/lib/libutil

2017-03-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Mar 22 05:35:33 UTC 2017

Modified Files:
src/tests/lib/libutil: t_parsedate.c

Log Message:
Fix typo in a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/tests/lib/libutil/t_parsedate.c

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



CVS commit: src

2017-03-21 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Mar 22 03:32:09 UTC 2017

Modified Files:
src/share/man/man4: wm.4
src/sys/dev/pci: files.pci

Log Message:
make kernel config flag WM_EVENT_COUNTERS.

suggested by msaitoh@n.o.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/share/man/man4/wm.4
cvs rdiff -u -r1.386 -r1.387 src/sys/dev/pci/files.pci

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

Modified files:

Index: src/share/man/man4/wm.4
diff -u src/share/man/man4/wm.4:1.33 src/share/man/man4/wm.4:1.34
--- src/share/man/man4/wm.4:1.33	Fri Mar  3 11:36:20 2017
+++ src/share/man/man4/wm.4	Wed Mar 22 03:32:09 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: wm.4,v 1.33 2017/03/03 11:36:20 wiz Exp $
+.\"	$NetBSD: wm.4,v 1.34 2017/03/22 03:32:09 knakahara Exp $
 .\"
 .\" Copyright 2002, 2003 Wasabi Systems, Inc.
 .\" All rights reserved.
@@ -33,7 +33,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd March 3, 2017
+.Dd March 22, 2017
 .Dt WM 4
 .Os
 .Sh NAME
@@ -191,6 +191,11 @@ The value range is from zero to
 The default value is 0.
 When you increase this value, both the receive latency and
 the receive throughput will decrease.
+.It Dv WM_EVENT_COUNTERS
+Enable many event counters such as each Tx drop counter and Rx intrrupt
+counter.
+Caution: If this flag is enabled, the number of evcnt entries increase
+very much.
 .El
 .Pp
 Setting

Index: src/sys/dev/pci/files.pci
diff -u src/sys/dev/pci/files.pci:1.386 src/sys/dev/pci/files.pci:1.387
--- src/sys/dev/pci/files.pci:1.386	Fri Mar  3 07:38:52 2017
+++ src/sys/dev/pci/files.pci	Wed Mar 22 03:32:09 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.pci,v 1.386 2017/03/03 07:38:52 knakahara Exp $
+#	$NetBSD: files.pci,v 1.387 2017/03/22 03:32:09 knakahara Exp $
 #
 # Config file and device description for machine-independent PCI code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -690,6 +690,7 @@ file	dev/pci/ixgbe/ixv.c		ixv
 device	wm: ether, ifnet, arp, mii, mii_bitbang
 attach	wm at pci
 file	dev/pci/if_wm.c			wm
+defflag	opt_if_wm.h	WM_EVENT_COUNTERS
 defparam opt_if_wm.h	WM_RX_PROCESS_LIMIT_DEFAULT
 			WM_RX_INTR_PROCESS_LIMIT_DEFAULT
 



CVS commit: src

2017-03-21 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Mar 22 03:32:09 UTC 2017

Modified Files:
src/share/man/man4: wm.4
src/sys/dev/pci: files.pci

Log Message:
make kernel config flag WM_EVENT_COUNTERS.

suggested by msaitoh@n.o.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/share/man/man4/wm.4
cvs rdiff -u -r1.386 -r1.387 src/sys/dev/pci/files.pci

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



CVS commit: src/sys/dev/pci

2017-03-21 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Mar 22 02:56:12 UTC 2017

Modified Files:
src/sys/dev/pci: if_wm.c

Log Message:
missing M_CSUM_IPv4 checking. It does not cause problems, but it is wrong.

The implementations of M_CSUM_DATA_IPv4_IPHL() and M_CSUM_DATA_IPv6_HL()
is the same, so that does not cause problems.


To generate a diff of this commit:
cvs rdiff -u -r1.498 -r1.499 src/sys/dev/pci/if_wm.c

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.498 src/sys/dev/pci/if_wm.c:1.499
--- src/sys/dev/pci/if_wm.c:1.498	Tue Mar 21 10:39:52 2017
+++ src/sys/dev/pci/if_wm.c	Wed Mar 22 02:56:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.498 2017/03/21 10:39:52 knakahara Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.499 2017/03/22 02:56:12 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.498 2017/03/21 10:39:52 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.499 2017/03/22 02:56:12 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -6442,7 +6442,7 @@ wm_tx_offload(struct wm_softc *sc, struc
 	}
 
 	if ((m0->m_pkthdr.csum_flags &
-	(M_CSUM_TSOv4 | M_CSUM_UDPv4 | M_CSUM_TCPv4)) != 0) {
+	(M_CSUM_TSOv4 | M_CSUM_UDPv4 | M_CSUM_TCPv4 | M_CSUM_IPv4)) != 0) {
 		iphl = M_CSUM_DATA_IPv4_IPHL(m0->m_pkthdr.csum_data);
 	} else {
 		iphl = M_CSUM_DATA_IPv6_HL(m0->m_pkthdr.csum_data);



CVS commit: src/sys/dev/pci

2017-03-21 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Mar 22 02:56:12 UTC 2017

Modified Files:
src/sys/dev/pci: if_wm.c

Log Message:
missing M_CSUM_IPv4 checking. It does not cause problems, but it is wrong.

The implementations of M_CSUM_DATA_IPv4_IPHL() and M_CSUM_DATA_IPv6_HL()
is the same, so that does not cause problems.


To generate a diff of this commit:
cvs rdiff -u -r1.498 -r1.499 src/sys/dev/pci/if_wm.c

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



CVS commit: src/tests/lib/libutil

2017-03-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Mar 22 01:50:22 UTC 2017

Modified Files:
src/tests/lib/libutil: t_parsedate.c

Log Message:
Add tests for "12 noon", "12 midnight".


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/tests/lib/libutil/t_parsedate.c

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

Modified files:

Index: src/tests/lib/libutil/t_parsedate.c
diff -u src/tests/lib/libutil/t_parsedate.c:1.28 src/tests/lib/libutil/t_parsedate.c:1.29
--- src/tests/lib/libutil/t_parsedate.c:1.28	Wed Mar 22 01:00:19 2017
+++ src/tests/lib/libutil/t_parsedate.c	Wed Mar 22 01:50:22 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: t_parsedate.c,v 1.28 2017/03/22 01:00:19 kre Exp $ */
+/* $NetBSD: t_parsedate.c,v 1.29 2017/03/22 01:50:22 kre Exp $ */
 /*-
  * Copyright (c) 2010, 2015 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_parsedate.c,v 1.28 2017/03/22 01:00:19 kre Exp $");
+__RCSID("$NetBSD: t_parsedate.c,v 1.29 2017/03/22 01:50:22 kre Exp $");
 
 #include 
 #include 
@@ -210,6 +210,24 @@ ATF_TC_BODY(times, tc)
 		ANY, ANY, ANY, 12, 0, 0);
 
 	/* end 52010 bug tests */
+
+	parsecheck("12 noon", NULL, NULL, localtime_r,
+		ANY, ANY, ANY, 12, 0, 0);
+	parsecheck("12 midnight", NULL, NULL, localtime_r,
+		ANY, ANY, ANY, 0, 0, 0);
+	parsecheck("12 midday", NULL, NULL, localtime_r,	/* unlikely! */
+		ANY, ANY, ANY, 12, 0, 0);
+	parsecheck("12 mn", NULL, NULL, localtime_r,
+		ANY, ANY, ANY, 0, 0, 0);
+
+	parsecheck("12:00 noon", NULL, NULL, localtime_r,
+		ANY, ANY, ANY, 12, 0, 0);
+	parsecheck("12:00 midnight", NULL, NULL, localtime_r,
+		ANY, ANY, ANY, 0, 0, 0);
+	parsecheck("12:00:00 noon", NULL, NULL, localtime_r,
+		ANY, ANY, ANY, 12, 0, 0);
+	parsecheck("12:00:00 midnight", NULL, NULL, localtime_r,
+		ANY, ANY, ANY, 0, 0, 0);
 }
 
 ATF_TC(dsttimes);



CVS commit: src/tests/lib/libutil

2017-03-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Mar 22 01:50:22 UTC 2017

Modified Files:
src/tests/lib/libutil: t_parsedate.c

Log Message:
Add tests for "12 noon", "12 midnight".


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/tests/lib/libutil/t_parsedate.c

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



CVS commit: src/lib/libutil

2017-03-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Mar 22 01:49:37 UTC 2017

Modified Files:
src/lib/libutil: parsedate.3 parsedate.y

Log Message:
Make parsedate handle "12 noon" and "12 midnight" (including when
the time is "12:00" or "12:00:00) - but only for exactly 12 o'clock.
"12:00:01" is am or pm, not noon or midnight.

"12 am" remains as an alias for "12 midnight", and "12 pm" for midnight,
though both are strictly invalid (and meaningless.)

Note that "12 pm" means 00:00:00 (ie: midnight at the start of the
day, not at the end.)


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/lib/libutil/parsedate.3
cvs rdiff -u -r1.30 -r1.31 src/lib/libutil/parsedate.y

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

Modified files:

Index: src/lib/libutil/parsedate.3
diff -u src/lib/libutil/parsedate.3:1.22 src/lib/libutil/parsedate.3:1.23
--- src/lib/libutil/parsedate.3:1.22	Fri Dec 23 06:01:41 2016
+++ src/lib/libutil/parsedate.3	Wed Mar 22 01:49:36 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: parsedate.3,v 1.22 2016/12/23 06:01:41 abhinav Exp $
+.\" $NetBSD: parsedate.3,v 1.23 2017/03/22 01:49:36 kre Exp $
 .\"
 .\" Copyright (c) 2006 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd December 7, 2015
+.Dd March 22, 2017
 .Dt PARSEDATE 3
 .Os
 .Sh NAME
@@ -393,9 +393,21 @@ otherwise
 years less than 100 mean 1900 +
 .Fa year .
 .It 3
+The
+.Fn parsedate
+function accepts
+.Dq "12 am"
+where
+.Dq "12 midnight"
+is correct, and similarly
+.Dq "12 pm"
+for
+.Dq "12 noon" .
+The correct forms are also accepted.
+.It 4
 There are various weird cases that are hard to explain,
 but are nevertheless considered correct.
-.It 4
+.It 5
 It is very hard to specify years BC,
 and in any case,
 conversions of times before the

Index: src/lib/libutil/parsedate.y
diff -u src/lib/libutil/parsedate.y:1.30 src/lib/libutil/parsedate.y:1.31
--- src/lib/libutil/parsedate.y:1.30	Wed Mar 22 00:59:06 2017
+++ src/lib/libutil/parsedate.y	Wed Mar 22 01:49:36 2017
@@ -14,7 +14,7 @@
 
 #include 
 #ifdef __RCSID
-__RCSID("$NetBSD: parsedate.y,v 1.30 2017/03/22 00:59:06 kre Exp $");
+__RCSID("$NetBSD: parsedate.y,v 1.31 2017/03/22 01:49:36 kre Exp $");
 #endif
 
 #include 
@@ -64,10 +64,10 @@ typedef enum _DSTMODE {
 } DSTMODE;
 
 /*
-**  Meridian:  am, pm, or 24-hour style.
+**  Meridian:  am, pm, or 24-hour style (plus "noon" and "midnight").
 */
 typedef enum _MERIDIAN {
-MERam, MERpm, MER24
+MERam, MERpm, MER24, MER_NOON, MER_MN
 } MERIDIAN;
 
 
@@ -191,22 +191,58 @@ at_number:
 
 time:
 	  tUNUMBER tMERIDIAN {
-		param->yyHour = $1;
 		param->yyMinutes = 0;
 		param->yySeconds = 0;
-		param->yyMeridian = $2;
+		if ($2 == MER_NOON || $2 == MER_MN) {
+			if ($1 == 12) {
+switch ($2) {
+case MER_NOON: param->yyHour = 12; break;
+case MER_MN  : param->yyHour = 0;  break;
+default:	/* impossible */;  break;
+}
+param->yyMeridian = MER24;
+			} else
+YYREJECT;
+		} else {
+			param->yyHour = $1;
+			param->yyMeridian = $2;
+		}
 	  }
 	| tUNUMBER ':' tUNUMBER o_merid {
-		param->yyHour = $1;
 		param->yyMinutes = $3;
 		param->yySeconds = 0;
-		param->yyMeridian = $4;
+		if ($4 == MER_NOON || $4 == MER_MN) {
+			if ($1 == 12 && $3 == 0) {
+switch ($4) {
+case MER_NOON: param->yyHour = 12; break;
+case MER_MN  : param->yyHour = 0;  break;
+default:	/* impossible */;  break;
+}
+param->yyMeridian = MER24;
+			} else
+YYREJECT;
+		} else {
+			param->yyHour = $1;
+			param->yyMeridian = $4;
+		}
 	  }
 	| tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid {
-		param->yyHour = $1;
 		param->yyMinutes = $3;
 		param->yySeconds = $5;
-		param->yyMeridian = $6;
+		if ($6 == MER_NOON || $6 == MER_MN) {
+			if ($1 == 12 && $3 == 0 && $5 == 0) {
+switch ($6) {
+case MER_NOON: param->yyHour = 12; break;
+case MER_MN  : param->yyHour = 0;  break;
+default:	/* impossible */;  break;
+}
+param->yyMeridian = MER24;
+			} else
+YYREJECT;
+		} else {
+			param->yyHour = $1;
+			param->yyMeridian = $6;
+		}
 	  }
 	| tUNUMBER ':' tUNUMBER ':' tUNUMBER '.' tUNUMBER {
 		param->yyHour = $1;
@@ -223,7 +259,16 @@ time:
 		/* Tues midnight --> Weds 00:00, midnight Tues -> Tues 00:00 */
 		if ($1 == 0 && param->yyHaveDay)
 			param->yyDayNumber++;
-	}
+	  }
+	| tUNUMBER tTIME {
+		if ($1 == 12 && ($2 == 0 || $2 == 12)) {
+			param->yyHour = $2;
+			param->yyMinutes = 0;
+			param->yySeconds = 0;
+			param->yyMeridian = MER24;
+		} else
+			YYREJECT;
+	  }
 ;
 
 time_numericzone:
@@ -362,6 +407,7 @@ number:
 o_merid:
 	  /* empty */		{ $$ = MER24; }
 	| tMERIDIAN		{ $$ = $1; }
+	| tTIME			{ $$ = $1 == 0 ? MER_MN : MER_NOON; }
 ;
 
 %%



CVS commit: src/lib/libutil

2017-03-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Mar 22 01:49:37 UTC 2017

Modified Files:
src/lib/libutil: parsedate.3 parsedate.y

Log Message:
Make parsedate handle "12 noon" and "12 midnight" (including when
the time is "12:00" or "12:00:00) - but only for exactly 12 o'clock.
"12:00:01" is am or pm, not noon or midnight.

"12 am" remains as an alias for "12 midnight", and "12 pm" for midnight,
though both are strictly invalid (and meaningless.)

Note that "12 pm" means 00:00:00 (ie: midnight at the start of the
day, not at the end.)


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/lib/libutil/parsedate.3
cvs rdiff -u -r1.30 -r1.31 src/lib/libutil/parsedate.y

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



CVS commit: src/tests/lib/libutil

2017-03-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Mar 22 01:00:19 UTC 2017

Modified Files:
src/tests/lib/libutil: t_parsedate.c

Log Message:
Since PR lib/52101 is now fixed, the tests for its bug should no longer fail.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/tests/lib/libutil/t_parsedate.c

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

Modified files:

Index: src/tests/lib/libutil/t_parsedate.c
diff -u src/tests/lib/libutil/t_parsedate.c:1.27 src/tests/lib/libutil/t_parsedate.c:1.28
--- src/tests/lib/libutil/t_parsedate.c:1.27	Tue Mar 21 21:42:18 2017
+++ src/tests/lib/libutil/t_parsedate.c	Wed Mar 22 01:00:19 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: t_parsedate.c,v 1.27 2017/03/21 21:42:18 kre Exp $ */
+/* $NetBSD: t_parsedate.c,v 1.28 2017/03/22 01:00:19 kre Exp $ */
 /*-
  * Copyright (c) 2010, 2015 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_parsedate.c,v 1.27 2017/03/21 21:42:18 kre Exp $");
+__RCSID("$NetBSD: t_parsedate.c,v 1.28 2017/03/22 01:00:19 kre Exp $");
 
 #include 
 #include 
@@ -184,7 +184,12 @@ ATF_TC_BODY(times, tc)
 	parsecheck("noon", NULL, NULL, localtime_r,
 		ANY, ANY, ANY, 12, 0, 0);
 
+	/*
+	 * The following tests used to trigger the bug from PR lib/52101
+	 * but that is fixed now.
+	 *
 	atf_tc_expect_fail("PR lib/52101");
+	 */
 
 	parsecheck("12:30 am", NULL, NULL, localtime_r,
 		ANY, ANY, ANY, 0, 30, 0);
@@ -203,6 +208,8 @@ ATF_TC_BODY(times, tc)
 		ANY, ANY, ANY, 0, 0, 0);
 	parsecheck("12pm", NULL, NULL, localtime_r,
 		ANY, ANY, ANY, 12, 0, 0);
+
+	/* end 52010 bug tests */
 }
 
 ATF_TC(dsttimes);



CVS commit: src/tests/lib/libutil

2017-03-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Mar 22 01:00:19 UTC 2017

Modified Files:
src/tests/lib/libutil: t_parsedate.c

Log Message:
Since PR lib/52101 is now fixed, the tests for its bug should no longer fail.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/tests/lib/libutil/t_parsedate.c

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



CVS commit: src/lib/libutil

2017-03-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Mar 22 00:59:06 UTC 2017

Modified Files:
src/lib/libutil: parsedate.y

Log Message:
Fix PR lib/52101 -- 12:30 am is 00:30:00 and 12:30 pm is 12:30:00


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/lib/libutil/parsedate.y

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

Modified files:

Index: src/lib/libutil/parsedate.y
diff -u src/lib/libutil/parsedate.y:1.29 src/lib/libutil/parsedate.y:1.30
--- src/lib/libutil/parsedate.y:1.29	Sun Jun 26 07:09:24 2016
+++ src/lib/libutil/parsedate.y	Wed Mar 22 00:59:06 2017
@@ -14,7 +14,7 @@
 
 #include 
 #ifdef __RCSID
-__RCSID("$NetBSD: parsedate.y,v 1.29 2016/06/26 07:09:24 kre Exp $");
+__RCSID("$NetBSD: parsedate.y,v 1.30 2017/03/22 00:59:06 kre Exp $");
 #endif
 
 #include 
@@ -654,7 +654,9 @@ Convert(
 
 tm.tm_sec = Seconds;
 tm.tm_min = Minutes;
-tm.tm_hour = Hours + (Meridian == MERpm ? 12 : 0);
+tm.tm_hour = ((Hours == 12 && Meridian != MER24) ? 0 : Hours) +
+	(Meridian == MERpm ? 12 : 0);
+
 tm.tm_mday = Day;
 tm.tm_mon = Month - 1;
 tm.tm_year = Year - 1900;



CVS commit: src/lib/libutil

2017-03-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Mar 22 00:59:06 UTC 2017

Modified Files:
src/lib/libutil: parsedate.y

Log Message:
Fix PR lib/52101 -- 12:30 am is 00:30:00 and 12:30 pm is 12:30:00


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/lib/libutil/parsedate.y

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



CVS commit: src/etc

2017-03-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar 21 22:52:10 UTC 2017

Modified Files:
src/etc: rc.subr

Log Message:
Clear rc variables that contain state that is gone after the boot process
is complete, so that scripts invoked from powerd don't think that they
are still invoked by the rc system and fail.
Reported by rudolf @ tech-userlevel


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/etc/rc.subr

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

Modified files:

Index: src/etc/rc.subr
diff -u src/etc/rc.subr:1.98 src/etc/rc.subr:1.99
--- src/etc/rc.subr:1.98	Sun Mar  6 13:49:42 2016
+++ src/etc/rc.subr	Tue Mar 21 18:52:10 2017
@@ -1,4 +1,4 @@
-# $NetBSD: rc.subr,v 1.98 2016/03/06 18:49:42 christos Exp $
+# $NetBSD: rc.subr,v 1.99 2017/03/21 22:52:10 christos Exp $
 #
 # Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -36,6 +36,15 @@
 nl='
 ' # a literal newline
 
+# RC variables to clear on start.
+_env_clear_rc_vars="
+RC_PID=
+_rc_pid=
+_rc_original_stdout_fd=
+_rc_original_stderr_fd=
+_rc_postprocessor_fd=
+"
+
 #
 #	functions
 #	-
@@ -665,14 +674,14 @@ EOF
 			echo "Starting ${name}."
 			if [ -n "$_chroot" ]; then
 _doit="\
-${_env:+env $_env }\
+env $_env_clear_rc_vars $_env \
 ${_nice:+nice -n $_nice }\
 chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\
 $_chroot $command $rc_flags $command_args"
 			else
 _doit="\
 ${_chdir:+cd $_chdir; }\
-${_env:+env $_env }\
+env $_env_clear_rc_vars $_env \
 ${_nice:+nice -n $_nice }\
 $command $rc_flags $command_args"
 if [ -n "$_user" ]; then



CVS commit: src/tests/lib/libutil

2017-03-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Mar 21 21:42:18 UTC 2017

Modified Files:
src/tests/lib/libutil: t_parsedate.c

Log Message:
Fix a typo - it doesn't matter now, as the test fails anyway, but
it will matter when parsedate is fixed and the test is supposed to
succeed.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/tests/lib/libutil/t_parsedate.c

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



CVS commit: src/tests/lib/libutil

2017-03-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Mar 21 21:42:18 UTC 2017

Modified Files:
src/tests/lib/libutil: t_parsedate.c

Log Message:
Fix a typo - it doesn't matter now, as the test fails anyway, but
it will matter when parsedate is fixed and the test is supposed to
succeed.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/tests/lib/libutil/t_parsedate.c

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

Modified files:

Index: src/tests/lib/libutil/t_parsedate.c
diff -u src/tests/lib/libutil/t_parsedate.c:1.26 src/tests/lib/libutil/t_parsedate.c:1.27
--- src/tests/lib/libutil/t_parsedate.c:1.26	Tue Mar 21 20:06:27 2017
+++ src/tests/lib/libutil/t_parsedate.c	Tue Mar 21 21:42:18 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: t_parsedate.c,v 1.26 2017/03/21 20:06:27 kre Exp $ */
+/* $NetBSD: t_parsedate.c,v 1.27 2017/03/21 21:42:18 kre Exp $ */
 /*-
  * Copyright (c) 2010, 2015 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_parsedate.c,v 1.26 2017/03/21 20:06:27 kre Exp $");
+__RCSID("$NetBSD: t_parsedate.c,v 1.27 2017/03/21 21:42:18 kre Exp $");
 
 #include 
 #include 
@@ -189,7 +189,7 @@ ATF_TC_BODY(times, tc)
 	parsecheck("12:30 am", NULL, NULL, localtime_r,
 		ANY, ANY, ANY, 0, 30, 0);
 	parsecheck("12:30 pm", NULL, NULL, localtime_r,
-		ANY, ANY, ANY, 12, 20, 0);
+		ANY, ANY, ANY, 12, 30, 0);
 
 	/*
 	 * Technically, these are invalid, noon and midnight



CVS commit: src/tests/lib/libutil

2017-03-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Mar 21 20:06:27 UTC 2017

Modified Files:
src/tests/lib/libutil: t_parsedate.c

Log Message:
PR lib/52101

Add 6 extra tests for the 12am/12pm bug - all currently expected to fail.
(That is, 6 subtests of the "times" test will fail, all new ones)>

While here, when parsedate() fails (returns -1) avoid converting that
failure value (-1) to a struct tm (1969-12-31T23:59:59 UTC) and then
comparing the values with those expected by the test, and complaining
about all of those (where ANY was not permitted) that don't match...


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/tests/lib/libutil/t_parsedate.c

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

Modified files:

Index: src/tests/lib/libutil/t_parsedate.c
diff -u src/tests/lib/libutil/t_parsedate.c:1.25 src/tests/lib/libutil/t_parsedate.c:1.26
--- src/tests/lib/libutil/t_parsedate.c:1.25	Wed Jun 22 15:01:38 2016
+++ src/tests/lib/libutil/t_parsedate.c	Tue Mar 21 20:06:27 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: t_parsedate.c,v 1.25 2016/06/22 15:01:38 kre Exp $ */
+/* $NetBSD: t_parsedate.c,v 1.26 2017/03/21 20:06:27 kre Exp $ */
 /*-
  * Copyright (c) 2010, 2015 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_parsedate.c,v 1.25 2016/06/22 15:01:38 kre Exp $");
+__RCSID("$NetBSD: t_parsedate.c,v 1.26 2017/03/21 20:06:27 kre Exp $");
 
 #include 
 #include 
@@ -84,6 +84,9 @@ parsecheck(const char *datestr, const ti
 
 	ATF_CHECK_MSG((t = parsedate(datestr, reftime, zoff)) != -1,
 	"parsedate(%s) returned -1\n", argstr);
+	if (t == -1)
+		return;
+
 	ATF_CHECK(time_to_tm(, ) != NULL);
 	if (year != ANY)
 		ATF_CHECK_MSG(tm.tm_year + 1900 == year,
@@ -180,6 +183,26 @@ ATF_TC_BODY(times, tc)
 		ANY, ANY, ANY, 0, 0, 0);
 	parsecheck("noon", NULL, NULL, localtime_r,
 		ANY, ANY, ANY, 12, 0, 0);
+
+	atf_tc_expect_fail("PR lib/52101");
+
+	parsecheck("12:30 am", NULL, NULL, localtime_r,
+		ANY, ANY, ANY, 0, 30, 0);
+	parsecheck("12:30 pm", NULL, NULL, localtime_r,
+		ANY, ANY, ANY, 12, 20, 0);
+
+	/*
+	 * Technically, these are invalid, noon and midnight
+	 * are neither am, nor pm, but this is what people expect...
+	 */
+	parsecheck("12:00:00 am", NULL, NULL, localtime_r,
+		ANY, ANY, ANY, 0, 0, 0);
+	parsecheck("12:00:00 pm", NULL, NULL, localtime_r,
+		ANY, ANY, ANY, 12, 0, 0);
+	parsecheck("12am", NULL, NULL, localtime_r,
+		ANY, ANY, ANY, 0, 0, 0);
+	parsecheck("12pm", NULL, NULL, localtime_r,
+		ANY, ANY, ANY, 12, 0, 0);
 }
 
 ATF_TC(dsttimes);



CVS commit: src/tests/lib/libutil

2017-03-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Mar 21 20:06:27 UTC 2017

Modified Files:
src/tests/lib/libutil: t_parsedate.c

Log Message:
PR lib/52101

Add 6 extra tests for the 12am/12pm bug - all currently expected to fail.
(That is, 6 subtests of the "times" test will fail, all new ones)>

While here, when parsedate() fails (returns -1) avoid converting that
failure value (-1) to a struct tm (1969-12-31T23:59:59 UTC) and then
comparing the values with those expected by the test, and complaining
about all of those (where ANY was not permitted) that don't match...


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/tests/lib/libutil/t_parsedate.c

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



CVS commit: src/doc

2017-03-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Mar 21 19:26:40 UTC 2017

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
tzdata updated to 2017b.


To generate a diff of this commit:
cvs rdiff -u -r1.1424 -r1.1425 src/doc/3RDPARTY
cvs rdiff -u -r1.2265 -r1.2266 src/doc/CHANGES

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1424 src/doc/3RDPARTY:1.1425
--- src/doc/3RDPARTY:1.1424	Sat Mar 18 15:25:40 2017
+++ src/doc/3RDPARTY	Tue Mar 21 19:26:40 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1424 2017/03/18 15:25:40 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.1425 2017/03/21 19:26:40 kre Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1412,8 +1412,8 @@ Notes:
 Added changes from a5 -> a12 manually.
 
 Package:	tz
-Version:	tzcode2017a / tzdata2017a
-Current Vers:	tzcode2017a / tzdata2017a
+Version:	tzcode2017a / tzdata2017b
+Current Vers:	tzcode2017b / tzdata2017b
 Maintainer:	Paul Eggert <egg...@cs.ucla.edu>
 Archive Site:	ftp://ftp.iana.org/tz/releases/
 Archive Site:	ftp://munnari.oz.au/pub/oldtz/

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2265 src/doc/CHANGES:1.2266
--- src/doc/CHANGES:1.2265	Mon Mar 20 12:16:07 2017
+++ src/doc/CHANGES	Tue Mar 21 19:26:40 2017
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2265 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2266 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -491,3 +491,4 @@ Changes from NetBSD 7.0 to NetBSD 8.0:
 	sh(1): Arithmetic parser imported from dash (via FreeBSD)
 		adding support for all required operators, as well
 		as being smaller and faster.  [kre 20170320]
+	zoneinfo: Import tzdata2017b.  [kre 20170321]



CVS commit: src/doc

2017-03-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Mar 21 19:26:40 UTC 2017

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
tzdata updated to 2017b.


To generate a diff of this commit:
cvs rdiff -u -r1.1424 -r1.1425 src/doc/3RDPARTY
cvs rdiff -u -r1.2265 -r1.2266 src/doc/CHANGES

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



CVS commit: src/external/public-domain/tz/dist

2017-03-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Mar 21 19:24:22 UTC 2017

Modified Files:
src/external/public-domain/tz/dist: TZDATA_VERSION

Log Message:
Merge tzdata2017b


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/public-domain/tz/dist/TZDATA_VERSION

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

Modified files:

Index: src/external/public-domain/tz/dist/TZDATA_VERSION
diff -u src/external/public-domain/tz/dist/TZDATA_VERSION:1.7 src/external/public-domain/tz/dist/TZDATA_VERSION:1.8
--- src/external/public-domain/tz/dist/TZDATA_VERSION:1.7	Wed Mar  1 00:38:15 2017
+++ src/external/public-domain/tz/dist/TZDATA_VERSION	Tue Mar 21 19:24:22 2017
@@ -1 +1 @@
-tzdata-2017a
+tzdata-2017b



CVS commit: src/external/public-domain/tz/dist

2017-03-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Mar 21 19:24:22 UTC 2017

Modified Files:
src/external/public-domain/tz/dist: TZDATA_VERSION

Log Message:
Merge tzdata2017b


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/public-domain/tz/dist/TZDATA_VERSION

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



CVS import: src/external/public-domain/tz/dist

2017-03-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Mar 21 19:22:57 UTC 2017

Update of /cvsroot/src/external/public-domain/tz/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv7621

Log Message:
Import tzdata2017b from ftp://ftp.iana.org/tz/releases/tzdata2017b.tar.gz

Summary of changes in tzdata2017b (2017-03-17 07:30:38 -0700):
Haiti resumed observance of DST in 2017 (on Mar 12)

Liberia changed from -004430 to +00 on 1972-01-07, not 1972-05-01.
Use "MMT" to abbreviate Liberia's time zone before 1972,
as "-004430" (tzdata2016a) is one byte over the POSIX limit.

Status:

Vendor Tag: TZDATA
Release Tags:   TZDATA2017B

U src/external/public-domain/tz/dist/leap-seconds.list
U src/external/public-domain/tz/dist/CONTRIBUTING
U src/external/public-domain/tz/dist/LICENSE
U src/external/public-domain/tz/dist/Makefile
U src/external/public-domain/tz/dist/NEWS
U src/external/public-domain/tz/dist/README
U src/external/public-domain/tz/dist/Theory
U src/external/public-domain/tz/dist/version
U src/external/public-domain/tz/dist/africa
U src/external/public-domain/tz/dist/antarctica
U src/external/public-domain/tz/dist/asia
U src/external/public-domain/tz/dist/australasia
U src/external/public-domain/tz/dist/europe
U src/external/public-domain/tz/dist/northamerica
U src/external/public-domain/tz/dist/southamerica
U src/external/public-domain/tz/dist/pacificnew
U src/external/public-domain/tz/dist/etcetera
U src/external/public-domain/tz/dist/backward
U src/external/public-domain/tz/dist/systemv
U src/external/public-domain/tz/dist/factory
U src/external/public-domain/tz/dist/backzone
U src/external/public-domain/tz/dist/iso3166.tab
U src/external/public-domain/tz/dist/leapseconds
U src/external/public-domain/tz/dist/zone1970.tab
U src/external/public-domain/tz/dist/zone.tab
U src/external/public-domain/tz/dist/yearistype.sh
U src/external/public-domain/tz/dist/checklinks.awk
U src/external/public-domain/tz/dist/checktab.awk
U src/external/public-domain/tz/dist/leapseconds.awk
U src/external/public-domain/tz/dist/zoneinfo2tdf.pl

No conflicts created by this import



CVS import: src/external/public-domain/tz/dist

2017-03-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Mar 21 19:22:57 UTC 2017

Update of /cvsroot/src/external/public-domain/tz/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv7621

Log Message:
Import tzdata2017b from ftp://ftp.iana.org/tz/releases/tzdata2017b.tar.gz

Summary of changes in tzdata2017b (2017-03-17 07:30:38 -0700):
Haiti resumed observance of DST in 2017 (on Mar 12)

Liberia changed from -004430 to +00 on 1972-01-07, not 1972-05-01.
Use "MMT" to abbreviate Liberia's time zone before 1972,
as "-004430" (tzdata2016a) is one byte over the POSIX limit.

Status:

Vendor Tag: TZDATA
Release Tags:   TZDATA2017B

U src/external/public-domain/tz/dist/leap-seconds.list
U src/external/public-domain/tz/dist/CONTRIBUTING
U src/external/public-domain/tz/dist/LICENSE
U src/external/public-domain/tz/dist/Makefile
U src/external/public-domain/tz/dist/NEWS
U src/external/public-domain/tz/dist/README
U src/external/public-domain/tz/dist/Theory
U src/external/public-domain/tz/dist/version
U src/external/public-domain/tz/dist/africa
U src/external/public-domain/tz/dist/antarctica
U src/external/public-domain/tz/dist/asia
U src/external/public-domain/tz/dist/australasia
U src/external/public-domain/tz/dist/europe
U src/external/public-domain/tz/dist/northamerica
U src/external/public-domain/tz/dist/southamerica
U src/external/public-domain/tz/dist/pacificnew
U src/external/public-domain/tz/dist/etcetera
U src/external/public-domain/tz/dist/backward
U src/external/public-domain/tz/dist/systemv
U src/external/public-domain/tz/dist/factory
U src/external/public-domain/tz/dist/backzone
U src/external/public-domain/tz/dist/iso3166.tab
U src/external/public-domain/tz/dist/leapseconds
U src/external/public-domain/tz/dist/zone1970.tab
U src/external/public-domain/tz/dist/zone.tab
U src/external/public-domain/tz/dist/yearistype.sh
U src/external/public-domain/tz/dist/checklinks.awk
U src/external/public-domain/tz/dist/checktab.awk
U src/external/public-domain/tz/dist/leapseconds.awk
U src/external/public-domain/tz/dist/zoneinfo2tdf.pl

No conflicts created by this import



CVS commit: src/usr.bin/vndcompress

2017-03-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Mar 21 13:56:38 UTC 2017

Modified Files:
src/usr.bin/vndcompress: utils.c

Log Message:
Simplify.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/vndcompress/utils.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.bin/vndcompress/utils.c
diff -u src/usr.bin/vndcompress/utils.c:1.5 src/usr.bin/vndcompress/utils.c:1.6
--- src/usr.bin/vndcompress/utils.c:1.5	Thu Apr  7 23:29:59 2016
+++ src/usr.bin/vndcompress/utils.c	Tue Mar 21 13:56:38 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: utils.c,v 1.5 2016/04/07 23:29:59 riastradh Exp $	*/
+/*	$NetBSD: utils.c,v 1.6 2017/03/21 13:56:38 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: utils.c,v 1.5 2016/04/07 23:29:59 riastradh Exp $");
+__RCSID("$NetBSD: utils.c,v 1.6 2017/03/21 13:56:38 riastradh Exp $");
 
 #include 
 
@@ -59,31 +59,23 @@ int	vsnprintf_ss(char *restrict, size_t,
  * Read, returning partial data only at end of file.
  */
 ssize_t
-read_block(int fd, void *buffer, size_t n)
+read_block(int fd, void *buf, size_t len)
 {
-	char *p = buffer, *const end __diagused = (p + n);
-	size_t total_read = 0;
+	char *p = buf;
+	size_t n = len;
+	const char *const end __diagused = p + n;
+	ssize_t nread = 0;
 
-	while (n > 0) {
-		const ssize_t n_read = read(fd, p, n);
-		if (n_read == -1)
+	while (0 < n && (nread = read(fd, p, n)) != 0) {
+		if (nread == -1)
 			return -1;
-		assert(n_read >= 0);
-		if (n_read == 0)
-			break;
-
-		assert((size_t)n_read <= n);
-		n -= (size_t)n_read;
-
-		assert(p <= end);
-		assert(n_read <= (end - p));
-		p += (size_t)n_read;
-
-		assert((size_t)n_read <= (SIZE_MAX - total_read));
-		total_read += (size_t)n_read;
+		p += MIN(n, (size_t)nread);
+		n -= MIN(n, (size_t)nread);
+		assert(p + n == end);
 	}
 
-	return total_read;
+	assert(n == 0 || nread == 0); /* complete read or EOF */
+	return len - n;
 }
 
 /*
@@ -91,35 +83,29 @@ read_block(int fd, void *buffer, size_t 
  * of file.
  */
 ssize_t
-pread_block(int fd, void *buffer, size_t n, off_t fdpos)
+pread_block(int fd, void *buf, size_t len, off_t fdpos)
 {
-	char *p = buffer, *const end __diagused = (p + n);
-	size_t total_read = 0;
+	char *p = buf;
+	size_t n = len;
+	const char *const end __diagused = p + n;
+	ssize_t nread = 0;
 
 	assert(0 <= fdpos);
-	assert(n <= (OFF_MAX - (uintmax_t)fdpos));
+	assert(n <= OFF_MAX - (uintmax_t)fdpos);
+	const off_t endpos __diagused = fdpos + n;
 
-	while (n > 0) {
-		assert(total_read <= n);
-		const ssize_t n_read = pread(fd, p, n, (fdpos + total_read));
-		if (n_read == -1)
+	while (0 < n && (nread = pread(fd, p, n, fdpos)) != 0) {
+		if (nread == -1)
 			return -1;
-		assert(n_read >= 0);
-		if (n_read == 0)
-			break;
-
-		assert((size_t)n_read <= n);
-		n -= (size_t)n_read;
-
-		assert(p <= end);
-		assert(n_read <= (end - p));
-		p += (size_t)n_read;
-
-		assert((size_t)n_read <= (SIZE_MAX - total_read));
-		total_read += (size_t)n_read;
+		fdpos += MIN(n, (size_t)nread);
+		p += MIN(n, (size_t)nread);
+		n -= MIN(n, (size_t)nread);
+		assert(p + n == end);
+		assert(fdpos + (off_t)n == endpos);
 	}
 
-	return total_read;
+	assert(n == 0 || nread == 0); /* complete read or EOF */
+	return len - n;
 }
 
 /*



CVS commit: src/external/bsd/unbound

2017-03-21 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Tue Mar 21 13:49:03 UTC 2017

Modified Files:
src/external/bsd/unbound: TODO

Log Message:
Now builds with libevent.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/bsd/unbound/TODO

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



CVS commit: src/external/bsd/unbound

2017-03-21 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Tue Mar 21 13:49:03 UTC 2017

Modified Files:
src/external/bsd/unbound: TODO

Log Message:
Now builds with libevent.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/bsd/unbound/TODO

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

Modified files:

Index: src/external/bsd/unbound/TODO
diff -u src/external/bsd/unbound/TODO:1.1 src/external/bsd/unbound/TODO:1.2
--- src/external/bsd/unbound/TODO:1.1	Sat Aug 20 11:20:31 2016
+++ src/external/bsd/unbound/TODO	Tue Mar 21 13:49:03 2017
@@ -1,4 +1,3 @@
-- consider compiling with libevent
 - convert man pages to mdoc
 - make optional features:
 	- without crypto



CVS commit: src/sys/sys

2017-03-21 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Tue Mar 21 11:54:46 UTC 2017

Modified Files:
src/sys/sys: syslog.h

Log Message:
Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/sys/syslog.h

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

Modified files:

Index: src/sys/sys/syslog.h
diff -u src/sys/sys/syslog.h:1.39 src/sys/sys/syslog.h:1.40
--- src/sys/sys/syslog.h:1.39	Fri Jan 13 05:35:20 2017
+++ src/sys/sys/syslog.h	Tue Mar 21 11:54:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslog.h,v 1.39 2017/01/13 05:35:20 christos Exp $	*/
+/*	$NetBSD: syslog.h,v 1.40 2017/03/21 11:54:46 roy Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1988, 1993
@@ -82,7 +82,7 @@ CODE prioritynames[] = {
 	{ "info",	LOG_INFO },
 	{ "none",	INTERNAL_NOPRI },	/* INTERNAL */
 	{ "notice",	LOG_NOTICE },
-	{ "panic", 	LOG_EMERG },		/* DEPRECATED */
+	{ "panic",	LOG_EMERG },		/* DEPRECATED */
 	{ "warn",	LOG_WARNING },		/* DEPRECATED */
 	{ "warning",	LOG_WARNING },
 	{ NULL,		-1 }
@@ -122,13 +122,13 @@ CODE prioritynames[] = {
 CODE facilitynames[] = {
 	{ "auth",	LOG_AUTH },
 	{ "authpriv",	LOG_AUTHPRIV },
-	{ "cron", 	LOG_CRON },
+	{ "cron",	LOG_CRON },
 	{ "daemon",	LOG_DAEMON },
 	{ "ftp",	LOG_FTP },
 	{ "kern",	LOG_KERN },
 	{ "lpr",	LOG_LPR },
 	{ "mail",	LOG_MAIL },
-	{ "mark", 	INTERNAL_MARK },	/* INTERNAL */
+	{ "mark",	INTERNAL_MARK },	/* INTERNAL */
 	{ "news",	LOG_NEWS },
 	{ "security",	LOG_AUTH },		/* DEPRECATED */
 	{ "syslog",	LOG_SYSLOG },
@@ -179,10 +179,10 @@ struct syslog_data {
 	int	log_connected;
 	int	log_opened;
 	int	log_stat;
-	const char 	*log_tag;
+	const char	*log_tag;
 	char	log_hostname[256];	/* MAXHOSTNAMELEN */
-	int 	log_fac;
-	int 	log_mask;
+	int	log_fac;
+	int	log_mask;
 };
 
 #define SYSLOG_DATA_INIT { \



CVS commit: src/sys/sys

2017-03-21 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Tue Mar 21 11:54:46 UTC 2017

Modified Files:
src/sys/sys: syslog.h

Log Message:
Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/sys/syslog.h

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



Re: CVS commit: src/games/tetris

2017-03-21 Thread Joerg Sonnenberger
On Mon, Mar 20, 2017 at 06:05:27PM -0400, Christos Zoulas wrote:
> Module Name:  src
> Committed By: christos
> Date: Mon Mar 20 22:05:27 UTC 2017
> 
> Modified Files:
>   src/games/tetris: screen.c
> 
> Log Message:
> elide compiler stupidity.

This sounds really wrong to me. What are you trying to do?

Joerg


CVS commit: src/bin/sh

2017-03-21 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Mar 21 10:52:46 UTC 2017

Modified Files:
src/bin/sh: shell.h

Log Message:
Add includes guards since we can include the header twice and typedef
redefinitions are a C11 feature.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/bin/sh/shell.h

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

Modified files:

Index: src/bin/sh/shell.h
diff -u src/bin/sh/shell.h:1.19 src/bin/sh/shell.h:1.20
--- src/bin/sh/shell.h:1.19	Tue May  3 13:47:58 2016
+++ src/bin/sh/shell.h	Tue Mar 21 10:52:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: shell.h,v 1.19 2016/05/03 13:47:58 kre Exp $	*/
+/*	$NetBSD: shell.h,v 1.20 2017/03/21 10:52:46 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -49,6 +49,8 @@
  * a quit signal will generate a core dump.
  */
 
+#ifndef SHELL_H
+#define SHELL_H
 #include 
 
 #define JOBS 1
@@ -83,3 +85,5 @@ extern const char nullstr[1];		/* null s
 #define TRACE(param)
 #define TRACEV(param)
 #endif
+
+#endif /* SHELL_H */



CVS commit: src/bin/sh

2017-03-21 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Mar 21 10:52:46 UTC 2017

Modified Files:
src/bin/sh: shell.h

Log Message:
Add includes guards since we can include the header twice and typedef
redefinitions are a C11 feature.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/bin/sh/shell.h

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



CVS commit: src/sys/kern

2017-03-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Mar 21 10:46:49 UTC 2017

Modified Files:
src/sys/kern: vfs_bio.c

Log Message:
Use brelsel while the bufcache_lock is held rather than dropping it
and re-taking / dropping it in brelse


To generate a diff of this commit:
cvs rdiff -u -r1.270 -r1.271 src/sys/kern/vfs_bio.c

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

Modified files:

Index: src/sys/kern/vfs_bio.c
diff -u src/sys/kern/vfs_bio.c:1.270 src/sys/kern/vfs_bio.c:1.271
--- src/sys/kern/vfs_bio.c:1.270	Sat Mar 18 05:45:48 2017
+++ src/sys/kern/vfs_bio.c	Tue Mar 21 10:46:49 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_bio.c,v 1.270 2017/03/18 05:45:48 riastradh Exp $	*/
+/*	$NetBSD: vfs_bio.c,v 1.271 2017/03/21 10:46:49 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -123,7 +123,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.270 2017/03/18 05:45:48 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.271 2017/03/21 10:46:49 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bufcache.h"
@@ -1230,8 +1230,8 @@ getblk(struct vnode *vp, daddr_t blkno, 
 		if (allocbuf(bp, size, preserve)) {
 			mutex_enter(_lock);
 			LIST_REMOVE(bp, b_hash);
+			brelsel(bp, BC_INVAL);
 			mutex_exit(_lock);
-			brelse(bp, BC_INVAL);
 			return NULL;
 		}
 	}



CVS commit: src/sys/kern

2017-03-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Mar 21 10:46:49 UTC 2017

Modified Files:
src/sys/kern: vfs_bio.c

Log Message:
Use brelsel while the bufcache_lock is held rather than dropping it
and re-taking / dropping it in brelse


To generate a diff of this commit:
cvs rdiff -u -r1.270 -r1.271 src/sys/kern/vfs_bio.c

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



CVS commit: src/sys/dev/pci

2017-03-21 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Tue Mar 21 10:39:52 UTC 2017

Modified Files:
src/sys/dev/pci: if_wm.c

Log Message:
fix PR kern/52068 (82574 Tx csum offload bug in not only i386 but also amd64).

The packets sent from txq[1] could not be enabled any tx offload.
This has been enbugged since r1.454.


To generate a diff of this commit:
cvs rdiff -u -r1.497 -r1.498 src/sys/dev/pci/if_wm.c

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.497 src/sys/dev/pci/if_wm.c:1.498
--- src/sys/dev/pci/if_wm.c:1.497	Wed Mar  8 08:00:09 2017
+++ src/sys/dev/pci/if_wm.c	Tue Mar 21 10:39:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.497 2017/03/08 08:00:09 kardel Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.498 2017/03/21 10:39:52 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.497 2017/03/08 08:00:09 kardel Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.498 2017/03/21 10:39:52 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -711,8 +711,8 @@ static int	wm_alloc_txrx_queues(struct w
 static void	wm_free_txrx_queues(struct wm_softc *);
 static int	wm_init_txrx_queues(struct wm_softc *);
 /* Start */
-static int	wm_tx_offload(struct wm_softc *, struct wm_txsoft *,
-uint32_t *, uint8_t *);
+static int	wm_tx_offload(struct wm_softc *, struct wm_txqueue *,
+struct wm_txsoft *, uint32_t *, uint8_t *);
 static inline int	wm_select_txqueue(struct ifnet *, struct mbuf *);
 static void	wm_start(struct ifnet *);
 static void	wm_start_locked(struct ifnet *);
@@ -6405,10 +6405,9 @@ wm_init_txrx_queues(struct wm_softc *sc)
  *	specified packet.
  */
 static int
-wm_tx_offload(struct wm_softc *sc, struct wm_txsoft *txs, uint32_t *cmdp,
-uint8_t *fieldsp)
+wm_tx_offload(struct wm_softc *sc, struct wm_txqueue *txq,
+struct wm_txsoft *txs, uint32_t *cmdp, uint8_t *fieldsp)
 {
-	struct wm_txqueue *txq = >sc_queue[0].wmq_txq;
 	struct mbuf *m0 = txs->txs_mbuf;
 	struct livengood_tcpip_ctxdesc *t;
 	uint32_t ipcs, tucs, cmd, cmdlen, seg;
@@ -6863,7 +6862,7 @@ wm_send_common_locked(struct ifnet *ifp,
 		(M_CSUM_TSOv4 | M_CSUM_TSOv6 |
 		M_CSUM_IPv4 | M_CSUM_TCPv4 | M_CSUM_UDPv4 |
 		M_CSUM_TCPv6 | M_CSUM_UDPv6)) {
-			if (wm_tx_offload(sc, txs, ,
+			if (wm_tx_offload(sc, txq, txs, ,
 	  ) != 0) {
 /* Error message already displayed. */
 bus_dmamap_unload(sc->sc_dmat, dmamap);



CVS commit: src/sys/dev/pci

2017-03-21 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Tue Mar 21 10:39:52 UTC 2017

Modified Files:
src/sys/dev/pci: if_wm.c

Log Message:
fix PR kern/52068 (82574 Tx csum offload bug in not only i386 but also amd64).

The packets sent from txq[1] could not be enabled any tx offload.
This has been enbugged since r1.454.


To generate a diff of this commit:
cvs rdiff -u -r1.497 -r1.498 src/sys/dev/pci/if_wm.c

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



CVS commit: src/sys/sys

2017-03-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Mar 21 10:20:12 UTC 2017

Modified Files:
src/sys/sys: namei.src

Log Message:
Tiny fix for namecache locking rules.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/sys/namei.src

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



CVS commit: src/sys

2017-03-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Mar 21 10:20:38 UTC 2017

Modified Files:
src/sys/rump/include/rump: rump_namei.h
src/sys/sys: namei.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/rump/include/rump/rump_namei.h
cvs rdiff -u -r1.96 -r1.97 src/sys/sys/namei.h

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



CVS commit: src/sys

2017-03-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Mar 21 10:20:38 UTC 2017

Modified Files:
src/sys/rump/include/rump: rump_namei.h
src/sys/sys: namei.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/rump/include/rump/rump_namei.h
cvs rdiff -u -r1.96 -r1.97 src/sys/sys/namei.h

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

Modified files:

Index: src/sys/rump/include/rump/rump_namei.h
diff -u src/sys/rump/include/rump/rump_namei.h:1.30 src/sys/rump/include/rump/rump_namei.h:1.31
--- src/sys/rump/include/rump/rump_namei.h:1.30	Sun Mar 19 10:21:25 2017
+++ src/sys/rump/include/rump/rump_namei.h	Tue Mar 21 10:20:38 2017
@@ -1,11 +1,11 @@
-/*	$NetBSD: rump_namei.h,v 1.30 2017/03/19 10:21:25 riastradh Exp $	*/
+/*	$NetBSD: rump_namei.h,v 1.31 2017/03/21 10:20:38 riastradh Exp $	*/
 
 
 /*
  * WARNING: GENERATED FILE.  DO NOT EDIT
  * (edit namei.src and run make namei in src/sys/sys)
  *   by:   NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp 
- *   from: NetBSD: namei.src,v 1.40 2017/03/19 10:21:02 riastradh Exp 
+ *   from: NetBSD: namei.src,v 1.41 2017/03/21 10:20:12 riastradh Exp 
  */
 
 #ifndef _RUMP_RUMP_NAMEI_H_

Index: src/sys/sys/namei.h
diff -u src/sys/sys/namei.h:1.96 src/sys/sys/namei.h:1.97
--- src/sys/sys/namei.h:1.96	Sun Mar 19 10:21:25 2017
+++ src/sys/sys/namei.h	Tue Mar 21 10:20:38 2017
@@ -1,11 +1,11 @@
-/*	$NetBSD: namei.h,v 1.96 2017/03/19 10:21:25 riastradh Exp $	*/
+/*	$NetBSD: namei.h,v 1.97 2017/03/21 10:20:38 riastradh Exp $	*/
 
 
 /*
  * WARNING: GENERATED FILE.  DO NOT EDIT
  * (edit namei.src and run make namei in src/sys/sys)
  *   by:   NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp 
- *   from: NetBSD: namei.src,v 1.40 2017/03/19 10:21:02 riastradh Exp 
+ *   from: NetBSD: namei.src,v 1.41 2017/03/21 10:20:12 riastradh Exp 
  */
 
 /*
@@ -215,7 +215,7 @@ struct nameidata {
  *  -   stable after initialization
  *  L   namecache_lock
  *  C   struct nchcpu::cpu_lock
- *  L/C insert/delete needs L and C, read needs L or any C,
+ *  L/C insert needs L, read needs L or any C,
  *  must hold L and all C after (or during) delete before free
  *  N   struct namecache::nc_lock
  */



CVS commit: src/sys/sys

2017-03-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Mar 21 10:20:12 UTC 2017

Modified Files:
src/sys/sys: namei.src

Log Message:
Tiny fix for namecache locking rules.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/sys/namei.src

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

Modified files:

Index: src/sys/sys/namei.src
diff -u src/sys/sys/namei.src:1.40 src/sys/sys/namei.src:1.41
--- src/sys/sys/namei.src:1.40	Sun Mar 19 10:21:02 2017
+++ src/sys/sys/namei.src	Tue Mar 21 10:20:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: namei.src,v 1.40 2017/03/19 10:21:02 riastradh Exp $	*/
+/*	$NetBSD: namei.src,v 1.41 2017/03/21 10:20:12 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1985, 1989, 1991, 1993
@@ -207,7 +207,7 @@ NAMEIFL	PARAMASK	0x02ee300	/* mask of pa
  *  -   stable after initialization
  *  L   namecache_lock
  *  C   struct nchcpu::cpu_lock
- *  L/C insert/delete needs L and C, read needs L or any C,
+ *  L/C insert needs L, read needs L or any C,
  *  must hold L and all C after (or during) delete before free
  *  N   struct namecache::nc_lock
  */



CVS commit: src/share/man/man9

2017-03-21 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Mar 21 10:12:28 UTC 2017

Modified Files:
src/share/man/man9: namei.9

Log Message:
Add width argument to list.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/share/man/man9/namei.9

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

Modified files:

Index: src/share/man/man9/namei.9
diff -u src/share/man/man9/namei.9:1.46 src/share/man/man9/namei.9:1.47
--- src/share/man/man9/namei.9:1.46	Sat Mar 18 21:18:09 2017
+++ src/share/man/man9/namei.9	Tue Mar 21 10:12:28 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: namei.9,v 1.46 2017/03/18 21:18:09 riastradh Exp $
+.\" $NetBSD: namei.9,v 1.47 2017/03/21 10:12:28 wiz Exp $
 .\"
 .\" Copyright (c) 2001, 2005, 2006, 2017 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -850,7 +850,7 @@ The control flow within the
 portions of
 .Pa vfs_lookup.c
 is as follows.
-.Bl -tag
+.Bl -tag -width namei_tryemulrootXX
 .It Fn namei
 does a complete path lookup by calling
 .Fn namei_init ,



CVS commit: src/share/man/man9

2017-03-21 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Mar 21 10:12:28 UTC 2017

Modified Files:
src/share/man/man9: namei.9

Log Message:
Add width argument to list.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/share/man/man9/namei.9

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



CVS commit: src/sys/ufs/lfs

2017-03-21 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Mar 21 09:53:01 UTC 2017

Modified Files:
src/sys/ufs/lfs: lfs_inode.c

Log Message:
Update mtime even if oip->i_size == length

PR kern/51762, LFS version.


To generate a diff of this commit:
cvs rdiff -u -r1.152 -r1.153 src/sys/ufs/lfs/lfs_inode.c

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

Modified files:

Index: src/sys/ufs/lfs/lfs_inode.c
diff -u src/sys/ufs/lfs/lfs_inode.c:1.152 src/sys/ufs/lfs/lfs_inode.c:1.153
--- src/sys/ufs/lfs/lfs_inode.c:1.152	Sun Mar 19 22:48:00 2017
+++ src/sys/ufs/lfs/lfs_inode.c	Tue Mar 21 09:53:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_inode.c,v 1.152 2017/03/19 22:48:00 riastradh Exp $	*/
+/*	$NetBSD: lfs_inode.c,v 1.153 2017/03/21 09:53:00 maya Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.152 2017/03/19 22:48:00 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.153 2017/03/21 09:53:00 maya Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_quota.h"
@@ -228,15 +228,6 @@ lfs_truncate(struct vnode *ovp, off_t le
 	if (length < 0)
 		return (EINVAL);
 
-	/*
-	 * Just return and not update modification times.
-	 */
-	if (oip->i_size == length) {
-		/* still do a uvm_vnp_setsize() as writesize may be larger */
-		uvm_vnp_setsize(ovp, length);
-		return (0);
-	}
-
 	fs = oip->i_lfs;
 
 	if (ovp->v_type == VLNK &&
@@ -252,6 +243,8 @@ lfs_truncate(struct vnode *ovp, off_t le
 		return (lfs_update(ovp, NULL, NULL, 0));
 	}
 	if (oip->i_size == length) {
+		/* still do a uvm_vnp_setsize() as writesize may be larger */
+		uvm_vnp_setsize(ovp, length);
 		oip->i_flag |= IN_CHANGE | IN_UPDATE;
 		return (lfs_update(ovp, NULL, NULL, 0));
 	}



CVS commit: src/sys/ufs/lfs

2017-03-21 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Mar 21 09:53:01 UTC 2017

Modified Files:
src/sys/ufs/lfs: lfs_inode.c

Log Message:
Update mtime even if oip->i_size == length

PR kern/51762, LFS version.


To generate a diff of this commit:
cvs rdiff -u -r1.152 -r1.153 src/sys/ufs/lfs/lfs_inode.c

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



CVS commit: src

2017-03-21 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Mar 21 07:04:30 UTC 2017

Modified Files:
src/share/man/man4: audio.4
src/sys/dev: audio.c
src/sys/sys: audioio.h
src/usr.bin/audio/ctl: ctl.c

Log Message:
Renane ioctl AUDIO_SETPROC to AUDIO_SETCHAN.

Add an ioctl to return channel number (AUDIO_GETCHAN). This can be used
on audio/sound/audioctl devices.

Return EIO in read/write/ioctl/poll/stat if fp has been closed or is
invalid.

Update audio.4, audioio.h and audioctl(1) to reflect these changes.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/share/man/man4/audio.4
cvs rdiff -u -r1.316 -r1.317 src/sys/dev/audio.c
cvs rdiff -u -r1.36 -r1.37 src/sys/sys/audioio.h
cvs rdiff -u -r1.42 -r1.43 src/usr.bin/audio/ctl/ctl.c

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



CVS commit: src

2017-03-21 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Mar 21 07:04:30 UTC 2017

Modified Files:
src/share/man/man4: audio.4
src/sys/dev: audio.c
src/sys/sys: audioio.h
src/usr.bin/audio/ctl: ctl.c

Log Message:
Renane ioctl AUDIO_SETPROC to AUDIO_SETCHAN.

Add an ioctl to return channel number (AUDIO_GETCHAN). This can be used
on audio/sound/audioctl devices.

Return EIO in read/write/ioctl/poll/stat if fp has been closed or is
invalid.

Update audio.4, audioio.h and audioctl(1) to reflect these changes.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/share/man/man4/audio.4
cvs rdiff -u -r1.316 -r1.317 src/sys/dev/audio.c
cvs rdiff -u -r1.36 -r1.37 src/sys/sys/audioio.h
cvs rdiff -u -r1.42 -r1.43 src/usr.bin/audio/ctl/ctl.c

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

Modified files:

Index: src/share/man/man4/audio.4
diff -u src/share/man/man4/audio.4:1.75 src/share/man/man4/audio.4:1.76
--- src/share/man/man4/audio.4:1.75	Sun Feb 12 14:44:20 2017
+++ src/share/man/man4/audio.4	Tue Mar 21 07:04:29 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: audio.4,v 1.75 2017/02/12 14:44:20 wiz Exp $
+.\"	$NetBSD: audio.4,v 1.76 2017/03/21 07:04:29 nat Exp $
 .\"
 .\" Copyright (c) 1996 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -245,7 +245,9 @@ The following
 commands are supported on the sample devices:
 .Pp
 .Bl -tag -width indent
-.It Dv AUDIO_SETPROC (int)
+.It Dv AUDIO_GETCHAN (int)
+This command will return the audio channel in use.
+.It Dv AUDIO_SETCHAN (int)
 This command will select the audio channel for subsequent ioctl calls.
 .It Dv AUDIO_FLUSH
 This command stops all playback and recording, clears all queued

Index: src/sys/dev/audio.c
diff -u src/sys/dev/audio.c:1.316 src/sys/dev/audio.c:1.317
--- src/sys/dev/audio.c:1.316	Mon Mar 20 22:42:39 2017
+++ src/sys/dev/audio.c	Tue Mar 21 07:04:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.316 2017/03/20 22:42:39 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.317 2017/03/21 07:04:29 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.316 2017/03/20 22:42:39 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.317 2017/03/21 07:04:29 nat Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -1525,6 +1525,8 @@ audio_waitio(struct audio_softc *sc, kco
 
 	found = false;
 	SIMPLEQ_FOREACH(vchan, >sc_audiochan, entries) {
+		if (vchan == SIMPLEQ_FIRST(>sc_audiochan))
+			continue;
 		if (vchan->vc == vc) {
 			found = true;
 			break;
@@ -1660,6 +1662,9 @@ audioread(struct file *fp, off_t *offp, 
 	int error;
 	dev_t dev;
 
+	if (fp->f_audioctx == NULL)
+		return EIO;
+
 	dev = fp->f_audioctx->dev;
 
 	if ((error = audio_enter(dev, RW_READER, )) != 0)
@@ -1693,6 +1698,9 @@ audiowrite(struct file *fp, off_t *offp,
 	int error;
 	dev_t dev;
 
+	if (fp->f_audioctx == NULL)
+		return EIO;
+
 	dev = fp->f_audioctx->dev;
 
 	if ((error = audio_enter(dev, RW_READER, )) != 0)
@@ -1727,6 +1735,9 @@ audioioctl(struct file *fp, u_long cmd, 
 	krw_t rw;
 	dev_t dev;
 
+	if (fp->f_audioctx == NULL)
+		return EIO;
+
 	chan = fp->f_audioctx;
 	dev = chan->dev;
 
@@ -1773,6 +1784,9 @@ audioioctl(struct file *fp, u_long cmd, 
 static int
 audiostat(struct file *fp, struct stat *st)
 {
+	if (fp->f_audioctx == NULL)
+		return EIO;
+
 	memset(st, 0, sizeof(*st));
 
 	st->st_dev = fp->f_audioctx->dev;
@@ -1792,6 +1806,9 @@ audiopoll(struct file *fp, int events)
 	int revents;
 	dev_t dev;
 
+	if (fp->f_audioctx == NULL)
+		return EIO;
+
 	dev = fp->f_audioctx->dev;
 
 	/* Don't bother with device level lock here. */
@@ -2947,6 +2964,8 @@ audio_ioctl(dev_t dev, struct audio_soft
 	KASSERT(mutex_owned(sc->sc_lock));
 
 	SIMPLEQ_FOREACH(pchan, >sc_audiochan, entries) {
+		if (pchan == SIMPLEQ_FIRST(>sc_audiochan))
+			continue;
 		if (pchan->chan == chan->deschan)
 			break;
 	}
@@ -2962,7 +2981,11 @@ audio_ioctl(dev_t dev, struct audio_soft
 		return ENXIO;
 	error = 0;
 	switch (cmd) {
-	case AUDIO_SETPROC:
+	case AUDIO_GETCHAN:
+		if ((int *)addr != NULL)
+			*(int*)addr = chan->chan;
+		break;
+	case AUDIO_SETCHAN:
 		if ((int *)addr != NULL && *(int*)addr > 0)
 			chan->deschan = *(int*)addr;
 		break;

Index: src/sys/sys/audioio.h
diff -u src/sys/sys/audioio.h:1.36 src/sys/sys/audioio.h:1.37
--- src/sys/sys/audioio.h:1.36	Fri Feb 10 19:31:42 2017
+++ src/sys/sys/audioio.h	Tue Mar 21 07:04:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audioio.h,v 1.36 2017/02/10 19:31:42 nat Exp $	*/
+/*	$NetBSD: audioio.h,v 1.37 2017/03/21 07:04:29 nat Exp $	*/
 
 /*
  * Copyright (c) 1991-1993 Regents of the University of California.
@@ -191,7 +191,8 @@ typedef struct audio_encoding {
 #define  AUDIO_PROP_PLAYBACK	0x10
 #define  AUDIO_PROP_CAPTURE	0x20
 #define AUDIO_GETBUFINFO	_IOR('A', 35, struct audio_info)
-#define AUDIO_SETPROC	_IOW('A', 36, int)
+#define AUDIO_SETCHAN