CVS commit: src/usr.bin/xlint/lint1

2021-07-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul  6 05:39:27 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: rearrange and rename grammar rules for parameter declarations

Place the notype/type variants close to each other to be able to compare
them visually.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.256 -r1.257 src/usr.bin/xlint/lint1/cgram.y

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/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.256 src/usr.bin/xlint/lint1/cgram.y:1.257
--- src/usr.bin/xlint/lint1/cgram.y:1.256	Tue Jul  6 05:22:34 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Tue Jul  6 05:39:27 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.256 2021/07/06 05:22:34 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.257 2021/07/06 05:39:27 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.256 2021/07/06 05:22:34 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.257 2021/07/06 05:39:27 rillig Exp $");
 #endif
 
 #include 
@@ -308,7 +308,7 @@ anonymize(sym_t *s)
 %type			type_direct_decl
 %type		pointer
 %type		asterisk
-%type			param_decl
+%type			type_param_decl
 %type			param_list
 %type			abstract_decl_param_list
 %type			direct_param_decl
@@ -1122,19 +1122,26 @@ type_direct_decl:
 	;
 
 /*
- * param_decl and notype_param_decl exist to avoid a conflict in
- * argument lists. A typename enclosed in parens should always be
- * treated as a typename, not an argument.
- * "typedef int a; f(int (a));" is  "typedef int a; f(int foo(a));"
- *not "typedef int a; f(int a);"
+ * The two distinct rules type_param_decl and notype_param_decl avoid a
+ * conflict in argument lists. A typename enclosed in parentheses is always
+ * treated as a typename, not an argument name. For example, after
+ * "typedef double a;", the declaration "f(int (a));" is interpreted as
+ * "f(int (double));", not "f(int a);".
  */
-param_decl:
+type_param_decl:
 	  direct_param_decl
 	| pointer direct_param_decl {
 		$$ = add_pointer($2, $1);
 	  }
 	;
 
+notype_param_decl:
+	  direct_notype_param_decl
+	| pointer direct_notype_param_decl {
+		$$ = add_pointer($2, $1);
+	  }
+	;
+
 direct_param_decl:
 	  identifier type_attribute_list {
 		$$ = declarator_name(getsym($1));
@@ -1158,14 +1165,8 @@ direct_param_decl:
 	  }
 	;
 
-notype_param_decl:
-	  direct_notype_param_decl
-	| pointer direct_notype_param_decl {
-		$$ = add_pointer($2, $1);
-	  }
-	;
-
 direct_notype_param_decl:
+	/* XXX: missing identifier type_attribute_list? */
 	  identifier {
 		$$ = declarator_name(getsym($1));
 	  }
@@ -1309,14 +1310,7 @@ parameter_declaration:
 	| declmods deftyp notype_param_decl {
 		$$ = declare_argument($3, false);
 	  }
-	/*
-	 * param_decl is needed because of following conflict:
-	 * "typedef int a; f(int (a));" could be parsed as
-	 * "function with argument a of type int", or
-	 * "function with an abstract argument of type function".
-	 * This grammar realizes the second case.
-	 */
-	| declaration_specifiers deftyp param_decl {
+	| declaration_specifiers deftyp type_param_decl {
 		$$ = declare_argument($3, false);
 	  }
 	| declmods deftyp abstract_declarator {



CVS commit: src/usr.bin/xlint/lint1

2021-07-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul  6 05:22:34 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: move the grammar rule array_size out of the type/notype section

An array size is used in several grammar rules for different types of
declarations, therefore it doesn't make sense to place that rule
somewhere in the middle, where it disrupted the flow of notype/type
rules.  The whole point of having the notype/type rules grouped is to be
able to quickly compare them, since they are almost equal.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.255 -r1.256 src/usr.bin/xlint/lint1/cgram.y

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/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.255 src/usr.bin/xlint/lint1/cgram.y:1.256
--- src/usr.bin/xlint/lint1/cgram.y:1.255	Tue Jul  6 05:12:44 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Tue Jul  6 05:22:34 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.255 2021/07/06 05:12:44 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.256 2021/07/06 05:22:34 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.255 2021/07/06 05:12:44 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.256 2021/07/06 05:22:34 rillig Exp $");
 #endif
 
 #include 
@@ -1016,6 +1016,11 @@ enumeration_constant:		/* C99 6.4.4.3 */
 	;
 
 
+/*
+ * For an explanation of 'notype' in the following rules, see the Bison
+ * manual, section 7.1 "Semantic Info in Token Kinds".
+ */
+
 notype_init_decls:
 	  notype_init_decl
 	| notype_init_decls T_COMMA type_init_decl
@@ -1026,7 +1031,6 @@ type_init_decls:
 	| type_init_decls T_COMMA type_init_decl
 	;
 
-/* See the Bison manual, section 7.1 "Semantic Info in Token Kinds". */
 notype_init_decl:
 	  notype_decl asm_or_symbolrename_opt {
 		cgram_declare($1, false, $2);
@@ -1131,18 +1135,6 @@ param_decl:
 	  }
 	;
 
-array_size:
-	  type_qualifier_list_opt T_SCLASS constant_expr {
-		/* C11 6.7.6.3p7 */
-		if ($2 != STATIC)
-			yyerror("Bad attribute");
-		/* static array size is a C11 extension */
-		c11ism(343);
-		$$ = $3;
-	  }
-	| constant_expr
-	;
-
 direct_param_decl:
 	  identifier type_attribute_list {
 		$$ = declarator_name(getsym($1));
@@ -1495,6 +1487,18 @@ direct_abstract_declarator:		/* C99 6.7.
 	| direct_abstract_declarator type_attribute
 	;
 
+array_size:
+	  type_qualifier_list_opt T_SCLASS constant_expr {
+		/* C11 6.7.6.3p7 */
+		if ($2 != STATIC)
+			yyerror("Bad attribute");
+		/* static array size is a C11 extension */
+		c11ism(343);
+		$$ = $3;
+	  }
+	| constant_expr
+	;
+
 non_expr_statement:
 	  type_attribute T_SEMI
 	| labeled_statement



CVS commit: src/usr.bin/xlint/lint1

2021-07-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul  6 05:12:44 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: reduce grammar conflicts for GCC attributes

In all but one case, the use of type_attribute_list introduced an
unnecessary ambiguity in the grammar.  It appeared in a place where it
could be repeated either by the type_attribute_list or by the enclosing
rule.  Both variants have the same effect.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.254 -r1.255 src/usr.bin/xlint/lint1/cgram.y

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/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.254 src/usr.bin/xlint/lint1/cgram.y:1.255
--- src/usr.bin/xlint/lint1/cgram.y:1.254	Tue Jul  6 04:48:17 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Tue Jul  6 05:12:44 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.254 2021/07/06 04:48:17 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.255 2021/07/06 05:12:44 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.254 2021/07/06 04:48:17 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.255 2021/07/06 05:12:44 rillig Exp $");
 #endif
 
 #include 
@@ -123,7 +123,7 @@ anonymize(sym_t *s)
 }
 %}
 
-%expect 182
+%expect 166
 
 %union {
 	val_t	*y_val;
@@ -690,7 +690,7 @@ declmod:
 	| T_SCLASS {
 		add_storage_class($1);
 	  }
-	| type_attribute_list
+	| type_attribute
 	;
 
 clrtyp_typespec:
@@ -1090,7 +1090,7 @@ notype_direct_decl:
 		end_declaration_level();
 		block_level--;
 	  }
-	| notype_direct_decl type_attribute_list
+	| notype_direct_decl type_attribute
 	;
 
 type_direct_decl:
@@ -1114,7 +1114,7 @@ type_direct_decl:
 		end_declaration_level();
 		block_level--;
 	  }
-	| type_direct_decl type_attribute_list
+	| type_direct_decl type_attribute
 	;
 
 /*
@@ -1492,7 +1492,7 @@ direct_abstract_declarator:		/* C99 6.7.
 		end_declaration_level();
 		block_level--;
 	  }
-	| direct_abstract_declarator type_attribute_list
+	| direct_abstract_declarator type_attribute
 	;
 
 non_expr_statement:



CVS commit: src/usr.bin/xlint/lint1

2021-07-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul  6 04:48:17 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: clean up style in grammar

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.253 -r1.254 src/usr.bin/xlint/lint1/cgram.y

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/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.253 src/usr.bin/xlint/lint1/cgram.y:1.254
--- src/usr.bin/xlint/lint1/cgram.y:1.253	Tue Jul  6 04:44:20 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Tue Jul  6 04:48:17 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.253 2021/07/06 04:44:20 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.254 2021/07/06 04:48:17 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.253 2021/07/06 04:44:20 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.254 2021/07/06 04:48:17 rillig Exp $");
 #endif
 
 #include 
@@ -575,7 +575,7 @@ type_attribute_spec:
 	| T_AT_DESTRUCTOR
 	| T_AT_FALLTHROUGH {
 		fallthru(1);
-	}
+	  }
 	| T_AT_FORMAT T_LPAREN type_attribute_format_type T_COMMA
 	constant_expr T_COMMA constant_expr T_RPAREN
 	| T_AT_FORMAT_ARG T_LPAREN constant_expr T_RPAREN
@@ -1349,7 +1349,7 @@ asm_or_symbolrename_opt:		/* expect only
 	;
 
 initializer:			/* C99 6.7.8 "Initialization" */
-	  expr%prec T_COMMA {
+	  expr %prec T_COMMA {
 		init_expr($1);
 	  }
 	| init_lbrace init_rbrace {
@@ -1566,7 +1566,7 @@ block_item_list:
 			/* declarations after statements is a C99 feature */
 			c99ism(327);
 		$$ = $1 || $2;
-	}
+	  }
 	;
 
 block_item:
@@ -1728,6 +1728,7 @@ for_start:
 		block_level++;
 	  }
 	;
+
 for_exprs:
 	  for_start declaration_specifiers deftyp notype_init_decls T_SEMI
 	expr_opt T_SEMI expr_opt T_RPAREN {
@@ -1965,13 +1966,13 @@ term:
 		if ($$ != NULL)
 			check_expr_misc($2, false, false, false, false, false, true);
 	  }
-	| T_SIZEOF T_LPAREN type_name T_RPAREN		%prec T_SIZEOF {
+	| T_SIZEOF T_LPAREN type_name T_RPAREN %prec T_SIZEOF {
 		$$ = build_sizeof($3);
 	  }
 	| T_ALIGNOF T_LPAREN type_name T_RPAREN {
 		$$ = build_alignof($3);
 	  }
-	| T_LPAREN type_name T_RPAREN term		%prec T_UNARY {
+	| T_LPAREN type_name T_RPAREN term %prec T_UNARY {
 		$$ = cast($4, $2);
 	  }
 	| T_LPAREN type_name T_RPAREN {	/* C99 6.5.2.5 "Compound literals" */
@@ -2044,7 +2045,7 @@ string2:
 	;
 
 func_arg_list:
-	  expr		%prec T_COMMA {
+	  expr %prec T_COMMA {
 		$$ = new_function_argument_node(NULL, $1);
 	  }
 	| func_arg_list T_COMMA expr {
@@ -2075,9 +2076,10 @@ identifier:			/* C99 6.4.2.1 */
 	;
 
 comma_opt:
-	  T_COMMA
-	| /* empty */
+	  /* empty */
+	| T_COMMA
 	;
+
 %%
 
 /* ARGSUSED */



CVS commit: src/usr.bin/xlint/lint1

2021-07-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul  6 04:44:20 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: cgram.y externs1.h lint1.h tree.c

Log Message:
lint: rename type generic_association_types to generic_association

The word 'types' was misleading and unnecessary.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.252 -r1.253 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.114 -r1.115 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.111 -r1.112 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.312 -r1.313 src/usr.bin/xlint/lint1/tree.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/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.252 src/usr.bin/xlint/lint1/cgram.y:1.253
--- src/usr.bin/xlint/lint1/cgram.y:1.252	Mon Jul  5 19:59:10 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Tue Jul  6 04:44:20 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.252 2021/07/05 19:59:10 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.253 2021/07/06 04:44:20 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.252 2021/07/05 19:59:10 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.253 2021/07/06 04:44:20 rillig Exp $");
 #endif
 
 #include 
@@ -139,7 +139,7 @@ anonymize(sym_t *s)
 	strg_t	*y_string;
 	qual_ptr *y_qual_ptr;
 	bool	y_seen_statement;
-	struct generic_association_types *y_types;
+	struct generic_association *y_generic;
 };
 
 %token			T_LBRACE T_RBRACE T_LBRACK T_RBRACK T_LPAREN T_RPAREN
@@ -341,8 +341,8 @@ anonymize(sym_t *s)
 %type		range
 %type	 block_item_list
 %type	 block_item
-%type		generic_assoc_list
-%type		generic_association
+%type		generic_assoc_list
+%type		generic_association
 
 
 %%
@@ -1648,7 +1648,7 @@ generic_selection:		/* C11 6.5.1.1 */
 generic_assoc_list:		/* C11 6.5.1.1 */
 	  generic_association
 	| generic_assoc_list T_COMMA generic_association {
-		$3->gat_prev = $1;
+		$3->ga_prev = $1;
 		$$ = $3;
 	  }
 	;
@@ -1656,13 +1656,13 @@ generic_assoc_list:		/* C11 6.5.1.1 */
 generic_association:		/* C11 6.5.1.1 */
 	  type_name T_COLON assignment_expression {
 		$$ = getblk(sizeof(*$$));
-		$$->gat_arg = $1;
-		$$->gat_result = $3;
+		$$->ga_arg = $1;
+		$$->ga_result = $3;
 	  }
 	| T_DEFAULT T_COLON assignment_expression {
 		$$ = getblk(sizeof(*$$));
-		$$->gat_arg = NULL;
-		$$->gat_result = $3;
+		$$->ga_arg = NULL;
+		$$->ga_result = $3;
 	  }
 	;
 

Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.114 src/usr.bin/xlint/lint1/externs1.h:1.115
--- src/usr.bin/xlint/lint1/externs1.h:1.114	Tue Jun 29 21:16:54 2021
+++ src/usr.bin/xlint/lint1/externs1.h	Tue Jul  6 04:44:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs1.h,v 1.114 2021/06/29 21:16:54 rillig Exp $	*/
+/*	$NetBSD: externs1.h,v 1.115 2021/07/06 04:44:20 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -209,7 +209,7 @@ extern	tnode_t	*new_name_node(sym_t *, i
 extern	tnode_t	*new_string_node(strg_t *);
 extern	sym_t	*struct_or_union_member(tnode_t *, op_t, sym_t *);
 extern	tnode_t	*build_generic_selection(const tnode_t *,
-		struct generic_association_types *);
+		struct generic_association *);
 
 extern	tnode_t	*build(op_t, tnode_t *, tnode_t *);
 extern	tnode_t	*cconv(tnode_t *);

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.111 src/usr.bin/xlint/lint1/lint1.h:1.112
--- src/usr.bin/xlint/lint1/lint1.h:1.111	Mon Jul  5 19:48:32 2021
+++ src/usr.bin/xlint/lint1/lint1.h	Tue Jul  6 04:44:20 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.111 2021/07/05 19:48:32 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.112 2021/07/06 04:44:20 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -328,10 +328,10 @@ typedef	struct tnode {
 #define	tn_val		tn_u._tn_val
 #define	tn_string	tn_u._tn_string
 
-struct generic_association_types {
-	type_t *gat_arg;	/* NULL means default or error */
-	tnode_t *gat_result;	/* NULL means error */
-	struct generic_association_types *gat_prev;
+struct generic_association {
+	type_t *ga_arg;		/* NULL means default or error */
+	tnode_t *ga_result;	/* NULL means error */
+	struct generic_association *ga_prev;
 };
 
 /*

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.312 src/usr.bin/xlint/lint1/tree.c:1.313
--- src/usr.bin/xlint/lint1/tree.c:1.312	Sun Jul  4 17:28:05 2021
+++ src/usr.bin/xlint/lint1/tree.c	Tue Jul  6 04:44:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.312 2021/07/04 17:28:05 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.313 2021/07/06 04:44:20 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.312 2021/07/04 17:28:05 

CVS commit: [netbsd-9] src

2021-07-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul  6 04:22:35 UTC 2021

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs [netbsd-9]: zfs_vnops.c
src/sys/rump/librump/rumpkern [netbsd-9]: vm.c
src/sys/rump/librump/rumpvfs [netbsd-9]: vm_vfs.c
src/sys/uvm [netbsd-9]: uvm_anon.c uvm_page.c uvm_pager.c
src/tests/rump/rumpkern [netbsd-9]: t_vm.c

Log Message:
Pull up following revision(s) - all via patch -
(requested by riastradh in ticket #1317):

sys/uvm/uvm_page.c: revision 1.248
sys/uvm/uvm_anon.c: revision 1.80
sys/rump/librump/rumpvfs/vm_vfs.c: revision 1.40
sys/rump/librump/rumpvfs/vm_vfs.c: revision 1.41
sys/rump/librump/rumpkern/vm.c: revision 1.191
sys/uvm/uvm_pager.c: revision 1.130
external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c: revision 1.71
tests/rump/rumpkern/t_vm.c: revision 1.5
tests/rump/rumpkern/t_vm.c: revision 1.6
sys/rump/librump/rumpvfs/vm_vfs.c: revision 1.39

Move the handling of PG_PAGEOUT from uvm_aio_aiodone_pages() to
uvm_page_unbusy() so that all callers of uvm_page_unbusy() don't need to
handle this flag separately.  Split out the pages part of uvm_aio_aiodone()
into uvm_aio_aiodone_pages() in rump just like in the real kernel.

In ZFS functions that can fail to copy data between the ARC and VM pages,
use uvm_aio_aiodone_pages() rather than uvm_page_unbusy() so that we can
handle these "I/O" errors.  Fixes PR 55702.

fix an incorrect assertion in the previous commit.

Handle PG_PAGEOUT in uvm_anon_release() too.

Commit the ZFS file that I forgot in this previous commit:

Move the handling of PG_PAGEOUT from uvm_aio_aiodone_pages() to
uvm_page_unbusy() so that all callers of uvm_page_unbusy() don't need to
handle this flag separately.  Split out the pages part of uvm_aio_aiodone()
into uvm_aio_aiodone_pages() in rump just like in the real kernel.

In ZFS functions that can fail to copy data between the ARC and VM pages,
use uvm_aio_aiodone_pages() rather than uvm_page_unbusy() so that we can
handle these "I/O" errors.  Fixes PR 55702.
update the rump copy of uvm_page_unbusy() to match the real version,
in particular handle PG_PAGEOUT.  fixes a few atf tests.
the busypage test is buggy, expect it to fail.

make rump's uvm_aio_aiodone_pages() look more like the kernel version.
fixes some more rumpy assertions.

for the busypage test, replace atf_tc_expect_fail() with atf_tc_skip()
because atf apparently has no way to expect a test program to crash.
fixes PR 55945.


To generate a diff of this commit:
cvs rdiff -u -r1.50.2.9 -r1.50.2.10 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
cvs rdiff -u -r1.173 -r1.173.14.1 src/sys/rump/librump/rumpkern/vm.c
cvs rdiff -u -r1.34 -r1.34.34.1 src/sys/rump/librump/rumpvfs/vm_vfs.c
cvs rdiff -u -r1.64 -r1.64.8.1 src/sys/uvm/uvm_anon.c
cvs rdiff -u -r1.199 -r1.199.4.1 src/sys/uvm/uvm_page.c
cvs rdiff -u -r1.111.8.1 -r1.111.8.2 src/sys/uvm/uvm_pager.c
cvs rdiff -u -r1.4 -r1.4.16.1 src/tests/rump/rumpkern/t_vm.c

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.50.2.9 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.50.2.10
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.50.2.9	Wed May 13 12:41:43 2020
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Tue Jul  6 04:22:34 2021
@@ -6007,6 +6007,12 @@ zfs_netbsd_getpages(void *v)
 		va, DMU_READ_PREFETCH);
 		zfs_unmap_page(pg, va);
 
+		if (err != 0) {
+			uvm_aio_aiodone_pages(ap->a_m, npages, false, err);
+			memset(ap->a_m, 0, sizeof(ap->a_m[0]) *
+			   npages);
+			goto out;
+		}
 		mutex_enter(mtx);
 		pg->flags &= ~(PG_FAKE);
 		pmap_clear_modify(pg);
@@ -6023,6 +6029,7 @@ zfs_netbsd_getpages(void *v)
 	mutex_exit(mtx);
 	ap->a_m[ap->a_centeridx] = pg;
 
+out:
 	ZFS_EXIT(zfsvfs);
 	fstrans_done(mp);
 
@@ -6039,14 +6046,13 @@ zfs_putapage(vnode_t *vp, page_t **pp, i
 	voff_t		len, klen;
 	int		err;
 
-	bool async = (flags & PGO_SYNCIO) == 0;
 	bool *cleanedp;
 	struct uvm_object *uobj = >v_uobj;
 	kmutex_t *mtx = uobj->vmobjlock;
 
 	if (zp->z_sa_hdl == NULL) {
 		err = 0;
-		goto out_unbusy;
+		goto out;
 	}
 
 	/*
@@ -6120,14 +6126,8 @@ zfs_putapage(vnode_t *vp, page_t **pp, i
 	}
 	dmu_tx_commit(tx);
 
-out_unbusy:
-	mutex_enter(mtx);
-	mutex_enter(_pageqlock);
-	uvm_page_unbusy(pp, count);
-	mutex_exit(_pageqlock);
-	mutex_exit(mtx);
-
 out:
+	uvm_aio_aiodone_pages(pp, count, true, err);
 	return (err);
 }
 

Index: src/sys/rump/librump/rumpkern/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.173 src/sys/rump/librump/rumpkern/vm.c:1.173.14.1
--- src/sys/rump/librump/rumpkern/vm.c:1.173	Sun May 14 13:49:55 2017
+++ src/sys/rump/librump/rumpkern/vm.c	Tue 

CVS commit: [netbsd-9] src/doc

2021-07-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul  6 04:23:55 UTC 2021

Modified Files:
src/doc [netbsd-9]: CHANGES-9.3

Log Message:
Tickets #1312 - #1317


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.13 -r1.1.2.14 src/doc/CHANGES-9.3

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

Modified files:

Index: src/doc/CHANGES-9.3
diff -u src/doc/CHANGES-9.3:1.1.2.13 src/doc/CHANGES-9.3:1.1.2.14
--- src/doc/CHANGES-9.3:1.1.2.13	Tue Jul  6 03:46:24 2021
+++ src/doc/CHANGES-9.3	Tue Jul  6 04:23:55 2021
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.3,v 1.1.2.13 2021/07/06 03:46:24 martin Exp $
+# $NetBSD: CHANGES-9.3,v 1.1.2.14 2021/07/06 04:23:55 martin Exp $
 
 A complete list of changes from the NetBSD 9.2 release to the NetBSD 9.3
 release:
@@ -289,3 +289,53 @@ sys/miscfs/kernfs/kernfs_vnops.c		1.169,
 	Fix permissons on /kern/{r,}rootdev.
 	[dholland, ticket #1318]
 
+sys/arch/hppa/hppa/intr.c			1.4
+
+	Fix off by one which resulted in all idle time reported as interrupt
+	time.
+	[macallan, ticket #1312]
+
+common/lib/libc/arch/arm/atomic/atomic_add_64.S	1.12
+common/lib/libc/arch/arm/atomic/atomic_and_64.S	1.11
+common/lib/libc/arch/arm/atomic/atomic_cas_8.S	1.8
+common/lib/libc/arch/arm/atomic/atomic_nand_64.S 1.5
+common/lib/libc/arch/arm/atomic/atomic_or_64.S	1.12
+common/lib/libc/arch/arm/atomic/atomic_sub_64.S	1.3
+common/lib/libc/arch/arm/atomic/atomic_swap_64.S 1.13
+common/lib/libc/arch/arm/atomic/atomic_xor_64.S	1.5
+
+	Whitespace fixes to help later pullups.
+	[skrll, ticket #1313]
+
+common/lib/libc/arch/aarch64/atomic/atomic_nand_16.S 1.3
+common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S 1.3
+common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S 1.4
+common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S 1.3
+common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S 1.4
+common/lib/libc/arch/aarch64/atomic/atomic_nand_8.S 1.3
+common/lib/libc/arch/aarch64/atomic/atomic_nand_8.S 1.4
+
+	Fix the logic operation for atomic_nand_{8,16,32,64}.
+	[skrll, ticket #1314]
+
+external/cddl/osnet/sys/kern/printf.c		1.3
+
+	Use vpanic, not vprintf and then panic.
+	[riastradh, ticket #1315]
+
+external/cddl/osnet/dist/uts/common/dtrace/dtrace.c 1.41
+
+	Remove a pointless printf.
+	[riastradh, ticket #1316]
+
+external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c 1.71 (patch)
+sys/rump/librump/rumpkern/vm.c			1.191 (patch)
+sys/rump/librump/rumpvfs/vm_vfs.c		1.39-1.41 (patch)
+sys/uvm/uvm_anon.c1.80 (patch)
+sys/uvm/uvm_page.c1.248 (patch)
+sys/uvm/uvm_pager.c1.130 (patch)
+tests/rump/rumpkern/t_vm.c			1.5,1.6 (patch)
+
+	PR 55702, PR 55945: fix uvm pageout crashes.
+	[riastradh, ticket #1317]
+



CVS commit: [netbsd-9] src/external/cddl/osnet/dist/uts/common/dtrace

2021-07-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul  6 04:17:03 UTC 2021

Modified Files:
src/external/cddl/osnet/dist/uts/common/dtrace [netbsd-9]: dtrace.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1316):

external/cddl/osnet/dist/uts/common/dtrace/dtrace.c: revision 1.41

Remove a pointless printf.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.39.2.1 \
src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c
diff -u src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c:1.39 src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c:1.39.2.1
--- src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c:1.39	Fri Jul  5 08:28:52 2019
+++ src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c	Tue Jul  6 04:17:03 2021
@@ -13840,7 +13840,6 @@ doferr:
 	return (NULL);
 #endif /* __FreeBSD__ */
 #ifdef __NetBSD__
-	printf("dtrace: XXX %s not implemented (name=%s)\n", __func__, name);
 	return (NULL);
 #endif /* __NetBSD__ */
 }



CVS commit: [netbsd-9] src/external/cddl/osnet/sys/kern

2021-07-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul  6 04:15:27 UTC 2021

Modified Files:
src/external/cddl/osnet/sys/kern [netbsd-9]: printf.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1315):

external/cddl/osnet/sys/kern/printf.c: revision 1.3

Use vpanic, not vprintf and then panic.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.4.1 src/external/cddl/osnet/sys/kern/printf.c

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

Modified files:

Index: src/external/cddl/osnet/sys/kern/printf.c
diff -u src/external/cddl/osnet/sys/kern/printf.c:1.2 src/external/cddl/osnet/sys/kern/printf.c:1.2.4.1
--- src/external/cddl/osnet/sys/kern/printf.c:1.2	Mon May 28 21:05:09 2018
+++ src/external/cddl/osnet/sys/kern/printf.c	Tue Jul  6 04:15:26 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: printf.c,v 1.2 2018/05/28 21:05:09 chs Exp $	*/
+/*	$NetBSD: printf.c,v 1.2.4.1 2021/07/06 04:15:26 martin Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -41,10 +41,8 @@ vcmn_err(int ce, const char *fmt, va_lis
 	char buf[256];
 	size_t len;
 
-	if (ce == CE_PANIC) {
-		vprintf(fmt, adx);
-		panic("panic");
-	}
+	if (ce == CE_PANIC)
+		vpanic(fmt, adx);
 
 	if ((uint_t)ce < CE_IGNORE) {
 		strcpy(buf, ce_prefix[ce]);



CVS commit: [netbsd-9] src/common/lib/libc/arch/aarch64/atomic

2021-07-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul  6 04:13:50 UTC 2021

Modified Files:
src/common/lib/libc/arch/aarch64/atomic [netbsd-9]: atomic_nand_16.S
atomic_nand_32.S atomic_nand_64.S atomic_nand_8.S

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1314):

common/lib/libc/arch/aarch64/atomic/atomic_nand_8.S: revision 1.3
common/lib/libc/arch/aarch64/atomic/atomic_nand_8.S: revision 1.4
common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S: revision 1.3
common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S: revision 1.4
common/lib/libc/arch/aarch64/atomic/atomic_nand_16.S: revision 1.3
common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S: revision 1.3
common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S: revision 1.4

Fix the logic operation for atomic_nand_{8,16,32,64}

 From the gcc docs the operations are as follows
  { tmp = *ptr; *ptr = ~(tmp & value); return tmp; }   // nand
  { tmp = ~(*ptr & value); *ptr = tmp; return *ptr; }   // nand

yes, this is really rather strange.

typo in comment s/pte/ptr/


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.1.28.1 \
src/common/lib/libc/arch/aarch64/atomic/atomic_nand_16.S \
src/common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S \
src/common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S \
src/common/lib/libc/arch/aarch64/atomic/atomic_nand_8.S

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

Modified files:

Index: src/common/lib/libc/arch/aarch64/atomic/atomic_nand_16.S
diff -u src/common/lib/libc/arch/aarch64/atomic/atomic_nand_16.S:1.1 src/common/lib/libc/arch/aarch64/atomic/atomic_nand_16.S:1.1.28.1
--- src/common/lib/libc/arch/aarch64/atomic/atomic_nand_16.S:1.1	Sun Aug 10 05:47:35 2014
+++ src/common/lib/libc/arch/aarch64/atomic/atomic_nand_16.S	Tue Jul  6 04:13:50 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: atomic_nand_16.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */
+/* $NetBSD: atomic_nand_16.S,v 1.1.28.1 2021/07/06 04:13:50 martin Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,11 +31,14 @@
 
 #include "atomic_op_asm.h"
 
+/*
+ * { tmp = *ptr; *ptr = ~(tmp & value); return tmp; }   // nand
+ */
 ENTRY_NP(_atomic_nand_16)
 	mov	x4, x0
-1:	ldxrh	w0, [x4]		/* load old value (to be returned) */
-	mvn	w3, w0			/* complement source */
-	and	w3, w3, w1		/* calculate new value */
+1:	ldxrh	w0, [x4]		/* load old value (*ptr) */
+	and	w3, w0, w1		/* w3 =  (*ptr & value) */
+	mvn	w3, w3			/* w3 = ~(*pte & value) */
 	stxrh	w2, w3, [x4]		/* try to store */
 	cbnz	w2, 1b			/*   succeed? no, try again */
 	dmb	st
@@ -47,11 +50,15 @@ ATOMIC_OP_ALIAS(atomic_nand_ushort,_atom
 STRONG_ALIAS(__sync_fetch_and_nand_2,_atomic_nand_16)
 STRONG_ALIAS(_atomic_nand_ushort,_atomic_nand_16)
 
+
+/*
+ * { tmp = ~(*ptr & value); *ptr = tmp; return *ptr; }   // nand
+ */
 ENTRY_NP(_atomic_nand_16_nv)
 	mov	x4, x0			/* need r0 for return value */
-1:	ldxrh	w0, [x4]		/* load old value */
-	mvn	w0, w0			/* complement source */
-	and	w0, w0, w1		/* calculate new value (return value) */
+1:	ldxrh	w0, [x4]		/* load old value (*ptr) */
+	and	w0, w0, w1		/* w0 =  (*ptr & value) */
+	mvn	w0, w0			/* w0 = ~(*pte & value), return value */
 	stxrh	w2, w0, [x4]		/* try to store */
 	cbnz	w2, 1b			/*   succeed? no, try again? */
 	dmb	st
Index: src/common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S
diff -u src/common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S:1.1 src/common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S:1.1.28.1
--- src/common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S:1.1	Sun Aug 10 05:47:35 2014
+++ src/common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S	Tue Jul  6 04:13:50 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: atomic_nand_32.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */
+/* $NetBSD: atomic_nand_32.S,v 1.1.28.1 2021/07/06 04:13:50 martin Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,11 +31,14 @@
 
 #include "atomic_op_asm.h"
 
+/*
+ * { tmp = *ptr; *ptr = ~(tmp & value); return tmp; }   // nand
+ */
 ENTRY_NP(_atomic_nand_32)
 	mov	x4, x0
 1:	ldxr	w0, [x4]		/* load old value (to be returned) */
-	mvn	w3, w0			/* complement source */
-	and	w3, w3, w1		/* calculate new value */
+	and	w3, w0, w1		/* w3 =  (*ptr & value) */
+	mvn	w3, w3			/* x3 = ~(*ptr & value) */
 	stxr	w2, w3, [x4]		/* try to store */
 	cbnz	w2, 1b			/*   succeed? no, try again */
 	dmb	st
@@ -47,11 +50,15 @@ ATOMIC_OP_ALIAS(atomic_nand_uint,_atomic
 STRONG_ALIAS(__sync_fetch_and_nand_4,_atomic_nand_32)
 STRONG_ALIAS(_atomic_nand_uint,_atomic_nand_32)
 
+
+/*
+ * { tmp = ~(*ptr & value); *ptr = tmp; return *ptr; }   // nand
+ */
 ENTRY_NP(_atomic_nand_32_nv)
 	mov	x4, x0			/* need r0 for return value */
-1:	ldxr	w0, [x4]		/* load old value */
-	mvn	w0, w0			/* complement source */
-	and	w0, w0, w1		/* calculate new value (return value) */
+1:	ldxr	w0, [x4]		

CVS commit: [netbsd-9] src/common/lib/libc/arch/arm/atomic

2021-07-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul  6 04:11:31 UTC 2021

Modified Files:
src/common/lib/libc/arch/arm/atomic [netbsd-9]: atomic_add_64.S
atomic_and_64.S atomic_cas_8.S atomic_nand_64.S atomic_or_64.S
atomic_sub_64.S atomic_swap_64.S atomic_xor_64.S

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1313):

common/lib/libc/arch/arm/atomic/atomic_xor_64.S: revision 1.5
common/lib/libc/arch/arm/atomic/atomic_nand_64.S: revision 1.5
common/lib/libc/arch/arm/atomic/atomic_or_64.S: revision 1.12
common/lib/libc/arch/arm/atomic/atomic_cas_8.S: revision 1.8
common/lib/libc/arch/arm/atomic/atomic_sub_64.S: revision 1.3
common/lib/libc/arch/arm/atomic/atomic_and_64.S: revision 1.11
common/lib/libc/arch/arm/atomic/atomic_swap_64.S: revision 1.13
common/lib/libc/arch/arm/atomic/atomic_add_64.S: revision 1.12

Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.28.1 \
src/common/lib/libc/arch/arm/atomic/atomic_add_64.S
cvs rdiff -u -r1.10 -r1.10.28.1 \
src/common/lib/libc/arch/arm/atomic/atomic_and_64.S
cvs rdiff -u -r1.7 -r1.7.28.1 \
src/common/lib/libc/arch/arm/atomic/atomic_cas_8.S
cvs rdiff -u -r1.4 -r1.4.18.1 \
src/common/lib/libc/arch/arm/atomic/atomic_nand_64.S
cvs rdiff -u -r1.10.28.1 -r1.10.28.2 \
src/common/lib/libc/arch/arm/atomic/atomic_or_64.S
cvs rdiff -u -r1.2 -r1.2.32.1 \
src/common/lib/libc/arch/arm/atomic/atomic_sub_64.S
cvs rdiff -u -r1.10.18.2 -r1.10.18.3 \
src/common/lib/libc/arch/arm/atomic/atomic_swap_64.S
cvs rdiff -u -r1.3.32.1 -r1.3.32.2 \
src/common/lib/libc/arch/arm/atomic/atomic_xor_64.S

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

Modified files:

Index: src/common/lib/libc/arch/arm/atomic/atomic_add_64.S
diff -u src/common/lib/libc/arch/arm/atomic/atomic_add_64.S:1.11 src/common/lib/libc/arch/arm/atomic/atomic_add_64.S:1.11.28.1
--- src/common/lib/libc/arch/arm/atomic/atomic_add_64.S:1.11	Tue Mar  4 16:15:28 2014
+++ src/common/lib/libc/arch/arm/atomic/atomic_add_64.S	Tue Jul  6 04:11:31 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_add_64.S,v 1.11 2014/03/04 16:15:28 matt Exp $	*/
+/*	$NetBSD: atomic_add_64.S,v 1.11.28.1 2021/07/06 04:11:31 martin Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -33,7 +33,7 @@
 #ifdef _ARM_ARCH_6
 
 ENTRY_NP(_atomic_add_64_nv)
-	push	{r3,r4}			/* save temporary */
+	push	{r3, r4}		/* save temporary */
 	mov	ip, r0			/* need r0 for return value */
 #ifndef __ARM_EABI__
 	mov	r3, r2
@@ -50,7 +50,7 @@ ENTRY_NP(_atomic_add_64_nv)
 #else
 	mcr	p15, 0, r4, c7, c10, 5	/* data memory barrier */
 #endif
-	pop	{r3,r4}			/* restore temporary */
+	pop	{r3, r4}		/* restore temporary */
 	RET/* return new value */
 END(_atomic_add_64_nv)
 

Index: src/common/lib/libc/arch/arm/atomic/atomic_and_64.S
diff -u src/common/lib/libc/arch/arm/atomic/atomic_and_64.S:1.10 src/common/lib/libc/arch/arm/atomic/atomic_and_64.S:1.10.28.1
--- src/common/lib/libc/arch/arm/atomic/atomic_and_64.S:1.10	Tue Mar  4 16:15:28 2014
+++ src/common/lib/libc/arch/arm/atomic/atomic_and_64.S	Tue Jul  6 04:11:31 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_and_64.S,v 1.10 2014/03/04 16:15:28 matt Exp $	*/
+/*	$NetBSD: atomic_and_64.S,v 1.10.28.1 2021/07/06 04:11:31 martin Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -33,7 +33,7 @@
 #ifdef _ARM_ARCH_6
 
 ENTRY_NP(_atomic_and_64_nv)
-	push	{r3,r4}			/* save temporary */
+	push	{r3, r4}		/* save temporary */
 #ifndef __ARM_EABI__
 	mov	r3, r2
 	mov	r2, r1
@@ -50,7 +50,7 @@ ENTRY_NP(_atomic_and_64_nv)
 #else
 	mcr	p15, 0, r4, c7, c10, 5	/* data memory barrier */
 #endif
-	pop	{r3,r4}			/* restore temporary */
+	pop	{r3, r4}		/* restore temporary */
 	RET/* return new value */
 END(_atomic_and_64_nv)
 

Index: src/common/lib/libc/arch/arm/atomic/atomic_cas_8.S
diff -u src/common/lib/libc/arch/arm/atomic/atomic_cas_8.S:1.7 src/common/lib/libc/arch/arm/atomic/atomic_cas_8.S:1.7.28.1
--- src/common/lib/libc/arch/arm/atomic/atomic_cas_8.S:1.7	Tue Mar  4 16:15:28 2014
+++ src/common/lib/libc/arch/arm/atomic/atomic_cas_8.S	Tue Jul  6 04:11:31 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: atomic_cas_8.S,v 1.7 2014/03/04 16:15:28 matt Exp $ */
+/* $NetBSD: atomic_cas_8.S,v 1.7.28.1 2021/07/06 04:11:31 martin Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -55,7 +55,7 @@ ENTRY_NP(_atomic_cas_8)
 	mcr	p15, 0, r3, c7, c10, 4	/* data synchronization barrier */
 #endif
 2:	RET/* return. */
-	END(_atomic_cas_8)
+END(_atomic_cas_8)
 
 ATOMIC_OP_ALIAS(atomic_cas_8,_atomic_cas_8)
 STRONG_ALIAS(_atomic_cas_char,_atomic_cas_8)

Index: src/common/lib/libc/arch/arm/atomic/atomic_nand_64.S
diff -u src/common/lib/libc/arch/arm/atomic/atomic_nand_64.S:1.4 

CVS commit: [netbsd-9] src/sys/arch/hppa/hppa

2021-07-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul  6 04:05:14 UTC 2021

Modified Files:
src/sys/arch/hppa/hppa [netbsd-9]: intr.c

Log Message:
Pull up following revision(s) (requested by macallan in ticket #1312):

sys/arch/hppa/hppa/intr.c: revision 1.4

fix off by one which resulted in all idle time reported as interrupt time
final fix from nick@


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.2.1 src/sys/arch/hppa/hppa/intr.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/arch/hppa/hppa/intr.c
diff -u src/sys/arch/hppa/hppa/intr.c:1.3 src/sys/arch/hppa/hppa/intr.c:1.3.2.1
--- src/sys/arch/hppa/hppa/intr.c:1.3	Sat May  4 13:04:36 2019
+++ src/sys/arch/hppa/hppa/intr.c	Tue Jul  6 04:05:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.3 2019/05/04 13:04:36 skrll Exp $	*/
+/*	$NetBSD: intr.c,v 1.3.2.1 2021/07/06 04:05:14 martin Exp $	*/
 /*	$OpenBSD: intr.c,v 1.27 2009/12/31 12:52:35 jsing Exp $	*/
 
 /*
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.3 2019/05/04 13:04:36 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.3.2.1 2021/07/06 04:05:14 martin Exp $");
 
 #define __MUTEX_PRIVATE
 
@@ -435,7 +435,7 @@ hppa_intr_dispatch(int ncpl, int eiem, s
 		ib->ib_evcnt.ev_count++;
 		arg = ib->ib_arg;
 		if (arg == NULL) {
-			clkframe.cf_flags = (ci->ci_intr_depth ?
+			clkframe.cf_flags = (ci->ci_intr_depth > 1 ?
 			TFF_INTR : 0);
 			clkframe.cf_spl = ncpl;
 			if (frame != NULL) {



CVS commit: [netbsd-9] src/doc

2021-07-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul  6 03:46:24 UTC 2021

Modified Files:
src/doc [netbsd-9]: CHANGES-9.3

Log Message:
Ticket #1318


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.12 -r1.1.2.13 src/doc/CHANGES-9.3

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

Modified files:

Index: src/doc/CHANGES-9.3
diff -u src/doc/CHANGES-9.3:1.1.2.12 src/doc/CHANGES-9.3:1.1.2.13
--- src/doc/CHANGES-9.3:1.1.2.12	Sat Jul  3 10:20:00 2021
+++ src/doc/CHANGES-9.3	Tue Jul  6 03:46:24 2021
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.3,v 1.1.2.12 2021/07/03 10:20:00 martin Exp $
+# $NetBSD: CHANGES-9.3,v 1.1.2.13 2021/07/06 03:46:24 martin Exp $
 
 A complete list of changes from the NetBSD 9.2 release to the NetBSD 9.3
 release:
@@ -283,3 +283,9 @@ sys/dev/ic/dp8390.c1.99
 	so that the media-related ioctls work.
 	[thorpej, ticket #1311]
 
+sys/miscfs/kernfs/kernfs_vnops.c		1.169,1.170
+
+	Add missing VOP_KQFILTER to kernfs.
+	Fix permissons on /kern/{r,}rootdev.
+	[dholland, ticket #1318]
+



CVS commit: [netbsd-9] src/sys/miscfs/kernfs

2021-07-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul  6 03:45:11 UTC 2021

Modified Files:
src/sys/miscfs/kernfs [netbsd-9]: kernfs_vnops.c

Log Message:
Pull up following revision(s) (requested by dholland in ticket #1318):

sys/miscfs/kernfs/kernfs_vnops.c: revision 1.169
sys/miscfs/kernfs/kernfs_vnops.c: revision 1.170

Add missing VOP_KQFILTER to kernfs.

Not sure if lack of it can be used for local DoS or not, but best to
fix.

 -

Fix perms on /kern/{r,}rootdev.


To generate a diff of this commit:
cvs rdiff -u -r1.160.4.2 -r1.160.4.3 src/sys/miscfs/kernfs/kernfs_vnops.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/miscfs/kernfs/kernfs_vnops.c
diff -u src/sys/miscfs/kernfs/kernfs_vnops.c:1.160.4.2 src/sys/miscfs/kernfs/kernfs_vnops.c:1.160.4.3
--- src/sys/miscfs/kernfs/kernfs_vnops.c:1.160.4.2	Wed Feb 12 19:59:22 2020
+++ src/sys/miscfs/kernfs/kernfs_vnops.c	Tue Jul  6 03:45:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kernfs_vnops.c,v 1.160.4.2 2020/02/12 19:59:22 martin Exp $	*/
+/*	$NetBSD: kernfs_vnops.c,v 1.160.4.3 2021/07/06 03:45:11 martin Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.160.4.2 2020/02/12 19:59:22 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.160.4.3 2021/07/06 03:45:11 martin Exp $");
 
 #include 
 #include 
@@ -91,8 +91,8 @@ const struct kern_target kern_targets[] 
 #if 0
  { DT_DIR, N("root"),  0,KFSnull,VDIR, DIR_MODE   },
 #endif
- { DT_BLK, N("rootdev"),   , KFSdevice,  VBLK, READ_MODE  },
- { DT_CHR, N("rrootdev"),  ,KFSdevice,  VCHR, READ_MODE  },
+ { DT_BLK, N("rootdev"),   , KFSdevice,  VBLK, UREAD_MODE  },
+ { DT_CHR, N("rrootdev"),  ,KFSdevice,  VCHR, UREAD_MODE  },
  { DT_REG, N("time"),  0,KFStime,VREG, READ_MODE  },
 			/* XXXUNCONST */
  { DT_REG, N("version"),   __UNCONST(version),
@@ -197,6 +197,7 @@ const struct vnodeopv_entry_desc kernfs_
 	{ _fcntl_desc, kernfs_fcntl },		/* fcntl */
 	{ _ioctl_desc, kernfs_ioctl },		/* ioctl */
 	{ _poll_desc, kernfs_poll },		/* poll */
+	{ _kqfilter_desc, genfs_kqfilter },		/* kqfilter */
 	{ _revoke_desc, kernfs_revoke },		/* revoke */
 	{ _fsync_desc, kernfs_fsync },		/* fsync */
 	{ _seek_desc, kernfs_seek },		/* seek */
@@ -245,6 +246,7 @@ const struct vnodeopv_entry_desc kernfs_
 	{ _fcntl_desc, spec_fcntl },		/* fcntl */
 	{ _ioctl_desc, spec_ioctl },		/* ioctl */
 	{ _poll_desc, spec_poll },			/* poll */
+	{ _kqfilter_desc, genfs_kqfilter },		/* kqfilter */
 	{ _revoke_desc, spec_revoke },		/* revoke */
 	{ _fsync_desc, spec_fsync },		/* fsync */
 	{ _seek_desc, spec_seek },			/* seek */



CVS commit: src/sys/miscfs/kernfs

2021-07-05 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Jul  6 03:23:03 UTC 2021

Modified Files:
src/sys/miscfs/kernfs: kernfs_vnops.c

Log Message:
Fix perms on /kern/{r,}rootdev.


To generate a diff of this commit:
cvs rdiff -u -r1.169 -r1.170 src/sys/miscfs/kernfs/kernfs_vnops.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/miscfs/kernfs/kernfs_vnops.c
diff -u src/sys/miscfs/kernfs/kernfs_vnops.c:1.169 src/sys/miscfs/kernfs/kernfs_vnops.c:1.170
--- src/sys/miscfs/kernfs/kernfs_vnops.c:1.169	Tue Jul  6 03:22:44 2021
+++ src/sys/miscfs/kernfs/kernfs_vnops.c	Tue Jul  6 03:23:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kernfs_vnops.c,v 1.169 2021/07/06 03:22:44 dholland Exp $	*/
+/*	$NetBSD: kernfs_vnops.c,v 1.170 2021/07/06 03:23:03 dholland Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.169 2021/07/06 03:22:44 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.170 2021/07/06 03:23:03 dholland Exp $");
 
 #include 
 #include 
@@ -91,8 +91,8 @@ const struct kern_target kern_targets[] 
 #if 0
  { DT_DIR, N("root"),  0,KFSnull,VDIR, DIR_MODE   },
 #endif
- { DT_BLK, N("rootdev"),   , KFSdevice,  VBLK, READ_MODE  },
- { DT_CHR, N("rrootdev"),  ,KFSdevice,  VCHR, READ_MODE  },
+ { DT_BLK, N("rootdev"),   , KFSdevice,  VBLK, UREAD_MODE  },
+ { DT_CHR, N("rrootdev"),  ,KFSdevice,  VCHR, UREAD_MODE  },
  { DT_REG, N("time"),  0,KFStime,VREG, READ_MODE  },
 			/* XXXUNCONST */
  { DT_REG, N("version"),   __UNCONST(version),



CVS commit: src/sys/miscfs/kernfs

2021-07-05 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Jul  6 03:22:44 UTC 2021

Modified Files:
src/sys/miscfs/kernfs: kernfs_vnops.c

Log Message:
Add missing VOP_KQFILTER to kernfs.

Not sure if lack of it can be used for local DoS or not, but best to
fix.


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/sys/miscfs/kernfs/kernfs_vnops.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/miscfs/kernfs/kernfs_vnops.c
diff -u src/sys/miscfs/kernfs/kernfs_vnops.c:1.168 src/sys/miscfs/kernfs/kernfs_vnops.c:1.169
--- src/sys/miscfs/kernfs/kernfs_vnops.c:1.168	Tue Jun 29 22:34:08 2021
+++ src/sys/miscfs/kernfs/kernfs_vnops.c	Tue Jul  6 03:22:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kernfs_vnops.c,v 1.168 2021/06/29 22:34:08 dholland Exp $	*/
+/*	$NetBSD: kernfs_vnops.c,v 1.169 2021/07/06 03:22:44 dholland Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.168 2021/06/29 22:34:08 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.169 2021/07/06 03:22:44 dholland Exp $");
 
 #include 
 #include 
@@ -199,6 +199,7 @@ const struct vnodeopv_entry_desc kernfs_
 	{ _fcntl_desc, kernfs_fcntl },		/* fcntl */
 	{ _ioctl_desc, kernfs_ioctl },		/* ioctl */
 	{ _poll_desc, kernfs_poll },		/* poll */
+	{ _kqfilter_desc, genfs_kqfilter },		/* kqfilter */
 	{ _revoke_desc, kernfs_revoke },		/* revoke */
 	{ _fsync_desc, kernfs_fsync },		/* fsync */
 	{ _seek_desc, kernfs_seek },		/* seek */
@@ -249,6 +250,7 @@ const struct vnodeopv_entry_desc kernfs_
 	{ _fcntl_desc, spec_fcntl },		/* fcntl */
 	{ _ioctl_desc, spec_ioctl },		/* ioctl */
 	{ _poll_desc, spec_poll },			/* poll */
+	{ _kqfilter_desc, genfs_kqfilter },		/* kqfilter */
 	{ _revoke_desc, spec_revoke },		/* revoke */
 	{ _fsync_desc, spec_fsync },		/* fsync */
 	{ _seek_desc, spec_seek },			/* seek */



CVS commit: src/sys/net

2021-07-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Tue Jul  6 02:39:46 UTC 2021

Modified Files:
src/sys/net: if_vlan.c

Log Message:
Drop unicast packets that are not for us
when vlan(4) is not in promisc


To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.157 src/sys/net/if_vlan.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/net/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.156 src/sys/net/if_vlan.c:1.157
--- src/sys/net/if_vlan.c:1.156	Tue Jul  6 02:34:12 2021
+++ src/sys/net/if_vlan.c	Tue Jul  6 02:39:46 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.156 2021/07/06 02:34:12 yamaguchi Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.157 2021/07/06 02:39:46 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.156 2021/07/06 02:34:12 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.157 2021/07/06 02:39:46 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1661,6 +1661,24 @@ vlan_input(struct ifnet *ifp, struct mbu
 		m_adj(m, mib->ifvm_encaplen);
 	}
 
+	/*
+	 * Drop promiscuously received packets if we are not in
+	 * promiscuous mode
+	 */
+	if ((m->m_flags & (M_BCAST | M_MCAST)) == 0 &&
+	(ifp->if_flags & IFF_PROMISC) &&
+	(ifv->ifv_if.if_flags & IFF_PROMISC) == 0) {
+		struct ether_header *eh;
+
+		eh = mtod(m, struct ether_header *);
+		if (memcmp(CLLADDR(ifv->ifv_if.if_sadl),
+		eh->ether_dhost, ETHER_ADDR_LEN) != 0) {
+			m_freem(m);
+			if_statinc(>ifv_if, if_ierrors);
+			goto out;
+		}
+	}
+
 	m_set_rcvif(m, >ifv_if);
 
 	if (pfil_run_hooks(ifp->if_pfil, , ifp, PFIL_IN) != 0)



CVS commit: src/sys/net

2021-07-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Tue Jul  6 02:34:12 UTC 2021

Modified Files:
src/sys/net: if_vlan.c

Log Message:
vlan: added NULL check for the parent interface

The pointer may set to NULL by vlan_unconfig
while packet processing


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/sys/net/if_vlan.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/net/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.155 src/sys/net/if_vlan.c:1.156
--- src/sys/net/if_vlan.c:1.155	Tue Jul  6 01:16:01 2021
+++ src/sys/net/if_vlan.c	Tue Jul  6 02:34:12 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.155 2021/07/06 01:16:01 yamaguchi Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.156 2021/07/06 02:34:12 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.155 2021/07/06 01:16:01 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.156 2021/07/06 02:34:12 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1328,6 +1328,12 @@ vlan_start(struct ifnet *ifp)
 	mib = vlan_getref_linkmib(ifv, );
 	if (mib == NULL)
 		return;
+
+	if (__predict_false(mib->ifvm_p == NULL)) {
+		vlan_putref_linkmib(mib, );
+		return;
+	}
+
 	p = mib->ifvm_p;
 	ec = (void *)mib->ifvm_p;
 
@@ -1471,6 +1477,12 @@ vlan_transmit(struct ifnet *ifp, struct 
 		return ENETDOWN;
 	}
 
+	if (__predict_false(mib->ifvm_p == NULL)) {
+		vlan_putref_linkmib(mib, );
+		m_freem(m);
+		return ENETDOWN;
+	}
+
 	p = mib->ifvm_p;
 	ec = (void *)mib->ifvm_p;
 



CVS commit: src/tests/net/if_vlan

2021-07-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Tue Jul  6 01:18:22 UTC 2021

Modified Files:
src/tests/net/if_vlan: t_vlan.sh

Log Message:
vlan: added checks of linkstate


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/tests/net/if_vlan/t_vlan.sh

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

Modified files:

Index: src/tests/net/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.18 src/tests/net/if_vlan/t_vlan.sh:1.19
--- src/tests/net/if_vlan/t_vlan.sh:1.18	Fri Jul  2 04:38:10 2021
+++ src/tests/net/if_vlan/t_vlan.sh	Tue Jul  6 01:18:22 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.18 2021/07/02 04:38:10 yamaguchi Exp $
+#	$NetBSD: t_vlan.sh,v 1.19 2021/07/06 01:18:22 yamaguchi Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -589,8 +589,12 @@ vlan_configs_body_common()
 	$atf_ifconfig shmif1 link b0:a0:75:00:01:01 active
 	$atf_ifconfig vlan0 create
 
+	atf_check -s exit:0 -o match:'status: +down' \
+	rump.ifconfig vlan0
 	$atf_ifconfig vlan0 vlan 10 vlanif shmif0
 	$atf_ifconfig vlan0 -vlanif
+	atf_check -s exit:0 -o match:'status: +down' \
+	rump.ifconfig vlan0
 
 	$atf_ifconfig vlan0 vlan 10 vlanif shmif0
 	$atf_ifconfig vlan0 -vlanif shmif0



CVS commit: src/sys/net

2021-07-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Tue Jul  6 01:16:01 UTC 2021

Modified Files:
src/sys/net: if_vlan.c

Log Message:
vlan: set the link state to DOWN when its parent detaches


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 src/sys/net/if_vlan.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/net/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.154 src/sys/net/if_vlan.c:1.155
--- src/sys/net/if_vlan.c:1.154	Wed Jun 16 00:21:19 2021
+++ src/sys/net/if_vlan.c	Tue Jul  6 01:16:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.154 2021/06/16 00:21:19 riastradh Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.155 2021/07/06 01:16:01 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.154 2021/06/16 00:21:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.155 2021/07/06 01:16:01 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -366,6 +366,7 @@ vlan_clone_create(struct if_clone *ifc, 
 	 * Set the link state to down.
 	 * When the parent interface attaches we will use that link state.
 	 * When the parent interface link state changes, so will ours.
+	 * When the parent interface detaches, set the link state to down.
 	 */
 	ifp->if_link_state = LINK_STATE_DOWN;
 
@@ -685,6 +686,7 @@ vlan_unconfig_locked(struct ifvlan *ifv,
 	PSLIST_ENTRY_DESTROY(ifv, ifv_hash);
 
 	vlan_linkmib_update(ifv, nmib);
+	if_link_state_change(ifp, LINK_STATE_DOWN);
 
 	mutex_exit(>ifv_lock);
 



CVS commit: src/sys/ufs/chfs

2021-07-05 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jul  5 21:43:56 UTC 2021

Modified Files:
src/sys/ufs/chfs: chfs_vnops.c

Log Message:
whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/ufs/chfs/chfs_vnops.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/chfs/chfs_vnops.c
diff -u src/sys/ufs/chfs/chfs_vnops.c:1.43 src/sys/ufs/chfs/chfs_vnops.c:1.44
--- src/sys/ufs/chfs/chfs_vnops.c:1.43	Tue Jun 29 22:34:09 2021
+++ src/sys/ufs/chfs/chfs_vnops.c	Mon Jul  5 21:43:56 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: chfs_vnops.c,v 1.43 2021/06/29 22:34:09 dholland Exp $	*/
+/*	$NetBSD: chfs_vnops.c,v 1.44 2021/07/05 21:43:56 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2010 Department of Software Engineering,
@@ -1598,7 +1598,7 @@ int
 const struct vnodeopv_entry_desc chfs_vnodeop_entries[] =
 	{
 		{ _default_desc, vn_default_error },
-	{ _parsepath_desc, genfs_parsepath },	/* parsepath */
+		{ _parsepath_desc, genfs_parsepath },	/* parsepath */
 		{ _lookup_desc, chfs_lookup },
 		{ _create_desc, chfs_create },
 		{ _mknod_desc, chfs_mknod },



CVS commit: src/usr.bin/xlint/lint1

2021-07-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jul  5 19:55:51 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: decl.c

Log Message:
lint: reduce noise in storage_class_name

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.194 -r1.195 src/usr.bin/xlint/lint1/decl.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/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.194 src/usr.bin/xlint/lint1/decl.c:1.195
--- src/usr.bin/xlint/lint1/decl.c:1.194	Mon Jul  5 19:48:32 2021
+++ src/usr.bin/xlint/lint1/decl.c	Mon Jul  5 19:55:51 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.194 2021/07/05 19:48:32 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.195 2021/07/05 19:55:51 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.194 2021/07/05 19:48:32 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.195 2021/07/05 19:55:51 rillig Exp $");
 #endif
 
 #include 
@@ -1783,20 +1783,17 @@ newtag(sym_t *tag, scl_t scl, bool decl,
 const char *
 storage_class_name(scl_t sc)
 {
-	const	char *s;
-
 	switch (sc) {
-	case EXTERN:	s = "extern";	break;
-	case STATIC:	s = "static";	break;
-	case AUTO:	s = "auto";	break;
-	case REG:	s = "register";	break;
-	case TYPEDEF:	s = "typedef";	break;
-	case STRUCT_TAG:s = "struct";	break;
-	case UNION_TAG:	s = "union";	break;
-	case ENUM_TAG:	s = "enum";	break;
+	case EXTERN:	return "extern";
+	case STATIC:	return "static";
+	case AUTO:	return "auto";
+	case REG:	return "register";
+	case TYPEDEF:	return "typedef";
+	case STRUCT_TAG:return "struct";
+	case UNION_TAG:	return "union";
+	case ENUM_TAG:	return "enum";
 	default:	lint_assert(/*CONSTCOND*/false);
 	}
-	return s;
 }
 
 /*



CVS commit: src/usr.bin/xlint/lint1

2021-07-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jul  5 19:59:10 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: refer to documentation about the 'notype' rules in the grammar


To generate a diff of this commit:
cvs rdiff -u -r1.251 -r1.252 src/usr.bin/xlint/lint1/cgram.y

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/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.251 src/usr.bin/xlint/lint1/cgram.y:1.252
--- src/usr.bin/xlint/lint1/cgram.y:1.251	Mon Jul  5 19:53:43 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Mon Jul  5 19:59:10 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.251 2021/07/05 19:53:43 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.252 2021/07/05 19:59:10 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.251 2021/07/05 19:53:43 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.252 2021/07/05 19:59:10 rillig Exp $");
 #endif
 
 #include 
@@ -1026,6 +1026,7 @@ type_init_decls:
 	| type_init_decls T_COMMA type_init_decl
 	;
 
+/* See the Bison manual, section 7.1 "Semantic Info in Token Kinds". */
 notype_init_decl:
 	  notype_decl asm_or_symbolrename_opt {
 		cgram_declare($1, false, $2);



CVS commit: src

2021-07-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jul  5 19:53:43 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_340.c msg_340.exp
src/usr.bin/xlint/lint1: cgram.y err.c

Log Message:
lint: rename message 340 to talk about "GCC extension", not "GNU"


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_340.c
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_340.exp
cvs rdiff -u -r1.250 -r1.251 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.125 -r1.126 src/usr.bin/xlint/lint1/err.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/usr.bin/xlint/lint1/msg_340.c
diff -u src/tests/usr.bin/xlint/lint1/msg_340.c:1.1 src/tests/usr.bin/xlint/lint1/msg_340.c:1.2
--- src/tests/usr.bin/xlint/lint1/msg_340.c:1.1	Sun Mar  7 19:42:54 2021
+++ src/tests/usr.bin/xlint/lint1/msg_340.c	Mon Jul  5 19:53:43 2021
@@ -1,10 +1,10 @@
-/*	$NetBSD: msg_340.c,v 1.1 2021/03/07 19:42:54 rillig Exp $	*/
+/*	$NetBSD: msg_340.c,v 1.2 2021/07/05 19:53:43 rillig Exp $	*/
 # 3 "msg_340.c"
 
-// Test for message: initialization with '[a...b]' is a GNU extension [340]
+// Test for message: initialization with '[a...b]' is a GCC extension [340]
 
 /*
- * In strict C mode, GNU extensions are flagged as such.
+ * In strict C mode, GCC extensions are flagged as such.
  */
 
 /* lint1-flags: -Ssw */

Index: src/tests/usr.bin/xlint/lint1/msg_340.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_340.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_340.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_340.exp:1.2	Sun Mar 21 20:45:00 2021
+++ src/tests/usr.bin/xlint/lint1/msg_340.exp	Mon Jul  5 19:53:43 2021
@@ -1 +1 @@
-msg_340.c(16): error: initialization with '[a...b]' is a GNU extension [340]
+msg_340.c(16): error: initialization with '[a...b]' is a GCC extension [340]

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.250 src/usr.bin/xlint/lint1/cgram.y:1.251
--- src/usr.bin/xlint/lint1/cgram.y:1.250	Mon Jul  5 19:48:32 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Mon Jul  5 19:53:43 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.250 2021/07/05 19:48:32 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.251 2021/07/05 19:53:43 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.250 2021/07/05 19:48:32 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.251 2021/07/05 19:53:43 rillig Exp $");
 #endif
 
 #include 
@@ -1405,7 +1405,7 @@ range:
 	| constant_expr T_ELLIPSIS constant_expr {
 		$$.lo = to_int_constant($1, true);
 		$$.hi = to_int_constant($3, true);
-		/* initialization with '[a...b]' is a GNU extension */
+		/* initialization with '[a...b]' is a GCC extension */
 		gnuism(340);
 	  }
 	;

Index: src/usr.bin/xlint/lint1/err.c
diff -u src/usr.bin/xlint/lint1/err.c:1.125 src/usr.bin/xlint/lint1/err.c:1.126
--- src/usr.bin/xlint/lint1/err.c:1.125	Sun Jul  4 17:01:58 2021
+++ src/usr.bin/xlint/lint1/err.c	Mon Jul  5 19:53:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: err.c,v 1.125 2021/07/04 17:01:58 rillig Exp $	*/
+/*	$NetBSD: err.c,v 1.126 2021/07/05 19:53:43 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: err.c,v 1.125 2021/07/04 17:01:58 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.126 2021/07/05 19:53:43 rillig Exp $");
 #endif
 
 #include 
@@ -394,7 +394,7 @@ const char *const msgs[] = {
 	"right operand of '%s' must not be bool",		  /* 337 */
 	"option '%c' should be handled in the switch",		  /* 338 */
 	"option '%c' should be listed in the options string",	  /* 339 */
-	"initialization with '[a...b]' is a GNU extension",	  /* 340 */
+	"initialization with '[a...b]' is a GCC extension",	  /* 340 */
 	"argument to '%s' must be 'unsigned char' or EOF, not '%s'",  /* 341 */
 	"argument to '%s' must be cast to 'unsigned char', not to '%s'", /* 342 */
 	"static array size is a C11 extension",			  /* 343 */



CVS commit: src/usr.bin/xlint/lint1

2021-07-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jul  5 19:48:32 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: cgram.y decl.c lint1.h

Log Message:
lint: rename dinfo_t.d_stralign to d_sou_align_in_bits

When talking about alignment, offset and size of a type, the measurement
unit must be mentioned in the variable name, especially when it differs
from the standard unit of measurement, which is a byte, not a bit.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.249 -r1.250 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.193 -r1.194 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.110 -r1.111 src/usr.bin/xlint/lint1/lint1.h

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/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.249 src/usr.bin/xlint/lint1/cgram.y:1.250
--- src/usr.bin/xlint/lint1/cgram.y:1.249	Sat Jul  3 21:18:40 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Mon Jul  5 19:48:32 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.249 2021/07/03 21:18:40 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.250 2021/07/05 19:48:32 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.249 2021/07/03 21:18:40 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.250 2021/07/05 19:48:32 rillig Exp $");
 #endif
 
 #include 
@@ -759,7 +759,7 @@ struct:
 		symtyp = FTAG;
 		begin_declaration_level($1 == STRUCT ? MOS : MOU);
 		dcs->d_offset = 0;
-		dcs->d_stralign = CHAR_SIZE;
+		dcs->d_sou_align_in_bits = CHAR_SIZE;
 		$$ = $1;
 	  }
 	;

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.193 src/usr.bin/xlint/lint1/decl.c:1.194
--- src/usr.bin/xlint/lint1/decl.c:1.193	Sun Jul  4 13:31:10 2021
+++ src/usr.bin/xlint/lint1/decl.c	Mon Jul  5 19:48:32 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.193 2021/07/04 13:31:10 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.194 2021/07/05 19:48:32 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.193 2021/07/04 13:31:10 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.194 2021/07/05 19:48:32 rillig Exp $");
 #endif
 
 #include 
@@ -1255,8 +1255,8 @@ align(int al, int len)
 	 * the struct/union if it is larger than the current alignment
 	 * of the struct/union.
 	 */
-	if (al > dcs->d_stralign)
-		dcs->d_stralign = al;
+	if (al > dcs->d_sou_align_in_bits)
+		dcs->d_sou_align_in_bits = al;
 
 	no = (dcs->d_offset + (al - 1)) & ~(al - 1);
 	if (len == 0 || dcs->d_offset + len > no)
@@ -1816,9 +1816,9 @@ complete_tag_struct_or_union(type_t *tp,
 	setcomplete(tp, true);
 
 	t = tp->t_tspec;
-	align(dcs->d_stralign, 0);
+	align(dcs->d_sou_align_in_bits, 0);
 	sp = tp->t_str;
-	sp->sou_align_in_bits = dcs->d_stralign;
+	sp->sou_align_in_bits = dcs->d_sou_align_in_bits;
 	sp->sou_first_member = fmem;
 	if (tp->t_packed)
 		setpackedsize(tp);

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.110 src/usr.bin/xlint/lint1/lint1.h:1.111
--- src/usr.bin/xlint/lint1/lint1.h:1.110	Sun Jul  4 09:13:59 2021
+++ src/usr.bin/xlint/lint1/lint1.h	Mon Jul  5 19:48:32 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.110 2021/07/04 09:13:59 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.111 2021/07/05 19:48:32 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -361,7 +361,8 @@ typedef	struct dinfo {
    for all declarators */
 	sym_t	*d_redeclared_symbol;
 	int	d_offset;	/* offset of next structure member */
-	int	d_stralign;	/* alignment required for current structure */
+	int	d_sou_align_in_bits; /* alignment required for current
+ * structure */
 	scl_t	d_ctx;		/* context of declaration */
 	bool	d_const : 1;	/* const in declaration specifiers */
 	bool	d_volatile : 1;	/* volatile in declaration specifiers */



CVS commit: src/tests/usr.bin/xlint/lint1

2021-07-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jul  5 19:43:29 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: expr_range.c

Log Message:
tests/lint: fix typos in comment in expr_range


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/expr_range.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/usr.bin/xlint/lint1/expr_range.c
diff -u src/tests/usr.bin/xlint/lint1/expr_range.c:1.2 src/tests/usr.bin/xlint/lint1/expr_range.c:1.3
--- src/tests/usr.bin/xlint/lint1/expr_range.c:1.2	Sat May 15 19:12:14 2021
+++ src/tests/usr.bin/xlint/lint1/expr_range.c	Mon Jul  5 19:43:29 2021
@@ -1,13 +1,13 @@
-/*	$NetBSD: expr_range.c,v 1.2 2021/05/15 19:12:14 rillig Exp $	*/
+/*	$NetBSD: expr_range.c,v 1.3 2021/07/05 19:43:29 rillig Exp $	*/
 # 3 "expr_range.c"
 
 /*
  * In a switch statement that has (expr & constant) as the controlling
- * expression, complain if one of the case branches is unreachable because
- * the case label does can never match the controlling expression.
+ * expression, complain if a case branch is unreachable because the case
+ * label can never match the controlling expression.
  *
  * GCC 10 does not complain about the unreachable branch.  It knows that the
- * branch is unreachable though since it doesn't generate any code for it.
+ * branch is unreachable though, since it doesn't generate any code for it.
  * GCC once had the option -Wunreachable-code, but that option was made a
  * no-op in 2011.
  *



CVS commit: src/usr.bin/xlint/lint1

2021-07-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jul  5 19:39:12 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: emit1.c

Log Message:
lint: fix type warnings in emit1.c

The plain character strings in strg_t are saved as an array of unsigned
char.  When such a character is passed to ch_isdigit, it requires a
cast.  This is exactly the situation that ch_isdigit tried to avoid in
the first place.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/usr.bin/xlint/lint1/emit1.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/xlint/lint1/emit1.c
diff -u src/usr.bin/xlint/lint1/emit1.c:1.44 src/usr.bin/xlint/lint1/emit1.c:1.45
--- src/usr.bin/xlint/lint1/emit1.c:1.44	Sun Apr 18 20:02:56 2021
+++ src/usr.bin/xlint/lint1/emit1.c	Mon Jul  5 19:39:12 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.44 2021/04/18 20:02:56 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.45 2021/07/05 19:39:12 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,11 +38,9 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: emit1.c,v 1.44 2021/04/18 20:02:56 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.45 2021/07/05 19:39:12 rillig Exp $");
 #endif
 
-#include 
-
 #include "lint1.h"
 
 static	void	outtt(sym_t *, sym_t *);
@@ -146,7 +144,7 @@ outtype(const type_t *tp)
 		} else if (ts == FUNC && tp->t_proto) {
 			na = 0;
 			for (arg = tp->t_args; arg != NULL; arg = arg->s_next)
-	na++;
+na++;
 			if (tp->t_vararg)
 na++;
 			outint(na);
@@ -495,7 +493,7 @@ outcall(const tnode_t *tn, bool rvused, 
 static void
 outfstrg(strg_t *strg)
 {
-	int	c, oc;
+	unsigned char c, oc;
 	bool	first;
 	u_char	*cp;
 
@@ -525,7 +523,7 @@ outfstrg(strg_t *strg)
 		}
 
 		/* numeric field width */
-		while (c != '\0' && ch_isdigit(c)) {
+		while (c != '\0' && ch_isdigit((char)c)) {
 			outqchar(c);
 			c = *cp++;
 		}
@@ -537,7 +535,7 @@ outfstrg(strg_t *strg)
 outqchar(c);
 c = *cp++;
 			} else {
-while (c != '\0' && ch_isdigit(c)) {
+while (c != '\0' && ch_isdigit((char)c)) {
 	outqchar(c);
 	c = *cp++;
 }



CVS commit: src/tests/usr.bin/xlint

2021-07-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jul  5 19:02:14 UTC 2021

Modified Files:
src/tests/usr.bin/xlint: check-expect.lua
src/tests/usr.bin/xlint/lint1: c99_bool_strict_suppressed.c

Log Message:
tests/lint: fix check-expect.lua for empty .exp file

An absent .exp file is equivalent to an empty .exp file.  In neither of
these cases must the corresponding .c file declare any expected
diagnostics.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/xlint/check-expect.lua
cvs rdiff -u -r1.2 -r1.3 \
src/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.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/usr.bin/xlint/check-expect.lua
diff -u src/tests/usr.bin/xlint/check-expect.lua:1.9 src/tests/usr.bin/xlint/check-expect.lua:1.10
--- src/tests/usr.bin/xlint/check-expect.lua:1.9	Mon Jul  5 18:55:14 2021
+++ src/tests/usr.bin/xlint/check-expect.lua	Mon Jul  5 19:02:14 2021
@@ -1,5 +1,5 @@
 #!  /usr/bin/lua
--- $NetBSD: check-expect.lua,v 1.9 2021/07/05 18:55:14 rillig Exp $
+-- $NetBSD: check-expect.lua,v 1.10 2021/07/05 19:02:14 rillig Exp $
 
 --[[
 
@@ -76,7 +76,7 @@ end
 local function load_actual_messages_from_exp(exp_fname)
 
   local lines = load_lines(exp_fname)
-  if lines == nil then return nil end
+  if lines == nil then return {} end
 
   local messages = {}
   for exp_lineno, line in ipairs(lines) do

Index: src/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.c
diff -u src/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.c:1.2 src/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.c:1.3
--- src/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.c:1.2	Sun Jul  4 08:19:06 2021
+++ src/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.c	Mon Jul  5 19:02:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: c99_bool_strict_suppressed.c,v 1.2 2021/07/04 08:19:06 rillig Exp $	*/
+/*	$NetBSD: c99_bool_strict_suppressed.c,v 1.3 2021/07/05 19:02:14 rillig Exp $	*/
 # 3 "c99_bool_strict_suppressed.c"
 
 /*
@@ -24,19 +24,19 @@ void
 test(_Bool b, int i, const char *p)
 {
 
-	/* expect+1: error: controlling expression must be bool, not 'int' [333] */
+	/* suppressed+1: error: controlling expression must be bool, not 'int' [333] */
 	while (1)
 		break;
 
-	/* expect+1: error: operands of '=' have incompatible types (_Bool != int) [107] */
+	/* suppressed+1: error: operands of '=' have incompatible types (_Bool != int) [107] */
 	b = i;
 
-	/* expect+1: error: operand of '!' must be bool, not 'int' [330] */
+	/* suppressed+1: error: operand of '!' must be bool, not 'int' [330] */
 	b = !i;
 
-	/* expect+1: error: left operand of '&&' must be bool, not 'int' [331] */
+	/* suppressed+1: error: left operand of '&&' must be bool, not 'int' [331] */
 	b = i && b;
 
-	/* expect+1: error: right operand of '&&' must be bool, not 'int' [332] */
+	/* suppressed+1: error: right operand of '&&' must be bool, not 'int' [332] */
 	b = b && i;
 }



CVS commit: src/tests/usr.bin/xlint

2021-07-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jul  5 18:55:14 UTC 2021

Modified Files:
src/tests/usr.bin/xlint: check-expect.lua

Log Message:
tests/lint: remove unused variables


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/check-expect.lua

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

Modified files:

Index: src/tests/usr.bin/xlint/check-expect.lua
diff -u src/tests/usr.bin/xlint/check-expect.lua:1.8 src/tests/usr.bin/xlint/check-expect.lua:1.9
--- src/tests/usr.bin/xlint/check-expect.lua:1.8	Thu Apr  8 22:18:27 2021
+++ src/tests/usr.bin/xlint/check-expect.lua	Mon Jul  5 18:55:14 2021
@@ -1,5 +1,5 @@
 #!  /usr/bin/lua
--- $NetBSD: check-expect.lua,v 1.8 2021/04/08 22:18:27 rillig Exp $
+-- $NetBSD: check-expect.lua,v 1.9 2021/07/05 18:55:14 rillig Exp $
 
 --[[
 
@@ -73,15 +73,14 @@ local function load_expect_comments_from
 end
 
 
-local function load_actual_messages_from_exp(exp_fname, primary_fname)
+local function load_actual_messages_from_exp(exp_fname)
 
   local lines = load_lines(exp_fname)
   if lines == nil then return nil end
 
   local messages = {}
   for exp_lineno, line in ipairs(lines) do
-for location, c_filename, c_lineno, message
- in line:gmatch("((%S+)%((%d+)%)): (.+)$") do
+for location, message in line:gmatch("(%S+%(%d+%)): (.+)$") do
   table.insert(messages, {
 exp_lineno = exp_lineno,
 location = location,
@@ -101,7 +100,7 @@ local function check_test(c_fname, error
 load_expect_comments_from_c(c_fname, errors)
   if comment_locations == nil then return end
 
-  local messages = load_actual_messages_from_exp(exp_fname, c_fname)
+  local messages = load_actual_messages_from_exp(exp_fname)
   if messages == nil then return end
 
   for _, act in ipairs(messages) do



CVS commit: src/sys/arch/sparc64/doc

2021-07-05 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Mon Jul  5 16:59:54 UTC 2021

Modified Files:
src/sys/arch/sparc64/doc: TODO

Log Message:
sun4v: update status on S7 systems


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/sparc64/doc/TODO

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

Modified files:

Index: src/sys/arch/sparc64/doc/TODO
diff -u src/sys/arch/sparc64/doc/TODO:1.43 src/sys/arch/sparc64/doc/TODO:1.44
--- src/sys/arch/sparc64/doc/TODO:1.43	Fri Jun 25 19:13:12 2021
+++ src/sys/arch/sparc64/doc/TODO	Mon Jul  5 16:59:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: TODO,v 1.43 2021/06/25 19:13:12 palle Exp $ */
+/* $NetBSD: TODO,v 1.44 2021/07/05 16:59:54 palle Exp $ */
 
 Things to be done:
 
@@ -12,7 +12,7 @@ sun4u:
 
 sun4v:
  - current status
- T5 ldom with 2 VCPU and 4GB:
+ T5 ldom with 2 VCPU and 4GB  (primary ldom is Solaris 11.4 SRU30)::
- kernel boots from miniroot.fs via ldom fisk (vdsk)
 	   - ldom virtual network interface (vnet) is working
 	 (verified by exiting sysinst and issuing a ping command)
@@ -24,9 +24,8 @@ sun4v:
 		 unpacked, but the system hangs afterwards when running the makedev script.
 	 T2000 ldom with 8 VCPU and 4GB:
 	   - crashes in /sbin/init doing an access() call where %o0 is corrupted (zero)
-	 S7 ldom with 8 VCPU and 16GB (primary ldom is Solaris 11.4 SRU30):
-	   - during autoconfiguration of vnet devices the call to hv_vintr_setenabled()
-	 returns error code 7 (EBADTRAP?)
+	 S7 ldom with 8 VCPU and 16GB (primary ldom is Solaris 11.4 SRU33):
+	   - same status as T5 ldom
 - 64-bit kernel support
 - 32-bit kernel support
 - libkvm



CVS commit: src/sys/arch/alpha/alpha

2021-07-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jul  5 15:12:01 UTC 2021

Modified Files:
src/sys/arch/alpha/alpha: pmap.c

Log Message:
Instrument the number of calls to pmap_growkernel().


To generate a diff of this commit:
cvs rdiff -u -r1.295 -r1.296 src/sys/arch/alpha/alpha/pmap.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/arch/alpha/alpha/pmap.c
diff -u src/sys/arch/alpha/alpha/pmap.c:1.295 src/sys/arch/alpha/alpha/pmap.c:1.296
--- src/sys/arch/alpha/alpha/pmap.c:1.295	Mon Jul  5 10:00:22 2021
+++ src/sys/arch/alpha/alpha/pmap.c	Mon Jul  5 15:12:00 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.295 2021/07/05 10:00:22 thorpej Exp $ */
+/* $NetBSD: pmap.c,v 1.296 2021/07/05 15:12:00 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020
@@ -135,7 +135,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.295 2021/07/05 10:00:22 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.296 2021/07/05 15:12:00 thorpej Exp $");
 
 #include 
 #include 
@@ -258,6 +258,11 @@ int		pmap_pv_lowat __read_mostly = PMAP_
 static TAILQ_HEAD(, pmap) pmap_all_pmaps __cacheline_aligned;
 
 /*
+ * Instrument the number of calls to pmap_growkernel().
+ */
+static struct evcnt pmap_growkernel_evcnt __read_mostly;
+
+/*
  * The pools from which pmap structures and sub-structures are allocated.
  */
 static struct pool_cache pmap_pmap_cache __read_mostly;
@@ -1548,6 +1553,10 @@ pmap_init(void)
 	/* Initialize TLB handling. */
 	pmap_tlb_init();
 
+	/* Instrument pmap_growkernel(). */
+	evcnt_attach_dynamic_nozero(_growkernel_evcnt, EVCNT_TYPE_MISC,
+	NULL, "pmap", "growkernel");
+
 	/*
 	 * Set a low water mark on the pv_entry pool, so that we are
 	 * more likely to have these around even in extreme memory
@@ -3593,6 +3602,8 @@ pmap_growkernel(vaddr_t maxkvaddr)
 	if (maxkvaddr <= virtual_end)
 		goto out;		/* we are OK */
 
+	pmap_growkernel_evcnt.ev_count++;
+
 	va = virtual_end;
 
 	while (va < maxkvaddr) {



CVS commit: src/sys/arch/hp300

2021-07-05 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Jul  5 14:51:23 UTC 2021

Modified Files:
src/sys/arch/hp300/dev: ct.c ctreg.h hpibvar.h rd.c rdreg.h rdvar.h
src/sys/arch/hp300/stand/common: ct.c hpibvar.h rd.c

Log Message:
Cleanup duplicated CS/80 indentify structures.  From OpenBSD.

https://marc.info/?l=openbsd-cvs=113227249626888=2
> Define the CS/80 identify structure only once and correctly, instead of
> duplicating it in every CS/80 driver and using an hardcoded number for
> its size.
> No functional change.

https://marc.info/?l=openbsd-cvs=113273001020159=2
> Pick HP-IB describe structures changes from main kernel code here as well.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/hp300/dev/ct.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/hp300/dev/ctreg.h
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/hp300/dev/hpibvar.h
cvs rdiff -u -r1.106 -r1.107 src/sys/arch/hp300/dev/rd.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/hp300/dev/rdreg.h
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/hp300/dev/rdvar.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/hp300/stand/common/ct.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hp300/stand/common/hpibvar.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/hp300/stand/common/rd.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/arch/hp300/dev/ct.c
diff -u src/sys/arch/hp300/dev/ct.c:1.62 src/sys/arch/hp300/dev/ct.c:1.63
--- src/sys/arch/hp300/dev/ct.c:1.62	Mon Jul  5 14:03:46 2021
+++ src/sys/arch/hp300/dev/ct.c	Mon Jul  5 14:51:23 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ct.c,v 1.62 2021/07/05 14:03:46 tsutsui Exp $	*/
+/*	$NetBSD: ct.c,v 1.63 2021/07/05 14:51:23 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ct.c,v 1.62 2021/07/05 14:03:46 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ct.c,v 1.63 2021/07/05 14:51:23 tsutsui Exp $");
 
 #include 
 #include 
@@ -257,7 +257,7 @@ ctattach(device_t parent, device_t self,
 static int
 ctident(device_t parent, struct ct_softc *sc, struct hpibbus_attach_args *ha)
 {
-	struct ct_describe desc;
+	struct cs80_describe desc;
 	u_char stat, cmd[3];
 	char name[7];
 	int i, id, n, type, canstream;
@@ -284,9 +284,10 @@ ctident(device_t parent, struct ct_softc
 	cmd[1] = C_SVOL(0);
 	cmd[2] = C_DESC;
 	hpibsend(device_unit(parent), ha->ha_slave, C_CMD, cmd, sizeof(cmd));
-	hpibrecv(device_unit(parent), ha->ha_slave, C_EXEC, , 37);
+	hpibrecv(device_unit(parent), ha->ha_slave, C_EXEC, ,
+	sizeof(desc));
 	hpibrecv(device_unit(parent), ha->ha_slave, C_QSTAT, ,
-		 sizeof(stat));
+	sizeof(stat));
 
 	memset(name, 0, sizeof(name));
 	if (stat == 0) {

Index: src/sys/arch/hp300/dev/ctreg.h
diff -u src/sys/arch/hp300/dev/ctreg.h:1.10 src/sys/arch/hp300/dev/ctreg.h:1.11
--- src/sys/arch/hp300/dev/ctreg.h:1.10	Sun Dec 11 12:17:13 2005
+++ src/sys/arch/hp300/dev/ctreg.h	Mon Jul  5 14:51:23 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ctreg.h,v 1.10 2005/12/11 12:17:13 christos Exp $	*/
+/*	$NetBSD: ctreg.h,v 1.11 2021/07/05 14:51:23 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1990, 1993
@@ -98,30 +98,6 @@ struct	ct_clearcmd {
 	char	cmd;
 };
 
-struct ct_describe {
-	u_int	d_iuw:16,	/* controller: installed unit word */
-		d_cmaxxfr:16,	/* controller: max transfer rate (Kb) */
-		d_ctype:8,	/* controller: controller type */
-		d_utype:8,	/* unit: unit type */
-		d_name:24,	/* unit: name (6 BCD digits) */
-		d_sectsize:16,	/* unit: # of bytes per block (sector) */
-		d_blkbuf:8,	/* unit: # of blocks which can be buffered */
-		d_burstsize:8,	/* unit: recommended burst size */
-		d_blocktime:16,	/* unit: block time (u-sec) */
-		d_uavexfr:16,	/* unit: average transfer rate (Kb) */
-		d_retry:16,	/* unit: optimal retry time (1/100-sec) */
-		d_access:16,	/* unit: access time param (1/100-sec) */
-		d_maxint:8,	/* unit: maximum interleave */
-		d_fvbyte:8,	/* unit: fixed volume byte */
-		d_rvbyte:8,	/* unit: removable volume byte */
-		d_maxcyl:24,	/* volume: maximum cylinder */
-		d_maxhead:8,	/* volume: maximum head */
-		d_maxsect:16,	/* volume: maximum sector on track */
-		d_maxvsecth:16,	/* volume: maximum sector on volume (MSW) */
-		d_maxvsectl:32,	/* volume: maximum sector on volume (LSWs) */
-		d_interleave:8;	/* volume: current interleave */
- };
-
 #define	CT7946ID	0x220
 #define CT9145ID	0x268
 #define	CT9144ID	0x260

Index: src/sys/arch/hp300/dev/hpibvar.h
diff -u src/sys/arch/hp300/dev/hpibvar.h:1.22 src/sys/arch/hp300/dev/hpibvar.h:1.23
--- src/sys/arch/hp300/dev/hpibvar.h:1.22	Mon Jul  5 14:03:46 2021
+++ src/sys/arch/hp300/dev/hpibvar.h	Mon Jul  5 14:51:23 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpibvar.h,v 1.22 2021/07/05 14:03:46 tsutsui Exp $	*/
+/*	$NetBSD: hpibvar.h,v 1.23 2021/07/05 14:51:23 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -60,8 +60,6 @@
  *	@(#)hpibvar.h	8.1 

CVS commit: src/sys/arch/hp300/dev

2021-07-05 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Jul  5 14:15:16 UTC 2021

Modified Files:
src/sys/arch/hp300/dev: rd.c

Log Message:
Move attach messages from common rdident() to explicit rdattach().


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/arch/hp300/dev/rd.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/arch/hp300/dev/rd.c
diff -u src/sys/arch/hp300/dev/rd.c:1.105 src/sys/arch/hp300/dev/rd.c:1.106
--- src/sys/arch/hp300/dev/rd.c:1.105	Mon Jul  5 14:03:46 2021
+++ src/sys/arch/hp300/dev/rd.c	Mon Jul  5 14:15:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: rd.c,v 1.105 2021/07/05 14:03:46 tsutsui Exp $	*/
+/*	$NetBSD: rd.c,v 1.106 2021/07/05 14:15:16 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.105 2021/07/05 14:03:46 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.106 2021/07/05 14:15:16 tsutsui Exp $");
 
 #include "opt_useleds.h"
 
@@ -320,6 +320,8 @@ rdattach(device_t parent, device_t self,
 {
 	struct rd_softc *sc = device_private(self);
 	struct hpibbus_attach_args *ha = aux;
+	int id;
+	char pbuf[9];
 
 	sc->sc_dev = self;
 	bufq_alloc(>sc_tab, "disksort", BUFQ_SORT_RAWBLOCK);
@@ -330,6 +332,21 @@ rdattach(device_t parent, device_t self,
 	}
 
 	/*
+	 * XXX We use DEV_BSIZE instead of the sector size value pulled
+	 * XXX off the driver because all of this code assumes 512 byte
+	 * XXX blocks.  ICK!
+	 */
+	id = sc->sc_type;
+	aprint_normal(": %s\n", rdidentinfo[id].ri_desc);
+	format_bytes(pbuf, sizeof(pbuf),
+	rdidentinfo[id].ri_nblocks * DEV_BSIZE);
+	aprint_normal_dev(sc->sc_dev, "%s, %d cyl, %d head, %d sec,"
+	" %d bytes/block x %u blocks\n",
+	pbuf, rdidentinfo[id].ri_ncyl, rdidentinfo[id].ri_ntpc,
+	rdidentinfo[id].ri_nbpt,
+	DEV_BSIZE, rdidentinfo[id].ri_nblocks);
+
+	/*
 	 * Initialize and attach the disk structure.
 	 */
 	memset(>sc_dkdev, 0, sizeof(sc->sc_dkdev));
@@ -366,7 +383,7 @@ rdident(device_t parent, struct rd_softc
 {
 	struct rd_describe *desc = sc != NULL ? >sc_rddesc : NULL;
 	u_char stat, cmd[3];
-	char name[7], pbuf[9];
+	char name[7];
 	int i, id, n, ctlr, slave;
 
 	ctlr = device_unit(parent);
@@ -464,20 +481,6 @@ rdident(device_t parent, struct rd_softc
 
 	sc->sc_type = id;
 
-	/*
-	 * XXX We use DEV_BSIZE instead of the sector size value pulled
-	 * XXX off the driver because all of this code assumes 512 byte
-	 * XXX blocks.  ICK!
-	 */
-	aprint_normal(": %s\n", rdidentinfo[id].ri_desc);
-	format_bytes(pbuf, sizeof(pbuf),
-	rdidentinfo[id].ri_nblocks * DEV_BSIZE);
-	aprint_normal_dev(sc->sc_dev, "%s, %d cyl, %d head, %d sec,"
-	" %d bytes/block x %u blocks\n",
-	pbuf, rdidentinfo[id].ri_ncyl, rdidentinfo[id].ri_ntpc,
-	rdidentinfo[id].ri_nbpt,
-	DEV_BSIZE, rdidentinfo[id].ri_nblocks);
-
 	return 1;
 }
 



CVS commit: src/sys/arch/hp300/dev

2021-07-05 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Jul  5 14:03:46 UTC 2021

Modified Files:
src/sys/arch/hp300/dev: ct.c hpib.c hpibvar.h mt.c rd.c

Log Message:
Pull HP-IB probe fixes from OpenBSD/hp300.

https://marc.info/?l=openbsd-cvs=113217630426615=2
> Overhaul the way HP-IB devices are probed. We will now do an exhaustive
> probe of the (slave, punit) tuple space, since this is the only way we
> can get a dual disk or dual tape enclosure to attach two devices of the
> same kind.

This allows using multiple rd(4) disk images on the same slave emulated
by HPDisk (and probably the real 9122D with dual floppy disk drives).

Thanks to Miod Vallat for suggesting this fix.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/hp300/dev/ct.c
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/hp300/dev/hpib.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/hp300/dev/hpibvar.h
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/hp300/dev/mt.c
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/hp300/dev/rd.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/arch/hp300/dev/ct.c
diff -u src/sys/arch/hp300/dev/ct.c:1.61 src/sys/arch/hp300/dev/ct.c:1.62
--- src/sys/arch/hp300/dev/ct.c:1.61	Fri Jul 25 08:10:33 2014
+++ src/sys/arch/hp300/dev/ct.c	Mon Jul  5 14:03:46 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ct.c,v 1.61 2014/07/25 08:10:33 dholland Exp $	*/
+/*	$NetBSD: ct.c,v 1.62 2021/07/05 14:03:46 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ct.c,v 1.61 2014/07/25 08:10:33 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ct.c,v 1.62 2021/07/05 14:03:46 tsutsui Exp $");
 
 #include 
 #include 
@@ -270,13 +270,12 @@ ctident(device_t parent, struct ct_softc
 
 	/* Is it one of the tapes we support? */
 	for (id = 0; id < nctinfo; id++)
-		if (ha->ha_id == ctinfo[id].hwid)
+		if (ha->ha_id == ctinfo[id].hwid &&
+		ha->ha_punit == ctinfo[id].punit)
 			break;
 	if (id == nctinfo)
 		return 0;
 
-	ha->ha_punit = ctinfo[id].punit;
-
 	/*
 	 * So far, so good.  Get drive parameters.  Note command
 	 * is always issued to unit 0.

Index: src/sys/arch/hp300/dev/hpib.c
diff -u src/sys/arch/hp300/dev/hpib.c:1.42 src/sys/arch/hp300/dev/hpib.c:1.43
--- src/sys/arch/hp300/dev/hpib.c:1.42	Sat Apr 24 23:36:37 2021
+++ src/sys/arch/hp300/dev/hpib.c	Mon Jul  5 14:03:46 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpib.c,v 1.42 2021/04/24 23:36:37 thorpej Exp $	*/
+/*	$NetBSD: hpib.c,v 1.43 2021/07/05 14:03:46 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hpib.c,v 1.42 2021/04/24 23:36:37 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpib.c,v 1.43 2021/07/05 14:03:46 tsutsui Exp $");
 
 #include 
 #include 
@@ -89,14 +89,9 @@ CFATTACH_DECL_NEW(hpibbus, sizeof(struct
 hpibbusmatch, hpibbusattach, NULL, NULL);
 
 static void	hpibbus_attach_children(struct hpibbus_softc *);
-static int	hpibbussearch(device_t, cfdata_t, const int *, void *);
+static int	hpibbussubmatch(device_t, cfdata_t, const int *ldesc, void *);
 static int	hpibbusprint(void *, const char *);
 
-static int	hpibbus_alloc(struct hpibbus_softc *, int, int);
-#if 0
-static void	hpibbus_free(struct hpibbus_softc *, int, int);
-#endif
-
 static void	hpibstart(void *);
 static void	hpibdone(void *);
 
@@ -121,17 +116,9 @@ int	hpibdmathresh = 3;	/* byte count bey
  * have ID tags, and often the host cannot even tell if such
  * a device is attached to the system!
  *
- * These two nasty bits mean that we have to treat HP-IB as
- * an indirect bus.  However, since we are given some ID
- * information, it is unreasonable to disallow cloning of
- * CS/80 devices.
- *
- * To deal with all of this, we use the semi-twisted scheme
- * in hpibbus_attach_children().  For each HP-IB slave, we loop
- * through all of the possibly-configured children, allowing
- * them to modify the punit parameter (but NOT the slave!).
- *
- * This is evil, but what can you do?
+ * * We nevertheless probe the whole (slave, punit) tuple space, since
+ * drivers for devices with a unique ID know exactly where to attach; 
+ * and we disallow ``star'' locators for other drivers.
  */
 
 static int
@@ -177,64 +164,51 @@ static void
 hpibbus_attach_children(struct hpibbus_softc *sc)
 {
 	struct hpibbus_attach_args ha;
-	int slave;
+	int id, slave, punit;
+	int i;
 
-	for (slave = 0; slave < 8; slave++) {
+	for (slave = 0; slave < HPIB_NSLAVES; slave++) {
 		/*
 		 * Get the ID tag for the device, if any.
 		 * Plotters won't identify themselves, and
 		 * get the same value as non-existent devices.
+		 * However, aging HP-IB drives are slow to respond; try up
+		 * to three times to get a valid ID.
 		 */
-		ha.ha_id = hpibid(device_unit(sc->sc_dev), slave);
-
-		ha.ha_slave = slave;	/* not to be modified by children */
-		

CVS commit: src/sys/arch/hp300/stand/common

2021-07-05 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Jul  5 13:41:08 UTC 2021

Modified Files:
src/sys/arch/hp300/stand/common: autoconf.c ite.c ite_tc.c
Removed Files:
src/sys/arch/hp300/stand/common: grfreg.h

Log Message:
Get rid of obsolete grfreg.h.  From OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hp300/stand/common/autoconf.c
cvs rdiff -u -r1.3 -r0 src/sys/arch/hp300/stand/common/grfreg.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/hp300/stand/common/ite.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/hp300/stand/common/ite_tc.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/arch/hp300/stand/common/autoconf.c
diff -u src/sys/arch/hp300/stand/common/autoconf.c:1.13 src/sys/arch/hp300/stand/common/autoconf.c:1.14
--- src/sys/arch/hp300/stand/common/autoconf.c:1.13	Tue Feb  8 20:20:14 2011
+++ src/sys/arch/hp300/stand/common/autoconf.c	Mon Jul  5 13:41:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.13 2011/02/08 20:20:14 rmind Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.14 2021/07/05 13:41:08 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -49,7 +49,6 @@
 #include 
 
 #include 
-#include 
 #include 
 
 /*

Index: src/sys/arch/hp300/stand/common/ite.c
diff -u src/sys/arch/hp300/stand/common/ite.c:1.18 src/sys/arch/hp300/stand/common/ite.c:1.19
--- src/sys/arch/hp300/stand/common/ite.c:1.18	Fri Feb 26 18:11:11 2016
+++ src/sys/arch/hp300/stand/common/ite.c	Mon Jul  5 13:41:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ite.c,v 1.18 2016/02/26 18:11:11 christos Exp $	*/
+/*	$NetBSD: ite.c,v 1.19 2021/07/05 13:41:08 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -47,7 +47,7 @@
 #include 
 #include 
 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -129,19 +129,19 @@ iteconfig(void)
 	int dtype, fboff, slotno, i;
 	uint8_t *va;
 	struct hp_hw *hw;
-	struct grfreg *gr;
+	struct diofbreg *fb;
 	struct ite_data *ip;
 
 	i = 0;
 	for (hw = sc_table; hw < _table[MAXCTLRS]; hw++) {
 	if (!HW_ISDEV(hw, D_BITMAP))
 			continue;
-		gr = (struct grfreg *) hw->hw_kva;
+		fb = (struct diofbreg *)hw->hw_kva;
 		/* XXX: redundent but safe */
-		if (badaddr((void *)gr) || gr->gr_id != GRFHWID)
+		if (badaddr((void *)fb) || fb->id != GRFHWID)
 			continue;
 		for (dtype = 0; dtype < nitesw; dtype++)
-			if (itesw[dtype].ite_hwid == gr->gr_id2)
+			if (itesw[dtype].ite_hwid == fb->fbid)
 break;
 		if (dtype == nitesw)
 			continue;
@@ -150,16 +150,16 @@ iteconfig(void)
 		ite_scode[i] = hw->hw_sc;
 		ip = _data[i];
 		ip->isw = [dtype];
-		ip->regbase = (void *) gr;
-		fboff = (gr->gr_fbomsb << 8) | gr->gr_fbolsb;
+		ip->regbase = (void *)fb;
+		fboff = (fb->fbomsb << 8) | fb->fbolsb;
 		ip->fbbase = (void *)(*((u_char *)ip->regbase + fboff) << 16);
 		/* DIO II: FB offset is relative to select code space */
 		if (ip->regbase >= (void *)DIOIIBASE)
 			ip->fbbase = (char*)ip->fbbase + (int)ip->regbase;
-		ip->fbwidth  = gr->gr_fbwidth_h << 8 | gr->gr_fbwidth_l;
-		ip->fbheight = gr->gr_fbheight_h << 8 | gr->gr_fbheight_l;
-		ip->dwidth   = gr->gr_dwidth_h << 8 | gr->gr_dwidth_l;
-		ip->dheight  = gr->gr_dheight_h << 8 | gr->gr_dheight_l;
+		ip->fbwidth  = fb->fbwmsb << 8 | fb->fbwlsb;
+		ip->fbheight = fb->fbhmsb << 8 | fb->fbhlsb;
+		ip->dwidth   = fb->dwmsb  << 8 | fb->dwlsb;
+		ip->dheight  = fb->dhmsb  << 8 | fb->dhlsb;
 		/*
 		 * XXX some displays (e.g. the davinci) appear
 		 * to return a display height greater than the

Index: src/sys/arch/hp300/stand/common/ite_tc.c
diff -u src/sys/arch/hp300/stand/common/ite_tc.c:1.10 src/sys/arch/hp300/stand/common/ite_tc.c:1.11
--- src/sys/arch/hp300/stand/common/ite_tc.c:1.10	Thu Feb 10 12:46:22 2011
+++ src/sys/arch/hp300/stand/common/ite_tc.c	Mon Jul  5 13:41:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ite_tc.c,v 1.10 2011/02/10 12:46:22 tsutsui Exp $	*/
+/*	$NetBSD: ite_tc.c,v 1.11 2021/07/05 13:41:08 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -42,8 +42,8 @@
 
 #include 
 
+#include 
 #include 
-#include 
 #include 
 
 #include 



CVS commit: src/doc

2021-07-05 Thread Harold Gutch
Module Name:src
Committed By:   hgutch
Date:   Mon Jul  5 11:16:56 UTC 2021

Modified Files:
src/doc: HACKS

Log Message:
Update gcc9-sh3-lint - instead of disabling optimization for lex.c on
sh3, rather revert the gcc change that (seemingly accidentally) broke
this.


To generate a diff of this commit:
cvs rdiff -u -r1.220 -r1.221 src/doc/HACKS

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

Modified files:

Index: src/doc/HACKS
diff -u src/doc/HACKS:1.220 src/doc/HACKS:1.221
--- src/doc/HACKS:1.220	Wed Jun 23 07:11:41 2021
+++ src/doc/HACKS	Mon Jul  5 11:16:56 2021
@@ -1,4 +1,4 @@
-# $NetBSD: HACKS,v 1.220 2021/06/23 07:11:41 rillig Exp $
+# $NetBSD: HACKS,v 1.221 2021/07/05 11:16:56 hgutch Exp $
 #
 # This file is intended to document workarounds for currently unsolved
 # (mostly) compiler bugs.
@@ -1003,12 +1003,19 @@ port	sh3
 
 	hack	gcc9-sh3-lint
 	cdate	Tue Jun 22 14:59:52 CEST 2021
-	mdate	Tue Jun 22 14:59:52 CEST 2021
-	who	martin
-	file	usr.bin/xlint/lint1/Makefile	: 1.70
-	descr
-		The in-tree gcc 9 crashes with an internal invalid
-		opcode exception when using any kind of optimization
-		on the lex.c file. Force -O0 for this file.
+	mdate	Mon Jul  5 12:34:57 CEST 2021
+	who	hgutch
+	file	external/gpl3/gcc/dist/gcc/config/sh/sh.md 1.2
+		external/gpl3/gcc.old/dist/gcc/config/sh/sh.md 1.11
+	descr
+		The in-tree gcc 9/gcc 10 crashes with an internal
+		invalid opcode exception when using any kind of
+		optimization on lex.c in usr.bin/xlint/lint .  This
+		was introduced apparently unintendedly in gcc when
+		addressing a different issue.  Rather than disabling
+		optimization for lex.c, instead revert the change to
+		gcc.  The bug report upstream has been updated to
+		reflect the exact breakage.
+
 		https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101177
 kcah



CVS commit: src

2021-07-05 Thread Harold Gutch
Module Name:src
Committed By:   hgutch
Date:   Mon Jul  5 10:34:26 UTC 2021

Modified Files:
src/external/gpl3/gcc.old/dist/gcc/config/sh: sh.md
src/external/gpl3/gcc/dist/gcc/config/sh: sh.md
src/usr.bin/xlint/lint1: Makefile

Log Message:
GCC git commit 91f66e78cc141da77ff9e0e3c8519e1af3f26c07[1] introduced
a regression in sh.  In addition to the intended change (based on the
commit message), an apparently unintended change was made, inverting a
comparison.  This broke sh builds and our workaround (so far) was to
compile xlint/lint1 with -O0.

Revert the comparison to what it was before and remove the -O0 hack
from xlint/lint1.

[1] 
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=91f66e78cc141da77ff9e0e3c8519e1af3f26c07


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/external/gpl3/gcc.old/dist/gcc/config/sh/sh.md
cvs rdiff -u -r1.1.1.16 -r1.2 src/external/gpl3/gcc/dist/gcc/config/sh/sh.md
cvs rdiff -u -r1.77 -r1.78 src/usr.bin/xlint/lint1/Makefile

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

Modified files:

Index: src/external/gpl3/gcc.old/dist/gcc/config/sh/sh.md
diff -u src/external/gpl3/gcc.old/dist/gcc/config/sh/sh.md:1.10 src/external/gpl3/gcc.old/dist/gcc/config/sh/sh.md:1.11
--- src/external/gpl3/gcc.old/dist/gcc/config/sh/sh.md:1.10	Fri Apr  9 23:14:34 2021
+++ src/external/gpl3/gcc.old/dist/gcc/config/sh/sh.md	Mon Jul  5 10:34:26 2021
@@ -842,7 +842,7 @@
   if (SUBREG_P (reg))
 reg = SUBREG_REG (reg);
   gcc_assert (REG_P (reg));
-  if (find_regno_note (curr_insn, REG_DEAD, REGNO (reg)) != NULL_RTX)
+  if (find_regno_note (curr_insn, REG_DEAD, REGNO (reg)) == NULL_RTX)
 FAIL;
 
   /* FIXME: Maybe also search the predecessor basic blocks to catch

Index: src/external/gpl3/gcc/dist/gcc/config/sh/sh.md
diff -u src/external/gpl3/gcc/dist/gcc/config/sh/sh.md:1.1.1.16 src/external/gpl3/gcc/dist/gcc/config/sh/sh.md:1.2
--- src/external/gpl3/gcc/dist/gcc/config/sh/sh.md:1.1.1.16	Sat Apr 10 22:09:50 2021
+++ src/external/gpl3/gcc/dist/gcc/config/sh/sh.md	Mon Jul  5 10:34:25 2021
@@ -842,7 +842,7 @@
   if (SUBREG_P (reg))
 reg = SUBREG_REG (reg);
   gcc_assert (REG_P (reg));
-  if (find_regno_note (curr_insn, REG_DEAD, REGNO (reg)) != NULL_RTX)
+  if (find_regno_note (curr_insn, REG_DEAD, REGNO (reg)) == NULL_RTX)
 FAIL;
 
   /* FIXME: Maybe also search the predecessor basic blocks to catch

Index: src/usr.bin/xlint/lint1/Makefile
diff -u src/usr.bin/xlint/lint1/Makefile:1.77 src/usr.bin/xlint/lint1/Makefile:1.78
--- src/usr.bin/xlint/lint1/Makefile:1.77	Sun Jul  4 09:13:59 2021
+++ src/usr.bin/xlint/lint1/Makefile	Mon Jul  5 10:34:26 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.77 2021/07/04 09:13:59 rillig Exp $
+#	$NetBSD: Makefile,v 1.78 2021/07/05 10:34:26 hgutch Exp $
 
 .include 
 
@@ -26,12 +26,6 @@ CPPFLAGS+=	${DEBUG:D-DDEBUG}
 
 COPTS.err.c+=	${${ACTIVE_CC} == "clang":? -Wno-format-nonliteral :}
 
-# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101177
-.if ${HAVE_GCC:U0} >= 9 &&	\
-	(${MACHINE_ARCH} == "sh3el" || ${MACHINE_ARCH} == "sh3eb")
-COPTS.lex.c+=	-O0
-.endif
-
 BINDIR=		/usr/libexec
 
 CLEANFILES+=	${MAN}



CVS commit: src/sys/arch/alpha/alpha

2021-07-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jul  5 10:00:22 UTC 2021

Modified Files:
src/sys/arch/alpha/alpha: pmap.c

Log Message:
Fix a bug introduced in pmap.c,v 1.287 where, when creating the PTE
in pmap_enter(), we would erroneously disregard MOD/REF attributes
already present on the page, thus causing FOW/FOR to be set incorrectly.
Normally this is not a big problem (an extra page fault will be taken
to resolve it), but if you access the mapping in interrupt context
(such as during IDE PIO, for example), a KASSERT can fire due to
acquiring an rwlock in interrupt context while servicing that fault.

Reported and bisected-to-commit by rin@.


To generate a diff of this commit:
cvs rdiff -u -r1.294 -r1.295 src/sys/arch/alpha/alpha/pmap.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/arch/alpha/alpha/pmap.c
diff -u src/sys/arch/alpha/alpha/pmap.c:1.294 src/sys/arch/alpha/alpha/pmap.c:1.295
--- src/sys/arch/alpha/alpha/pmap.c:1.294	Sun Jul  4 22:42:35 2021
+++ src/sys/arch/alpha/alpha/pmap.c	Mon Jul  5 10:00:22 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.294 2021/07/04 22:42:35 thorpej Exp $ */
+/* $NetBSD: pmap.c,v 1.295 2021/07/05 10:00:22 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020
@@ -135,7 +135,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.294 2021/07/04 22:42:35 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.295 2021/07/05 10:00:22 thorpej Exp $");
 
 #include 
 #include 
@@ -2344,7 +2344,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd
 
 		lock = pmap_pvh_lock(pg);
 		mutex_enter(lock);
-		md->pvh_listx |= attrs;
+		attrs = (md->pvh_listx |= attrs);
 		mutex_exit(lock);
 
 		/* Set up referenced/modified emulation for new mapping. */



CVS commit: src/common/lib/libc/arch/aarch64/atomic

2021-07-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jul  5 08:50:31 UTC 2021

Modified Files:
src/common/lib/libc/arch/aarch64/atomic: atomic_nand_32.S
atomic_nand_64.S atomic_nand_8.S

Log Message:
typo in comment s/pte/ptr/


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S \
src/common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S \
src/common/lib/libc/arch/aarch64/atomic/atomic_nand_8.S

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

Modified files:

Index: src/common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S
diff -u src/common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S:1.3 src/common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S:1.4
--- src/common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S:1.3	Sun Jul  4 06:55:47 2021
+++ src/common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S	Mon Jul  5 08:50:31 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: atomic_nand_32.S,v 1.3 2021/07/04 06:55:47 skrll Exp $ */
+/* $NetBSD: atomic_nand_32.S,v 1.4 2021/07/05 08:50:31 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@ ENTRY_NP(_atomic_nand_32)
 	mov	x4, x0
 1:	ldxr	w0, [x4]		/* load old value (to be returned) */
 	and	w3, w0, w1		/* w3 =  (*ptr & value) */
-	mvn	w3, w3			/* x3 = ~(*pte & value) */
+	mvn	w3, w3			/* x3 = ~(*ptr & value) */
 	stxr	w2, w3, [x4]		/* try to store */
 	cbnz	w2, 2f			/*   succeed? no, try again */
 	ret/* return old value */
@@ -58,7 +58,7 @@ ENTRY_NP(_atomic_nand_32_nv)
 	mov	x4, x0			/* need r0 for return value */
 1:	ldxr	w0, [x4]		/* load old value (*ptr) */
 	and	w0, w0, w1		/* x0 =  (*ptr & value) */
-	mvn	w0, w0			/* x0 = ~(*pte & value), return value */
+	mvn	w0, w0			/* x0 = ~(*ptr & value), return value */
 	stxr	w2, w0, [x4]		/* try to store */
 	cbnz	w2, 2f			/*   succeed? no, try again? */
 	ret/* return new value */
Index: src/common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S
diff -u src/common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S:1.3 src/common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S:1.4
--- src/common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S:1.3	Sun Jul  4 06:55:47 2021
+++ src/common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S	Mon Jul  5 08:50:31 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: atomic_nand_64.S,v 1.3 2021/07/04 06:55:47 skrll Exp $ */
+/* $NetBSD: atomic_nand_64.S,v 1.4 2021/07/05 08:50:31 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@ ENTRY_NP(_atomic_nand_64)
 	mov	x4, x0
 1:	ldxr	x0, [x4]		/* load old value (*ptr) */
 	and	x2, x0, x1		/* x2 =  (*ptr & value) */
-	mvn	x2, x2			/* x2 = ~(*pte & value) */
+	mvn	x2, x2			/* x2 = ~(*ptr & value) */
 	stxr	w3, x2, [x4]		/* try to store */
 	cbnz	w3, 2f			/*   succeed? no, try again */
 	ret/* return old value */
@@ -58,7 +58,7 @@ ENTRY_NP(_atomic_nand_64_nv)
 	mov	x4, x0			/* need r0 for return value */
 1:	ldxr	x0, [x4]		/* load old value (*ptr) */
 	and	x0, x0, x1		/* x0 =  (*ptr & value) */
-	mvn	x0, x0			/* x0 = ~(*pte & value), return value */
+	mvn	x0, x0			/* x0 = ~(*ptr & value), return value */
 	stxr	w3, x0, [x4]		/* try to store */
 	cbnz	w3, 2f			/*   succeed? no, try again? */
 	ret/* return new value */
Index: src/common/lib/libc/arch/aarch64/atomic/atomic_nand_8.S
diff -u src/common/lib/libc/arch/aarch64/atomic/atomic_nand_8.S:1.3 src/common/lib/libc/arch/aarch64/atomic/atomic_nand_8.S:1.4
--- src/common/lib/libc/arch/aarch64/atomic/atomic_nand_8.S:1.3	Sun Jul  4 06:55:47 2021
+++ src/common/lib/libc/arch/aarch64/atomic/atomic_nand_8.S	Mon Jul  5 08:50:31 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: atomic_nand_8.S,v 1.3 2021/07/04 06:55:47 skrll Exp $ */
+/* $NetBSD: atomic_nand_8.S,v 1.4 2021/07/05 08:50:31 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@ ENTRY_NP(_atomic_nand_8)
 	mov	x4, x0
 1:	ldxrb	w0, [x4]		/* load old value (*ptr) */
 	and	w3, w0, w1		/* w3 =  (*ptr & value) */
-	mvn	w3, w3			/* w3 = ~(*pte & value) */
+	mvn	w3, w3			/* w3 = ~(*ptr & value) */
 	stxrb	w2, w3, [x4]		/* try to store */
 	cbnz	w2, 2f			/*   succeed? no, try again */
 	ret/* return old value */
@@ -57,7 +57,7 @@ ENTRY_NP(_atomic_nand_8_nv)
 	mov	x4, x0			/* need r0 for return value */
 1:	ldxrb	w0, [x4]		/* load old value (*ptr) */
 	and	w0, w0, w1		/* w0 =  (*ptr & value) */
-	mvn	w0, w0			/* w0 = ~(*pte & value), return value */
+	mvn	w0, w0			/* w0 = ~(*ptr & value), return value */
 	stxrb	w2, w0, [x4]		/* try to store */
 	cbnz	w2, 2f			/*   succeed? no, try again? */
 	ret/* return new value */



CVS commit: src/lib/libc/stdio

2021-07-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jul  5 07:26:00 UTC 2021

Modified Files:
src/lib/libc/stdio: fflush.c

Log Message:
Account for partial writes when interrupted (from FreeBSD).


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/lib/libc/stdio/fflush.c

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

Modified files:

Index: src/lib/libc/stdio/fflush.c
diff -u src/lib/libc/stdio/fflush.c:1.18 src/lib/libc/stdio/fflush.c:1.19
--- src/lib/libc/stdio/fflush.c:1.18	Tue Mar 27 11:05:42 2012
+++ src/lib/libc/stdio/fflush.c	Mon Jul  5 03:26:00 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fflush.c,v 1.18 2012/03/27 15:05:42 christos Exp $	*/
+/*	$NetBSD: fflush.c,v 1.19 2021/07/05 07:26:00 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)fflush.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: fflush.c,v 1.18 2012/03/27 15:05:42 christos Exp $");
+__RCSID("$NetBSD: fflush.c,v 1.19 2021/07/05 07:26:00 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -45,6 +45,8 @@ __RCSID("$NetBSD: fflush.c,v 1.18 2012/0
 #include 
 #include 
 #include 
+#include 
+
 #include "reentrant.h"
 #include "local.h"
 
@@ -106,6 +108,14 @@ __sflush(FILE *fp)
 	for (; n > 0; n -= t, p += t) {
 		t = (*fp->_write)(fp->_cookie, (char *)p, n);
 		if (t <= 0) {
+			/* Reset _p and _w. */
+			if (p > fp->_p) {
+/* Some was written. */
+memmove(fp->_p, p, n);
+fp->_p += n;
+if ((fp->_flags & (__SLBF | __SNBF)) == 0)
+	fp->_w -= n;
+			}
 			fp->_flags |= __SERR;
 			return EOF;
 		}