CVS commit: src/sys/kern

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Sep 27 00:51:10 UTC 2021

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

Log Message:
Tweak filt_piperead() and filt_pipewrite() so that:
- There is only a single return from the function (and thus a single
  place where the pipe lock must be released).
- kn->kn_data is referenced only inside the lock perimeter.


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/sys/kern/sys_pipe.c

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



CVS commit: src/sys/kern

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Sep 27 00:51:10 UTC 2021

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

Log Message:
Tweak filt_piperead() and filt_pipewrite() so that:
- There is only a single return from the function (and thus a single
  place where the pipe lock must be released).
- kn->kn_data is referenced only inside the lock perimeter.


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/sys/kern/sys_pipe.c

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

Modified files:

Index: src/sys/kern/sys_pipe.c
diff -u src/sys/kern/sys_pipe.c:1.155 src/sys/kern/sys_pipe.c:1.156
--- src/sys/kern/sys_pipe.c:1.155	Sun Sep 26 15:48:54 2021
+++ src/sys/kern/sys_pipe.c	Mon Sep 27 00:51:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_pipe.c,v 1.155 2021/09/26 15:48:54 thorpej Exp $	*/
+/*	$NetBSD: sys_pipe.c,v 1.156 2021/09/27 00:51:10 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.155 2021/09/26 15:48:54 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.156 2021/09/27 00:51:10 thorpej Exp $");
 
 #include 
 #include 
@@ -1045,6 +1045,7 @@ filt_piperead(struct knote *kn, long hin
 {
 	struct pipe *rpipe = ((file_t *)kn->kn_obj)->f_pipe;
 	struct pipe *wpipe;
+	int rv;
 
 	if ((hint & NOTE_SUBMIT) == 0) {
 		mutex_enter(rpipe->pipe_lock);
@@ -1055,16 +1056,15 @@ filt_piperead(struct knote *kn, long hin
 	if ((rpipe->pipe_state & PIPE_EOF) ||
 	(wpipe == NULL) || (wpipe->pipe_state & PIPE_EOF)) {
 		kn->kn_flags |= EV_EOF;
-		if ((hint & NOTE_SUBMIT) == 0) {
-			mutex_exit(rpipe->pipe_lock);
-		}
-		return (1);
+		rv = 1;
+	} else {
+		rv = kn->kn_data > 0;
 	}
 
 	if ((hint & NOTE_SUBMIT) == 0) {
 		mutex_exit(rpipe->pipe_lock);
 	}
-	return (kn->kn_data > 0);
+	return rv;
 }
 
 static int
@@ -1072,6 +1072,7 @@ filt_pipewrite(struct knote *kn, long hi
 {
 	struct pipe *rpipe = ((file_t *)kn->kn_obj)->f_pipe;
 	struct pipe *wpipe;
+	int rv;
 
 	if ((hint & NOTE_SUBMIT) == 0) {
 		mutex_enter(rpipe->pipe_lock);
@@ -1081,17 +1082,16 @@ filt_pipewrite(struct knote *kn, long hi
 	if ((wpipe == NULL) || (wpipe->pipe_state & PIPE_EOF)) {
 		kn->kn_data = 0;
 		kn->kn_flags |= EV_EOF;
-		if ((hint & NOTE_SUBMIT) == 0) {
-			mutex_exit(rpipe->pipe_lock);
-		}
-		return (1);
+		rv = 1;
+	} else {
+		kn->kn_data = wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt;
+		rv = kn->kn_data >= PIPE_BUF;
 	}
-	kn->kn_data = wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt;
 
 	if ((hint & NOTE_SUBMIT) == 0) {
 		mutex_exit(rpipe->pipe_lock);
 	}
-	return (kn->kn_data >= PIPE_BUF);
+	return rv;
 }
 
 static const struct filterops pipe_rfiltops = {



CVS commit: src/sys/kern

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Sep 27 00:40:49 UTC 2021

Modified Files:
src/sys/kern: sys_eventfd.c sys_timerfd.c tty.c

Log Message:
Consistently reference kn->kn_data only within the lock perimeter in
the filtops f_event() callback.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/kern/sys_eventfd.c
cvs rdiff -u -r1.5 -r1.6 src/sys/kern/sys_timerfd.c
cvs rdiff -u -r1.296 -r1.297 src/sys/kern/tty.c

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

Modified files:

Index: src/sys/kern/sys_eventfd.c
diff -u src/sys/kern/sys_eventfd.c:1.6 src/sys/kern/sys_eventfd.c:1.7
--- src/sys/kern/sys_eventfd.c:1.6	Sun Sep 26 03:42:54 2021
+++ src/sys/kern/sys_eventfd.c	Mon Sep 27 00:40:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_eventfd.c,v 1.6 2021/09/26 03:42:54 thorpej Exp $	*/
+/*	$NetBSD: sys_eventfd.c,v 1.7 2021/09/27 00:40:49 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_eventfd.c,v 1.6 2021/09/26 03:42:54 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_eventfd.c,v 1.7 2021/09/27 00:40:49 thorpej Exp $");
 
 /*
  * eventfd
@@ -408,6 +408,7 @@ static int
 eventfd_filt_read(struct knote * const kn, long const hint)
 {
 	struct eventfd * const efd = ((file_t *)kn->kn_obj)->f_eventfd;
+	int rv;
 
 	if (hint & NOTE_SUBMIT) {
 		KASSERT(mutex_owned(>efd_lock));
@@ -416,12 +417,13 @@ eventfd_filt_read(struct knote * const k
 	}
 
 	kn->kn_data = (int64_t)efd->efd_val;
+	rv = (eventfd_t)kn->kn_data > 0;
 
 	if ((hint & NOTE_SUBMIT) == 0) {
 		mutex_exit(>efd_lock);
 	}
 
-	return (eventfd_t)kn->kn_data > 0;
+	return rv;
 }
 
 static const struct filterops eventfd_read_filterops = {
@@ -445,6 +447,7 @@ static int
 eventfd_filt_write(struct knote * const kn, long const hint)
 {
 	struct eventfd * const efd = ((file_t *)kn->kn_obj)->f_eventfd;
+	int rv;
 
 	if (hint & NOTE_SUBMIT) {
 		KASSERT(mutex_owned(>efd_lock));
@@ -453,12 +456,13 @@ eventfd_filt_write(struct knote * const 
 	}
 
 	kn->kn_data = (int64_t)efd->efd_val;
+	rv = (eventfd_t)kn->kn_data < EVENTFD_MAXVAL;
 
 	if ((hint & NOTE_SUBMIT) == 0) {
 		mutex_exit(>efd_lock);
 	}
 
-	return (eventfd_t)kn->kn_data < EVENTFD_MAXVAL;
+	return rv;
 }
 
 static const struct filterops eventfd_write_filterops = {

Index: src/sys/kern/sys_timerfd.c
diff -u src/sys/kern/sys_timerfd.c:1.5 src/sys/kern/sys_timerfd.c:1.6
--- src/sys/kern/sys_timerfd.c:1.5	Sun Sep 26 03:42:54 2021
+++ src/sys/kern/sys_timerfd.c	Mon Sep 27 00:40:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_timerfd.c,v 1.5 2021/09/26 03:42:54 thorpej Exp $	*/
+/*	$NetBSD: sys_timerfd.c,v 1.6 2021/09/27 00:40:49 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_timerfd.c,v 1.5 2021/09/26 03:42:54 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_timerfd.c,v 1.6 2021/09/27 00:40:49 thorpej Exp $");
 
 /*
  * timerfd
@@ -404,6 +404,7 @@ static int
 timerfd_filt_read(struct knote * const kn, long const hint)
 {
 	struct timerfd * const tfd = ((file_t *)kn->kn_obj)->f_timerfd;
+	int rv;
 
 	if (hint & NOTE_SUBMIT) {
 		KASSERT(itimer_lock_held());
@@ -412,12 +413,13 @@ timerfd_filt_read(struct knote * const k
 	}
 
 	kn->kn_data = (int64_t)timerfd_fire_count(tfd);
+	rv = kn->kn_data != 0;
 
 	if ((hint & NOTE_SUBMIT) == 0) {
 		itimer_unlock();
 	}
 
-	return kn->kn_data != 0;
+	return rv;
 }
 
 static const struct filterops timerfd_read_filterops = {

Index: src/sys/kern/tty.c
diff -u src/sys/kern/tty.c:1.296 src/sys/kern/tty.c:1.297
--- src/sys/kern/tty.c:1.296	Sun Sep 26 01:16:10 2021
+++ src/sys/kern/tty.c	Mon Sep 27 00:40:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty.c,v 1.296 2021/09/26 01:16:10 thorpej Exp $	*/
+/*	$NetBSD: tty.c,v 1.297 2021/09/27 00:40:49 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2020 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.296 2021/09/26 01:16:10 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.297 2021/09/27 00:40:49 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1477,14 +1477,16 @@ static int
 filt_ttyread(struct knote *kn, long hint)
 {
 	struct tty	*tp;
+	int rv;
 
 	tp = kn->kn_hook;
 	if ((hint & NOTE_SUBMIT) == 0)
 		mutex_spin_enter(_lock);
 	kn->kn_data = ttnread(tp);
+	rv = kn->kn_data > 0;
 	if ((hint & NOTE_SUBMIT) == 0)
 		mutex_spin_exit(_lock);
-	return (kn->kn_data > 0);
+	return rv;
 }
 
 static void



CVS commit: src/sys/kern

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Sep 27 00:40:49 UTC 2021

Modified Files:
src/sys/kern: sys_eventfd.c sys_timerfd.c tty.c

Log Message:
Consistently reference kn->kn_data only within the lock perimeter in
the filtops f_event() callback.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/kern/sys_eventfd.c
cvs rdiff -u -r1.5 -r1.6 src/sys/kern/sys_timerfd.c
cvs rdiff -u -r1.296 -r1.297 src/sys/kern/tty.c

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



CVS commit: src/sys/kern

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 23:37:40 UTC 2021

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

Log Message:
In kqueue_kqfilter(), return EINVAL instead of 1 if something other than
EVFILT_READ was requested.


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/kern/kern_event.c

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

Modified files:

Index: src/sys/kern/kern_event.c
diff -u src/sys/kern/kern_event.c:1.125 src/sys/kern/kern_event.c:1.126
--- src/sys/kern/kern_event.c:1.125	Sun Sep 26 23:34:46 2021
+++ src/sys/kern/kern_event.c	Sun Sep 26 23:37:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_event.c,v 1.125 2021/09/26 23:34:46 thorpej Exp $	*/
+/*	$NetBSD: kern_event.c,v 1.126 2021/09/26 23:37:40 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.125 2021/09/26 23:34:46 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.126 2021/09/26 23:37:40 thorpej Exp $");
 
 #include 
 #include 
@@ -1834,7 +1834,7 @@ kqueue_kqfilter(file_t *fp, struct knote
 	KASSERT(fp == kn->kn_obj);
 
 	if (kn->kn_filter != EVFILT_READ)
-		return 1;
+		return EINVAL;
 
 	kn->kn_fop = _filtops;
 	mutex_enter(>kq_lock);



CVS commit: src/sys/kern

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 23:37:40 UTC 2021

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

Log Message:
In kqueue_kqfilter(), return EINVAL instead of 1 if something other than
EVFILT_READ was requested.


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/kern/kern_event.c

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



CVS commit: src/sys/kern

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 23:34:46 UTC 2021

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

Log Message:
- Rename kqueue_misc_lock -> kqueue_timer_lock, since EVFILT_TIMER is
  now its only user.  Also initialize it as IPL_SOFTCLOCK; there is no
  practical difference in how it operates (it is still an adaptive lock),
  but this serves as a visual reminder that we are interlocking against
  a callout.
- Add some comments that describe why we don't need to hold kqueue_timer_lock
  when detaching an EVFILT_TIMER due to guarantees made by callout_halt().
- Mark timer_filtops as MPSAFE.


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/kern/kern_event.c

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

Modified files:

Index: src/sys/kern/kern_event.c
diff -u src/sys/kern/kern_event.c:1.124 src/sys/kern/kern_event.c:1.125
--- src/sys/kern/kern_event.c:1.124	Sun Sep 26 21:29:38 2021
+++ src/sys/kern/kern_event.c	Sun Sep 26 23:34:46 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_event.c,v 1.124 2021/09/26 21:29:38 thorpej Exp $	*/
+/*	$NetBSD: kern_event.c,v 1.125 2021/09/26 23:34:46 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.124 2021/09/26 21:29:38 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.125 2021/09/26 23:34:46 thorpej Exp $");
 
 #include 
 #include 
@@ -154,7 +154,7 @@ static const struct filterops file_filto
 };
 
 static const struct filterops timer_filtops = {
-	.f_flags = 0,
+	.f_flags = FILTEROP_MPSAFE,
 	.f_attach = filt_timerattach,
 	.f_detach = filt_timerdetach,
 	.f_event = filt_timer,
@@ -222,7 +222,7 @@ static size_t		user_kfiltersz;		/* size 
  *
  *	kqueue_filter_lock
  *	-> kn_kq->kq_fdp->fd_lock
- *	-> object lock (e.g., device driver lock, kqueue_misc_lock, )
+ *	-> object lock (e.g., device driver lock, )
  *	-> kn_kq->kq_lock
  *
  * Locking rules:
@@ -236,7 +236,7 @@ static size_t		user_kfiltersz;		/* size 
  *	acquires/releases object lock inside.
  */
 static krwlock_t	kqueue_filter_lock;	/* lock on filter lists */
-static kmutex_t		kqueue_misc_lock;	/* miscellaneous */
+static kmutex_t		kqueue_timer_lock;	/* for EVFILT_TIMER */
 
 static int
 filter_attach(struct knote *kn)
@@ -333,7 +333,7 @@ kqueue_init(void)
 {
 
 	rw_init(_filter_lock);
-	mutex_init(_misc_lock, MUTEX_DEFAULT, IPL_NONE);
+	mutex_init(_timer_lock, MUTEX_DEFAULT, IPL_SOFTCLOCK);
 
 	kqueue_listener = kauth_listen_scope(KAUTH_SCOPE_PROCESS,
 	kqueue_listener_cb, NULL);
@@ -735,7 +735,7 @@ filt_timerexpire(void *knx)
 	struct knote *kn = knx;
 	int tticks;
 
-	mutex_enter(_misc_lock);
+	mutex_enter(_timer_lock);
 	kn->kn_data++;
 	knote_activate(kn);
 	if ((kn->kn_flags & EV_ONESHOT) == 0) {
@@ -744,7 +744,7 @@ filt_timerexpire(void *knx)
 			tticks = 1;
 		callout_schedule((callout_t *)kn->kn_hook, tticks);
 	}
-	mutex_exit(_misc_lock);
+	mutex_exit(_timer_lock);
 }
 
 /*
@@ -790,13 +790,27 @@ filt_timerdetach(struct knote *kn)
 	callout_t *calloutp;
 	struct kqueue *kq = kn->kn_kq;
 
+	/*
+	 * We don't need to hold the kqueue_timer_lock here; even
+	 * if filt_timerexpire() misses our setting of EV_ONESHOT,
+	 * we are guaranteed that the callout will no longer be
+	 * scheduled even if we attempted to halt it after it already
+	 * started running, even if it rescheduled itself.
+	 */
+
 	mutex_spin_enter(>kq_lock);
 	/* prevent rescheduling when we expire */
 	kn->kn_flags |= EV_ONESHOT;
 	mutex_spin_exit(>kq_lock);
 
 	calloutp = (callout_t *)kn->kn_hook;
+
+	/*
+	 * Attempt to stop the callout.  This will block if it's
+	 * already running.
+	 */
 	callout_halt(calloutp, NULL);
+
 	callout_destroy(calloutp);
 	kmem_free(calloutp, sizeof(*calloutp));
 	atomic_dec_uint(_ncallouts);
@@ -807,9 +821,9 @@ filt_timer(struct knote *kn, long hint)
 {
 	int rv;
 
-	mutex_enter(_misc_lock);
+	mutex_enter(_timer_lock);
 	rv = (kn->kn_data != 0);
-	mutex_exit(_misc_lock);
+	mutex_exit(_timer_lock);
 
 	return rv;
 }



CVS commit: src/sys/kern

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 23:34:46 UTC 2021

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

Log Message:
- Rename kqueue_misc_lock -> kqueue_timer_lock, since EVFILT_TIMER is
  now its only user.  Also initialize it as IPL_SOFTCLOCK; there is no
  practical difference in how it operates (it is still an adaptive lock),
  but this serves as a visual reminder that we are interlocking against
  a callout.
- Add some comments that describe why we don't need to hold kqueue_timer_lock
  when detaching an EVFILT_TIMER due to guarantees made by callout_halt().
- Mark timer_filtops as MPSAFE.


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/kern/kern_event.c

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



CVS commit: src/usr.bin/indent

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 21:32:59 UTC 2021

Modified Files:
src/usr.bin/indent: indent_globs.h

Log Message:
indent: fix documentation of opt.case_indent

See io.c, compute_label_indent.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/usr.bin/indent/indent_globs.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/indent/indent_globs.h
diff -u src/usr.bin/indent/indent_globs.h:1.39 src/usr.bin/indent/indent_globs.h:1.40
--- src/usr.bin/indent/indent_globs.h:1.39	Sun Sep 26 21:23:31 2021
+++ src/usr.bin/indent/indent_globs.h	Sun Sep 26 21:32:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent_globs.h,v 1.39 2021/09/26 21:23:31 rillig Exp $	*/
+/*	$NetBSD: indent_globs.h,v 1.40 2021/09/26 21:32:58 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -100,9 +100,9 @@ extern struct options {
 bool	cuddle_else;	/* whether 'else' should cuddle up to '}' */
 int continuation_indent; /* the indentation between the
  * edge of code and continuation lines */
-float   case_indent;	/* The distance (measured in tabsize) to
- * indent case labels from the switch
- * statement */
+float   case_indent;	/* The distance (measured in indentation
+ * levels) to indent case labels from the
+ * switch statement */
 int comment_column;	/* the column in which comments to the right
  * of code should start */
 int decl_indent;	/* indentation of identifier in declaration */



CVS commit: src/usr.bin/indent

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 21:32:59 UTC 2021

Modified Files:
src/usr.bin/indent: indent_globs.h

Log Message:
indent: fix documentation of opt.case_indent

See io.c, compute_label_indent.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/usr.bin/indent/indent_globs.h

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



CVS commit: src/usr.bin/indent

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 21:31:57 UTC 2021

Modified Files:
src/usr.bin/indent: indent.1

Log Message:
indent: fix definition of -cli in manual page

See io.c, compute_label_indent.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/indent/indent.1

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

Modified files:

Index: src/usr.bin/indent/indent.1
diff -u src/usr.bin/indent/indent.1:1.29 src/usr.bin/indent/indent.1:1.30
--- src/usr.bin/indent/indent.1:1.29	Sat Mar  6 21:08:08 2021
+++ src/usr.bin/indent/indent.1	Sun Sep 26 21:31:57 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: indent.1,v 1.29 2021/03/06 21:08:08 rillig Exp $
+.\"	$NetBSD: indent.1,v 1.30 2021/09/26 21:31:57 rillig Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\"	@(#)indent.1	8.1 (Berkeley) 7/1/93
 .\" $FreeBSD: head/usr.bin/indent/indent.1 334944 2018-06-11 05:35:57Z pstef $
 .\"
-.Dd March 6, 2021
+.Dd September 26, 2021
 .Dt INDENT 1
 .Os
 .Sh NAME
@@ -254,11 +254,11 @@ defaults to the same value as
 .It Fl cli Ns Ar n
 Causes case labels to be indented
 .Ar n
-tab stops to the right of the containing
+indentation levels to the right of the containing
 .Ic switch
 statement.
 .Fl cli0.5
-causes case labels to be indented half a tab stop.
+causes case labels to be indented half an indentation level.
 The
 default is
 .Fl cli0 .



CVS commit: src/usr.bin/indent

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 21:31:57 UTC 2021

Modified Files:
src/usr.bin/indent: indent.1

Log Message:
indent: fix definition of -cli in manual page

See io.c, compute_label_indent.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/indent/indent.1

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



CVS commit: src/sys

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 21:29:39 UTC 2021

Modified Files:
src/sys/kern: kern_event.c vfs_init.c vfs_syscalls.c
src/sys/sys: event.h

Log Message:
Fix the locking around EVFILT_FS.  Previously, the code would walk the
fs_klist and take the kqueue_misc_lock inside the event callback.
However, that list can be modified by the attach and detach callbacks,
which could result in the walker stepping right off a cliff.

Instead, we give the fs_klist it's own lock, and hold it while we
call knote(), using the NOTE_SUBMIT protocol.  Also, fs_filtops
into vfs_syscalls.c so all of the locking logic is contained in one
file (there is precedence with sig_filtops).  fs_filtops is now marked
MPSAFE.


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/kern/kern_event.c
cvs rdiff -u -r1.52 -r1.53 src/sys/kern/vfs_init.c
cvs rdiff -u -r1.552 -r1.553 src/sys/kern/vfs_syscalls.c
cvs rdiff -u -r1.42 -r1.43 src/sys/sys/event.h

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

Modified files:

Index: src/sys/kern/kern_event.c
diff -u src/sys/kern/kern_event.c:1.123 src/sys/kern/kern_event.c:1.124
--- src/sys/kern/kern_event.c:1.123	Sun Sep 26 18:13:58 2021
+++ src/sys/kern/kern_event.c	Sun Sep 26 21:29:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_event.c,v 1.123 2021/09/26 18:13:58 thorpej Exp $	*/
+/*	$NetBSD: kern_event.c,v 1.124 2021/09/26 21:29:38 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.123 2021/09/26 18:13:58 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.124 2021/09/26 21:29:38 thorpej Exp $");
 
 #include 
 #include 
@@ -108,9 +108,6 @@ static void	filt_timerexpire(void *x);
 static int	filt_timerattach(struct knote *);
 static void	filt_timerdetach(struct knote *);
 static int	filt_timer(struct knote *, long hint);
-static int	filt_fsattach(struct knote *kn);
-static void	filt_fsdetach(struct knote *kn);
-static int	filt_fs(struct knote *kn, long hint);
 static int	filt_userattach(struct knote *);
 static void	filt_userdetach(struct knote *);
 static int	filt_user(struct knote *, long hint);
@@ -163,13 +160,6 @@ static const struct filterops timer_filt
 	.f_event = filt_timer,
 };
 
-static const struct filterops fs_filtops = {
-	.f_flags = 0,
-	.f_attach = filt_fsattach,
-	.f_detach = filt_fsdetach,
-	.f_event = filt_fs,
-};
-
 static const struct filterops user_filtops = {
 	.f_flags = FILTEROP_MPSAFE,
 	.f_attach = filt_userattach,
@@ -184,7 +174,8 @@ static int	kq_calloutmax = (4 * 1024);
 #define	KN_HASHSIZE		64		/* XXX should be tunable */
 #define	KN_HASH(val, mask)	(((val) ^ (val >> 8)) & (mask))
 
-extern const struct filterops sig_filtops;
+extern const struct filterops fs_filtops;	/* vfs_syscalls.c */
+extern const struct filterops sig_filtops;	/* kern_sig.c */
 
 #define KQ_FLUX_WAKEUP(kq)	cv_broadcast(>kq_cv)
 
@@ -823,45 +814,6 @@ filt_timer(struct knote *kn, long hint)
 	return rv;
 }
 
-/*
- * Filter event method for EVFILT_FS.
- */
-struct klist fs_klist = SLIST_HEAD_INITIALIZER(_klist);
-
-static int
-filt_fsattach(struct knote *kn)
-{
-
-	mutex_enter(_misc_lock);
-	kn->kn_flags |= EV_CLEAR;
-	SLIST_INSERT_HEAD(_klist, kn, kn_selnext);
-	mutex_exit(_misc_lock);
-
-	return 0;
-}
-
-static void
-filt_fsdetach(struct knote *kn)
-{
-
-	mutex_enter(_misc_lock);
-	SLIST_REMOVE(_klist, kn, knote, kn_selnext);
-	mutex_exit(_misc_lock);
-}
-
-static int
-filt_fs(struct knote *kn, long hint)
-{
-	int rv;
-
-	mutex_enter(_misc_lock);
-	kn->kn_fflags |= hint;
-	rv = (kn->kn_fflags != 0);
-	mutex_exit(_misc_lock);
-
-	return rv;
-}
-
 static int
 filt_userattach(struct knote *kn)
 {

Index: src/sys/kern/vfs_init.c
diff -u src/sys/kern/vfs_init.c:1.52 src/sys/kern/vfs_init.c:1.53
--- src/sys/kern/vfs_init.c:1.52	Thu Feb  4 21:07:06 2021
+++ src/sys/kern/vfs_init.c	Sun Sep 26 21:29:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_init.c,v 1.52 2021/02/04 21:07:06 jdolecek Exp $	*/
+/*	$NetBSD: vfs_init.c,v 1.53 2021/09/26 21:29:38 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_init.c,v 1.52 2021/02/04 21:07:06 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_init.c,v 1.53 2021/09/26 21:29:38 thorpej Exp $");
 
 #include 
 #include 
@@ -455,6 +455,9 @@ vfsinit(void)
 	 * included in the kernel.
 	 */
 	module_init_class(MODULE_CLASS_VFS);
+
+	extern kmutex_t fs_klist_lock;
+	mutex_init(_klist_lock, MUTEX_DEFAULT, IPL_NONE);
 }
 
 /*

Index: src/sys/kern/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.552 src/sys/kern/vfs_syscalls.c:1.553
--- src/sys/kern/vfs_syscalls.c:1.552	Sat Sep 11 10:08:55 2021
+++ src/sys/kern/vfs_syscalls.c	Sun Sep 26 21:29:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.552 2021/09/11 10:08:55 

CVS commit: src/sys

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 21:29:39 UTC 2021

Modified Files:
src/sys/kern: kern_event.c vfs_init.c vfs_syscalls.c
src/sys/sys: event.h

Log Message:
Fix the locking around EVFILT_FS.  Previously, the code would walk the
fs_klist and take the kqueue_misc_lock inside the event callback.
However, that list can be modified by the attach and detach callbacks,
which could result in the walker stepping right off a cliff.

Instead, we give the fs_klist it's own lock, and hold it while we
call knote(), using the NOTE_SUBMIT protocol.  Also, fs_filtops
into vfs_syscalls.c so all of the locking logic is contained in one
file (there is precedence with sig_filtops).  fs_filtops is now marked
MPSAFE.


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/kern/kern_event.c
cvs rdiff -u -r1.52 -r1.53 src/sys/kern/vfs_init.c
cvs rdiff -u -r1.552 -r1.553 src/sys/kern/vfs_syscalls.c
cvs rdiff -u -r1.42 -r1.43 src/sys/sys/event.h

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



CVS commit: src/usr.bin/indent

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 21:23:31 UTC 2021

Modified Files:
src/usr.bin/indent: indent.c indent_globs.h io.c lexi.c

Log Message:
indent: unexport global variables

The variable match_state was write-only and was thus removed.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.38 -r1.39 src/usr.bin/indent/indent_globs.h
cvs rdiff -u -r1.67 -r1.68 src/usr.bin/indent/io.c
cvs rdiff -u -r1.60 -r1.61 src/usr.bin/indent/lexi.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/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.87 src/usr.bin/indent/indent.c:1.88
--- src/usr.bin/indent/indent.c:1.87	Sun Sep 26 19:57:23 2021
+++ src/usr.bin/indent/indent.c	Sun Sep 26 21:23:31 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.87 2021/09/26 19:57:23 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.88 2021/09/26 21:23:31 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c	5.1
 
 #include 
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: indent.c,v 1.87 2021/09/26 19:57:23 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.88 2021/09/26 21:23:31 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -99,7 +99,7 @@ char *buf_end;
 
 char sc_buf[sc_size];
 char *save_com;
-char *sc_end;
+static char *sc_end;		/* pointer into save_com buffer */
 
 char *bp_save;
 char *be_save;
@@ -113,11 +113,9 @@ float case_ind;
 bool had_eof;
 int line_no;
 bool inhibit_formatting;
-int suppress_blanklines;
 
-int ifdef_level;
-struct parser_state state_stack[5];
-struct parser_state match_state[5];
+static int ifdef_level;
+static struct parser_state state_stack[5];
 
 FILE *input;
 FILE *output;
@@ -125,13 +123,10 @@ FILE *output;
 static void bakcopy(void);
 static void indent_declaration(int, bool);
 
-const char *in_name = "Standard Input";	/* will always point to name of input
-	 * file */
-const char *out_name = "Standard Output";	/* will always point to name
-		 * of output file */
-const char *simple_backup_suffix = ".BAK";	/* Suffix to use for backup
-		 * files */
-char bakfile[MAXPATHLEN] = "";
+static const char *in_name = "Standard Input";
+static const char *out_name = "Standard Output";
+static const char *backup_suffix = ".BAK";
+static char bakfile[MAXPATHLEN] = "";
 
 static void
 check_size_code(size_t desired_size)
@@ -404,7 +399,7 @@ main_init_globals(void)
 
 const char *suffix = getenv("SIMPLE_BACKUP_SUFFIX");
 if (suffix != NULL)
-	simple_backup_suffix = suffix;
+	backup_suffix = suffix;
 }
 
 static void
@@ -1150,18 +1145,15 @@ process_preprocessing(void)
 }
 
 if (strncmp(lab.s, "#if", 3) == 0) {	/* also ifdef, ifndef */
-	if ((size_t)ifdef_level < nitems(state_stack)) {
-	match_state[ifdef_level].tos = -1;
+	if ((size_t)ifdef_level < nitems(state_stack))
 	state_stack[ifdef_level++] = ps;
-	} else
+	else
 	diag(1, "#if stack overflow");
 } else if (strncmp(lab.s, "#el", 3) == 0) {	/* else, elif */
 	if (ifdef_level <= 0)
 	diag(1, lab.s[3] == 'i' ? "Unmatched #elif" : "Unmatched #else");
-	else {
-	match_state[ifdef_level - 1] = ps;
+	else
 	ps = state_stack[ifdef_level - 1];
-	}
 } else if (strncmp(lab.s, "#endif", 6) == 0) {
 	if (ifdef_level <= 0)
 	diag(1, "Unmatched #endif");
@@ -1418,7 +1410,7 @@ bakcopy(void)
 	p--;
 if (*p == '/')
 	p++;
-sprintf(bakfile, "%s%s", p, simple_backup_suffix);
+sprintf(bakfile, "%s%s", p, backup_suffix);
 
 /* copy in_name to backup file */
 bakchn = creat(bakfile, 0600);

Index: src/usr.bin/indent/indent_globs.h
diff -u src/usr.bin/indent/indent_globs.h:1.38 src/usr.bin/indent/indent_globs.h:1.39
--- src/usr.bin/indent/indent_globs.h:1.38	Sun Sep 26 19:57:23 2021
+++ src/usr.bin/indent/indent_globs.h	Sun Sep 26 21:23:31 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent_globs.h,v 1.38 2021/09/26 19:57:23 rillig Exp $	*/
+/*	$NetBSD: indent_globs.h,v 1.39 2021/09/26 21:23:31 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -70,7 +70,6 @@ extern char   *buf_end;		/* ptr to f
 extern charsc_buf[sc_size];	/* input text is saved here when looking for
  * the brace after an if, while, etc */
 extern char   *save_com;		/* start of the comment stored in sc_buf */
-extern char   *sc_end;		/* pointer into save_com buffer */
 
 extern char   *bp_save;		/* saved value of buf_ptr when taking input
  * from save_com */
@@ -184,8 +183,6 @@ extern float   case_ind;	/* indentat
 extern boolhad_eof;		/* whether input is exhausted */
 extern int line_no;		/* the current line number. */
 extern boolinhibit_formatting;	/* true if INDENT OFF is in effect */
-extern int   

CVS commit: src/usr.bin/indent

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 21:23:31 UTC 2021

Modified Files:
src/usr.bin/indent: indent.c indent_globs.h io.c lexi.c

Log Message:
indent: unexport global variables

The variable match_state was write-only and was thus removed.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.38 -r1.39 src/usr.bin/indent/indent_globs.h
cvs rdiff -u -r1.67 -r1.68 src/usr.bin/indent/io.c
cvs rdiff -u -r1.60 -r1.61 src/usr.bin/indent/lexi.c

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



CVS commit: src/usr.bin/indent

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 21:05:48 UTC 2021

Modified Files:
src/usr.bin/indent: args.c lexi.c

Log Message:
indent: unexport keyword table, clean up

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.bin/indent/args.c
cvs rdiff -u -r1.59 -r1.60 src/usr.bin/indent/lexi.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/indent/args.c
diff -u src/usr.bin/indent/args.c:1.38 src/usr.bin/indent/args.c:1.39
--- src/usr.bin/indent/args.c:1.38	Sun Sep 26 20:48:10 2021
+++ src/usr.bin/indent/args.c	Sun Sep 26 21:05:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: args.c,v 1.38 2021/09/26 20:48:10 rillig Exp $	*/
+/*	$NetBSD: args.c,v 1.39 2021/09/26 21:05:48 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)args.c	8.1 (
 
 #include 
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: args.c,v 1.38 2021/09/26 20:48:10 rillig Exp $");
+__RCSID("$NetBSD: args.c,v 1.39 2021/09/26 21:05:48 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $");
 #endif
@@ -92,7 +92,7 @@ static const struct pro {
 bool p_is_bool;
 bool p_bool_value;
 bool p_may_negate;
-void *p_obj;		/* the associated variable (bool, int) */
+void *p_var;		/* the associated variable */
 }   pro[] = {
 bool_options("bacc", blanklines_around_conditional_compilation),
 bool_options("bad", blanklines_after_declarations),
@@ -285,12 +285,12 @@ set_option(const char *arg)
 
 found:
 if (p->p_is_bool)
-	*(bool *)p->p_obj = p->p_may_negate ? arg[0] != 'n' : p->p_bool_value;
+	*(bool *)p->p_var = p->p_may_negate ? arg[0] != 'n' : p->p_bool_value;
 else {
 	if (!isdigit((unsigned char)*param_start))
 	errx(1, "%s: ``%s'' requires a parameter",
 		option_source, p->p_name);
-	*(int *)p->p_obj = atoi(param_start);
+	*(int *)p->p_var = atoi(param_start);
 }
 }
 

Index: src/usr.bin/indent/lexi.c
diff -u src/usr.bin/indent/lexi.c:1.59 src/usr.bin/indent/lexi.c:1.60
--- src/usr.bin/indent/lexi.c:1.59	Sun Sep 26 19:37:11 2021
+++ src/usr.bin/indent/lexi.c	Sun Sep 26 21:05:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lexi.c,v 1.59 2021/09/26 19:37:11 rillig Exp $	*/
+/*	$NetBSD: lexi.c,v 1.60 2021/09/26 21:05:48 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)lexi.c	8.1 (
 
 #include 
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: lexi.c,v 1.59 2021/09/26 19:37:11 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.60 2021/09/26 21:05:48 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $");
 #endif
@@ -59,17 +59,11 @@ __FBSDID("$FreeBSD: head/usr.bin/indent/
 
 #include "indent.h"
 
-struct templ {
+/* must be sorted alphabetically, is used in binary search */
+static const struct special {
 const char *rwd;
 enum rwcode rwcode;
-};
-
-/*
- * This table has to be sorted alphabetically, because it'll be used in binary
- * search.
- */
-const struct templ specials[] =
-{
+} specials[] = {
 {"_Bool", rw_type},
 {"_Complex", rw_type},
 {"_Imaginary", rw_type},
@@ -210,9 +204,9 @@ check_size_token(size_t desired_size)
 }
 
 static int
-compare_templ_array(const void *key, const void *elem)
+compare_special_array(const void *key, const void *elem)
 {
-return strcmp(key, ((const struct templ *)elem)->rwd);
+return strcmp(key, ((const struct special *)elem)->rwd);
 }
 
 static int
@@ -368,10 +362,7 @@ lexi(struct parser_state *state)
 if (isalnum((unsigned char)*buf_ptr) ||
 	*buf_ptr == '_' || *buf_ptr == '$' ||
 	(buf_ptr[0] == '.' && isdigit((unsigned char)buf_ptr[1]))) {
-	/*
-	 * we have a letter or number
-	 */
-	struct templ *p;
+	struct special *p;
 
 	if (isdigit((unsigned char)*buf_ptr) ||
 	(buf_ptr[0] == '.' && isdigit((unsigned char)buf_ptr[1]))) {
@@ -388,12 +379,9 @@ lexi(struct parser_state *state)
 	while (*buf_ptr == ' ' || *buf_ptr == '\t')	/* get rid of blanks */
 	inbuf_next();
 	state->keyword = rw_0;
+
 	if (state->last_token == keyword_struct_union_enum &&
-	state->p_l_follow == 0) {
-	/*
-	 * if last token was 'struct' and we're not in parentheses, then
-	 * this token should be treated as a declaration
-	 */
+		state->p_l_follow == 0) {
 	state->last_u_d = true;
 	return lexi_end(decl);
 	}
@@ -403,7 +391,7 @@ lexi(struct parser_state *state)
 	state->last_u_d = (state->last_token == keyword_struct_union_enum);
 
 	p = bsearch(token.s, specials, sizeof specials / sizeof specials[0],
-	sizeof specials[0], compare_templ_array);
+	sizeof specials[0], compare_special_array);
 	if (p == NULL) {	/* not a special keyword... */
 	char *u;
 



CVS commit: src/usr.bin/indent

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 21:05:48 UTC 2021

Modified Files:
src/usr.bin/indent: args.c lexi.c

Log Message:
indent: unexport keyword table, clean up

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.bin/indent/args.c
cvs rdiff -u -r1.59 -r1.60 src/usr.bin/indent/lexi.c

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



CVS commit: src/sys/arch/arm/cortex

2021-09-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep 26 20:55:15 UTC 2021

Modified Files:
src/sys/arch/arm/cortex: gic_splfuncs.c

Log Message:
Add missing insn barrier


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/cortex/gic_splfuncs.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/arm/cortex/gic_splfuncs.c
diff -u src/sys/arch/arm/cortex/gic_splfuncs.c:1.3 src/sys/arch/arm/cortex/gic_splfuncs.c:1.4
--- src/sys/arch/arm/cortex/gic_splfuncs.c:1.3	Mon Sep 20 21:05:14 2021
+++ src/sys/arch/arm/cortex/gic_splfuncs.c	Sun Sep 26 20:55:15 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: gic_splfuncs.c,v 1.3 2021/09/20 21:05:14 jmcneill Exp $ */
+/* $NetBSD: gic_splfuncs.c,v 1.4 2021/09/26 20:55:15 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2021 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gic_splfuncs.c,v 1.3 2021/09/20 21:05:14 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic_splfuncs.c,v 1.4 2021/09/26 20:55:15 jmcneill Exp $");
 
 #include 
 #include 
@@ -93,6 +93,7 @@ gic_splx(int newipl)
 	 */
 	if (__predict_true(ci->ci_intr_depth == 0)) {
 		ci->ci_splx_savedipl = newipl;
+		__insn_barrier();
 		ci->ci_splx_restart = &
 		__insn_barrier();
 checkhwpl:



CVS commit: src/sys/arch/arm/cortex

2021-09-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep 26 20:55:15 UTC 2021

Modified Files:
src/sys/arch/arm/cortex: gic_splfuncs.c

Log Message:
Add missing insn barrier


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/cortex/gic_splfuncs.c

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



CVS commit: src/usr.bin/indent

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 20:48:10 UTC 2021

Modified Files:
src/usr.bin/indent: args.c

Log Message:
indent: force all option variables to be in struct options

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/usr.bin/indent/args.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/indent/args.c
diff -u src/usr.bin/indent/args.c:1.37 src/usr.bin/indent/args.c:1.38
--- src/usr.bin/indent/args.c:1.37	Sun Sep 26 20:43:44 2021
+++ src/usr.bin/indent/args.c	Sun Sep 26 20:48:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: args.c,v 1.37 2021/09/26 20:43:44 rillig Exp $	*/
+/*	$NetBSD: args.c,v 1.38 2021/09/26 20:48:10 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)args.c	8.1 (
 
 #include 
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: args.c,v 1.37 2021/09/26 20:43:44 rillig Exp $");
+__RCSID("$NetBSD: args.c,v 1.38 2021/09/26 20:48:10 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $");
 #endif
@@ -75,11 +75,11 @@ static const char *option_source = "?";
 #define assert_type(expr, type) (expr)
 #endif
 #define bool_option(name, value, var) \
-	{name, true, value, false, assert_type(&(var), bool *)}
+	{name, true, value, false, assert_type(&(opt.var), bool *)}
 #define int_option(name, var) \
-	{name, false, false, false, assert_type(&(var), int *)}
+	{name, false, false, false, assert_type(&(opt.var), int *)}
 #define bool_options(name, var) \
-	{name, true, false, true, assert_type(&(var), bool *)}
+	{name, true, false, true, assert_type(&(opt.var), bool *)}
 
 /*
  * N.B.: an option whose name is a prefix of another option must come earlier;
@@ -94,50 +94,50 @@ static const struct pro {
 bool p_may_negate;
 void *p_obj;		/* the associated variable (bool, int) */
 }   pro[] = {
-bool_options("bacc", opt.blanklines_around_conditional_compilation),
-bool_options("bad", opt.blanklines_after_declarations),
-bool_options("badp", opt.blanklines_after_declarations_at_proctop),
-bool_options("bap", opt.blanklines_after_procs),
-bool_options("bbb", opt.blanklines_before_blockcomments),
-bool_options("bc", opt.break_after_comma),
-bool_option("bl", false, opt.btype_2),
-bool_option("br", true, opt.btype_2),
-bool_options("bs", opt.blank_after_sizeof),
-int_option("c", opt.comment_column),
-int_option("cd", opt.decl_comment_column),
-bool_options("cdb", opt.comment_delimiter_on_blankline),
-bool_options("ce", opt.cuddle_else),
-int_option("ci", opt.continuation_indent),
+bool_options("bacc", blanklines_around_conditional_compilation),
+bool_options("bad", blanklines_after_declarations),
+bool_options("badp", blanklines_after_declarations_at_proctop),
+bool_options("bap", blanklines_after_procs),
+bool_options("bbb", blanklines_before_blockcomments),
+bool_options("bc", break_after_comma),
+bool_option("bl", false, btype_2),
+bool_option("br", true, btype_2),
+bool_options("bs", blank_after_sizeof),
+int_option("c", comment_column),
+int_option("cd", decl_comment_column),
+bool_options("cdb", comment_delimiter_on_blankline),
+bool_options("ce", cuddle_else),
+int_option("ci", continuation_indent),
 /* "cli" is special */
-bool_options("cs", opt.space_after_cast),
-int_option("d", opt.unindent_displace),
-int_option("di", opt.decl_indent),
-bool_options("dj", opt.ljust_decl),
-bool_options("eei", opt.extra_expression_indent),
-bool_options("ei", opt.else_if),
-bool_options("fbs", opt.function_brace_split),
-bool_options("fc1", opt.format_col1_comments),
-bool_options("fcb", opt.format_block_comments),
-int_option("i", opt.indent_size),
-bool_options("ip", opt.indent_parameters),
-int_option("l", opt.max_line_length),
-int_option("lc", opt.block_comment_max_line_length),
-int_option("ldi", opt.local_decl_indent),
-bool_options("lp", opt.lineup_to_parens),
-bool_options("lpl", opt.lineup_to_parens_always),
+bool_options("cs", space_after_cast),
+int_option("d", unindent_displace),
+int_option("di", decl_indent),
+bool_options("dj", ljust_decl),
+bool_options("eei", extra_expression_indent),
+bool_options("ei", else_if),
+bool_options("fbs", function_brace_split),
+bool_options("fc1", format_col1_comments),
+bool_options("fcb", format_block_comments),
+int_option("i", indent_size),
+bool_options("ip", indent_parameters),
+int_option("l", max_line_length),
+int_option("lc", block_comment_max_line_length),
+int_option("ldi", local_decl_indent),
+bool_options("lp", lineup_to_parens),
+bool_options("lpl", lineup_to_parens_always),
 /* "npro" is special */
 /* 

CVS commit: src/usr.bin/indent

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 20:48:10 UTC 2021

Modified Files:
src/usr.bin/indent: args.c

Log Message:
indent: force all option variables to be in struct options

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/usr.bin/indent/args.c

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



CVS commit: src/usr.bin/indent

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 20:43:44 UTC 2021

Modified Files:
src/usr.bin/indent: args.c

Log Message:
indent: reduce memory usage of the options table

Almost all boolean options are negatable, so model this directly instead
of saving each option twice. This saves memory, is faster and more
directly models reality.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/usr.bin/indent/args.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/indent/args.c
diff -u src/usr.bin/indent/args.c:1.36 src/usr.bin/indent/args.c:1.37
--- src/usr.bin/indent/args.c:1.36	Sun Sep 26 20:21:47 2021
+++ src/usr.bin/indent/args.c	Sun Sep 26 20:43:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: args.c,v 1.36 2021/09/26 20:21:47 rillig Exp $	*/
+/*	$NetBSD: args.c,v 1.37 2021/09/26 20:43:44 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)args.c	8.1 (
 
 #include 
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: args.c,v 1.36 2021/09/26 20:21:47 rillig Exp $");
+__RCSID("$NetBSD: args.c,v 1.37 2021/09/26 20:43:44 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $");
 #endif
@@ -75,12 +75,11 @@ static const char *option_source = "?";
 #define assert_type(expr, type) (expr)
 #endif
 #define bool_option(name, value, var) \
-	{name, true, value, assert_type(&(var), bool *)}
+	{name, true, value, false, assert_type(&(var), bool *)}
 #define int_option(name, var) \
-	{name, false, false, assert_type(&(var), int *)}
+	{name, false, false, false, assert_type(&(var), int *)}
 #define bool_options(name, var) \
-	bool_option(name, true, var), \
-	bool_option("n" name, false, var)
+	{name, true, false, true, assert_type(&(var), bool *)}
 
 /*
  * N.B.: an option whose name is a prefix of another option must come earlier;
@@ -89,9 +88,10 @@ static const char *option_source = "?";
  * See set_special_option for special options.
  */
 static const struct pro {
-const char p_name[6];	/* name, e.g. "bl", "cli" */
+const char p_name[5];	/* name, e.g. "bl", "cli" */
 bool p_is_bool;
 bool p_bool_value;
+bool p_may_negate;
 void *p_obj;		/* the associated variable (bool, int) */
 }   pro[] = {
 bool_options("bacc", opt.blanklines_around_conditional_compilation),
@@ -201,8 +201,10 @@ scan_profile(FILE *f)
 }
 
 static const char *
-skip_over(const char *s, const char *prefix)
+skip_over(const char *s, bool may_negate, const char *prefix)
 {
+if (may_negate && s[0] == 'n')
+	s++;
 while (*prefix != '\0') {
 	if (*prefix++ != *s++)
 	return NULL;
@@ -274,15 +276,16 @@ set_option(const char *arg)
 if (set_special_option(arg))
 	return;
 
-for (p = pro + nitems(pro); p-- != pro; )
-	if (p->p_name[0] == arg[0])
-	if ((param_start = skip_over(arg, p->p_name)) != NULL)
-		goto found;
+for (p = pro + nitems(pro); p-- != pro;) {
+	param_start = skip_over(arg, p->p_may_negate, p->p_name);
+	if (param_start != NULL)
+	goto found;
+}
 errx(1, "%s: unknown parameter \"%s\"", option_source, arg - 1);
 
 found:
 if (p->p_is_bool)
-	*(bool *)p->p_obj = p->p_bool_value;
+	*(bool *)p->p_obj = p->p_may_negate ? arg[0] != 'n' : p->p_bool_value;
 else {
 	if (!isdigit((unsigned char)*param_start))
 	errx(1, "%s: ``%s'' requires a parameter",



CVS commit: src/usr.bin/indent

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 20:43:44 UTC 2021

Modified Files:
src/usr.bin/indent: args.c

Log Message:
indent: reduce memory usage of the options table

Almost all boolean options are negatable, so model this directly instead
of saving each option twice. This saves memory, is faster and more
directly models reality.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/usr.bin/indent/args.c

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



CVS commit: src/usr.bin/indent

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 20:21:47 UTC 2021

Modified Files:
src/usr.bin/indent: args.c

Log Message:
indent: list options in the same order as in the manual page

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/usr.bin/indent/args.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/indent/args.c
diff -u src/usr.bin/indent/args.c:1.35 src/usr.bin/indent/args.c:1.36
--- src/usr.bin/indent/args.c:1.35	Sun Sep 26 20:12:37 2021
+++ src/usr.bin/indent/args.c	Sun Sep 26 20:21:47 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: args.c,v 1.35 2021/09/26 20:12:37 rillig Exp $	*/
+/*	$NetBSD: args.c,v 1.36 2021/09/26 20:21:47 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)args.c	8.1 (
 
 #include 
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: args.c,v 1.35 2021/09/26 20:12:37 rillig Exp $");
+__RCSID("$NetBSD: args.c,v 1.36 2021/09/26 20:21:47 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $");
 #endif
@@ -83,11 +83,10 @@ static const char *option_source = "?";
 	bool_option("n" name, false, var)
 
 /*
- * N.B.: because of the way the table here is scanned, options whose names are
- * a prefix of other options must occur later; that is, with -lp vs -l, -lp
- * must be first and -l must be last.
+ * N.B.: an option whose name is a prefix of another option must come earlier;
+ * for example, "l" must come before "lp".
  *
- * See also set_special_option.
+ * See set_special_option for special options.
  */
 static const struct pro {
 const char p_name[6];	/* name, e.g. "bl", "cli" */
@@ -96,41 +95,47 @@ static const struct pro {
 void *p_obj;		/* the associated variable (bool, int) */
 }   pro[] = {
 bool_options("bacc", opt.blanklines_around_conditional_compilation),
-bool_options("badp", opt.blanklines_after_declarations_at_proctop),
 bool_options("bad", opt.blanklines_after_declarations),
+bool_options("badp", opt.blanklines_after_declarations_at_proctop),
 bool_options("bap", opt.blanklines_after_procs),
 bool_options("bbb", opt.blanklines_before_blockcomments),
 bool_options("bc", opt.break_after_comma),
 bool_option("bl", false, opt.btype_2),
 bool_option("br", true, opt.btype_2),
 bool_options("bs", opt.blank_after_sizeof),
-bool_options("cdb", opt.comment_delimiter_on_blankline),
+int_option("c", opt.comment_column),
 int_option("cd", opt.decl_comment_column),
+bool_options("cdb", opt.comment_delimiter_on_blankline),
 bool_options("ce", opt.cuddle_else),
 int_option("ci", opt.continuation_indent),
+/* "cli" is special */
 bool_options("cs", opt.space_after_cast),
-int_option("c", opt.comment_column),
+int_option("d", opt.unindent_displace),
 int_option("di", opt.decl_indent),
 bool_options("dj", opt.ljust_decl),
-int_option("d", opt.unindent_displace),
 bool_options("eei", opt.extra_expression_indent),
 bool_options("ei", opt.else_if),
 bool_options("fbs", opt.function_brace_split),
 bool_options("fc1", opt.format_col1_comments),
 bool_options("fcb", opt.format_block_comments),
-bool_options("ip", opt.indent_parameters),
 int_option("i", opt.indent_size),
+bool_options("ip", opt.indent_parameters),
+int_option("l", opt.max_line_length),
 int_option("lc", opt.block_comment_max_line_length),
 int_option("ldi", opt.local_decl_indent),
-bool_options("lpl", opt.lineup_to_parens_always),
 bool_options("lp", opt.lineup_to_parens),
-int_option("l", opt.max_line_length),
+bool_options("lpl", opt.lineup_to_parens_always),
+/* "npro" is special */
+/* "P" is special */
 bool_options("pcs", opt.proc_calls_space),
 bool_options("psl", opt.procnames_start_line),
 bool_options("sc", opt.star_comment_cont),
 bool_options("sob", opt.swallow_optional_blanklines),
+/* "st" is special */
 bool_option("ta", true, opt.auto_typedefs),
+/* "T" is special */
 int_option("ts", opt.tabsize),
+/* "U" is special */
 bool_options("ut", opt.use_tabs),
 bool_options("v", opt.verbose),
 };
@@ -269,7 +274,7 @@ set_option(const char *arg)
 if (set_special_option(arg))
 	return;
 
-for (p = pro; p != pro + nitems(pro); p++)
+for (p = pro + nitems(pro); p-- != pro; )
 	if (p->p_name[0] == arg[0])
 	if ((param_start = skip_over(arg, p->p_name)) != NULL)
 		goto found;



CVS commit: src/usr.bin/indent

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 20:21:47 UTC 2021

Modified Files:
src/usr.bin/indent: args.c

Log Message:
indent: list options in the same order as in the manual page

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/usr.bin/indent/args.c

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



CVS commit: src/sys/arch/aarch64/include

2021-09-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep 26 20:15:04 UTC 2021

Modified Files:
src/sys/arch/aarch64/include: lock.h

Log Message:
Use the yield instruction as SPINLOCK_BACKOFF_HOOK for aarch64.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/aarch64/include/lock.h

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

Modified files:

Index: src/sys/arch/aarch64/include/lock.h
diff -u src/sys/arch/aarch64/include/lock.h:1.3 src/sys/arch/aarch64/include/lock.h:1.4
--- src/sys/arch/aarch64/include/lock.h:1.3	Fri Jun 26 18:27:52 2015
+++ src/sys/arch/aarch64/include/lock.h	Sun Sep 26 20:15:04 2021
@@ -1,6 +1,12 @@
-/* $NetBSD: lock.h,v 1.3 2015/06/26 18:27:52 matt Exp $ */
+/* $NetBSD: lock.h,v 1.4 2021/09/26 20:15:04 jmcneill Exp $ */
 
 #ifdef __aarch64__
+# ifdef _HARDKERNEL
+#  ifdef SPINLOCK_BACKOFF_HOOK
+#   undef SPINLOCK_BACKOFF_HOOK
+#  endif
+#  define SPINLOCK_BACKOFF_HOOK		asm volatile("yield" ::: "memory")
+# endif
 # include 
 #elif defined(__arm__)
 # include 



CVS commit: src/sys/arch/aarch64/include

2021-09-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep 26 20:15:04 UTC 2021

Modified Files:
src/sys/arch/aarch64/include: lock.h

Log Message:
Use the yield instruction as SPINLOCK_BACKOFF_HOOK for aarch64.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/aarch64/include/lock.h

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



CVS commit: src/sys/dev/pci

2021-09-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep 26 20:14:07 UTC 2021

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

Log Message:
Enable checksum offload features by default.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/pci/if_mcx.c

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

Modified files:

Index: src/sys/dev/pci/if_mcx.c
diff -u src/sys/dev/pci/if_mcx.c:1.21 src/sys/dev/pci/if_mcx.c:1.22
--- src/sys/dev/pci/if_mcx.c:1.21	Sun Sep 26 15:01:55 2021
+++ src/sys/dev/pci/if_mcx.c	Sun Sep 26 20:14:07 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mcx.c,v 1.21 2021/09/26 15:01:55 jmcneill Exp $ */
+/*	$NetBSD: if_mcx.c,v 1.22 2021/09/26 20:14:07 jmcneill Exp $ */
 /*	$OpenBSD: if_mcx.c,v 1.101 2021/06/02 19:16:11 patrick Exp $ */
 
 /*
@@ -23,7 +23,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mcx.c,v 1.21 2021/09/26 15:01:55 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mcx.c,v 1.22 2021/09/26 20:14:07 jmcneill Exp $");
 
 #include 
 #include 
@@ -2743,6 +2743,7 @@ mcx_attach(device_t parent, device_t sel
 	struct mcx_softc *sc = device_private(self);
 	struct ifnet *ifp = >sc_ec.ec_if;
 	struct pci_attach_args *pa = aux;
+	struct ifcapreq ifcr;
 	uint8_t enaddr[ETHER_ADDR_LEN];
 	int counts[PCI_INTR_TYPE_SIZE];
 	char intrxname[32];
@@ -2993,6 +2994,12 @@ mcx_attach(device_t parent, device_t sel
 	ifmedia_set(>sc_media, IFM_ETHER | IFM_AUTO);
 
 	if_attach(ifp);
+
+	/* Enable hardware offload by default */
+	memset(, 0, sizeof(ifcr));
+	ifcr.ifcr_capenable = ifp->if_capabilities;
+	ifioctl_common(ifp, SIOCSIFCAP, );
+
 	if_deferred_start_init(ifp, NULL);
 
 	ether_ifattach(ifp, enaddr);



CVS commit: src/sys/dev/pci

2021-09-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep 26 20:14:07 UTC 2021

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

Log Message:
Enable checksum offload features by default.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/pci/if_mcx.c

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



CVS commit: src/usr.bin/indent

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 20:12:38 UTC 2021

Modified Files:
src/usr.bin/indent: args.c

Log Message:
indent: reduce code for listing the options

After this change, the few options that do not follow the standard
scheme become more visible. They are '-bl', '-br' and '-ta'.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/indent/args.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/indent/args.c
diff -u src/usr.bin/indent/args.c:1.34 src/usr.bin/indent/args.c:1.35
--- src/usr.bin/indent/args.c:1.34	Sun Sep 26 19:57:23 2021
+++ src/usr.bin/indent/args.c	Sun Sep 26 20:12:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: args.c,v 1.34 2021/09/26 19:57:23 rillig Exp $	*/
+/*	$NetBSD: args.c,v 1.35 2021/09/26 20:12:37 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)args.c	8.1 (
 
 #include 
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: args.c,v 1.34 2021/09/26 19:57:23 rillig Exp $");
+__RCSID("$NetBSD: args.c,v 1.35 2021/09/26 20:12:37 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $");
 #endif
@@ -78,6 +78,9 @@ static const char *option_source = "?";
 	{name, true, value, assert_type(&(var), bool *)}
 #define int_option(name, var) \
 	{name, false, false, assert_type(&(var), int *)}
+#define bool_options(name, var) \
+	bool_option(name, true, var), \
+	bool_option("n" name, false, var)
 
 /*
  * N.B.: because of the way the table here is scanned, options whose names are
@@ -92,69 +95,44 @@ static const struct pro {
 bool p_bool_value;
 void *p_obj;		/* the associated variable (bool, int) */
 }   pro[] = {
-bool_option("bacc", true, opt.blanklines_around_conditional_compilation),
-bool_option("badp", true, opt.blanklines_after_declarations_at_proctop),
-bool_option("bad", true, opt.blanklines_after_declarations),
-bool_option("bap", true, opt.blanklines_after_procs),
-bool_option("bbb", true, opt.blanklines_before_blockcomments),
-bool_option("bc", true, opt.break_after_comma),
+bool_options("bacc", opt.blanklines_around_conditional_compilation),
+bool_options("badp", opt.blanklines_after_declarations_at_proctop),
+bool_options("bad", opt.blanklines_after_declarations),
+bool_options("bap", opt.blanklines_after_procs),
+bool_options("bbb", opt.blanklines_before_blockcomments),
+bool_options("bc", opt.break_after_comma),
 bool_option("bl", false, opt.btype_2),
 bool_option("br", true, opt.btype_2),
-bool_option("bs", true, opt.blank_after_sizeof),
-bool_option("cdb", true, opt.comment_delimiter_on_blankline),
+bool_options("bs", opt.blank_after_sizeof),
+bool_options("cdb", opt.comment_delimiter_on_blankline),
 int_option("cd", opt.decl_comment_column),
-bool_option("ce", true, opt.cuddle_else),
+bool_options("ce", opt.cuddle_else),
 int_option("ci", opt.continuation_indent),
-bool_option("cs", true, opt.space_after_cast),
+bool_options("cs", opt.space_after_cast),
 int_option("c", opt.comment_column),
 int_option("di", opt.decl_indent),
-bool_option("dj", true, opt.ljust_decl),
+bool_options("dj", opt.ljust_decl),
 int_option("d", opt.unindent_displace),
-bool_option("eei", true, opt.extra_expression_indent),
-bool_option("ei", true, opt.else_if),
-bool_option("fbs", true, opt.function_brace_split),
-bool_option("fc1", true, opt.format_col1_comments),
-bool_option("fcb", true, opt.format_block_comments),
-bool_option("ip", true, opt.indent_parameters),
+bool_options("eei", opt.extra_expression_indent),
+bool_options("ei", opt.else_if),
+bool_options("fbs", opt.function_brace_split),
+bool_options("fc1", opt.format_col1_comments),
+bool_options("fcb", opt.format_block_comments),
+bool_options("ip", opt.indent_parameters),
 int_option("i", opt.indent_size),
 int_option("lc", opt.block_comment_max_line_length),
 int_option("ldi", opt.local_decl_indent),
-bool_option("lpl", true, opt.lineup_to_parens_always),
-bool_option("lp", true, opt.lineup_to_parens),
+bool_options("lpl", opt.lineup_to_parens_always),
+bool_options("lp", opt.lineup_to_parens),
 int_option("l", opt.max_line_length),
-bool_option("nbacc", false, opt.blanklines_around_conditional_compilation),
-bool_option("nbadp", false, opt.blanklines_after_declarations_at_proctop),
-bool_option("nbad", false, opt.blanklines_after_declarations),
-bool_option("nbap", false, opt.blanklines_after_procs),
-bool_option("nbbb", false, opt.blanklines_before_blockcomments),
-bool_option("nbc", false, opt.break_after_comma),
-bool_option("nbs", false, opt.blank_after_sizeof),
-bool_option("ncdb", false, 

CVS commit: src/usr.bin/indent

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 20:12:38 UTC 2021

Modified Files:
src/usr.bin/indent: args.c

Log Message:
indent: reduce code for listing the options

After this change, the few options that do not follow the standard
scheme become more visible. They are '-bl', '-br' and '-ta'.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/indent/args.c

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



CVS commit: src/usr.bin/indent

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 19:57:23 UTC 2021

Modified Files:
src/usr.bin/indent: args.c indent.c indent_globs.h

Log Message:
indent: negate and rename option.leave_comma

The old name did not mirror the description in the manual page, and it
was the only option that is negated. Inverting it allows the options
table to be compressed.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/indent/args.c
cvs rdiff -u -r1.86 -r1.87 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.37 -r1.38 src/usr.bin/indent/indent_globs.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/indent/args.c
diff -u src/usr.bin/indent/args.c:1.33 src/usr.bin/indent/args.c:1.34
--- src/usr.bin/indent/args.c:1.33	Sun Sep 26 19:37:11 2021
+++ src/usr.bin/indent/args.c	Sun Sep 26 19:57:23 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: args.c,v 1.33 2021/09/26 19:37:11 rillig Exp $	*/
+/*	$NetBSD: args.c,v 1.34 2021/09/26 19:57:23 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)args.c	8.1 (
 
 #include 
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: args.c,v 1.33 2021/09/26 19:37:11 rillig Exp $");
+__RCSID("$NetBSD: args.c,v 1.34 2021/09/26 19:57:23 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $");
 #endif
@@ -97,7 +97,7 @@ static const struct pro {
 bool_option("bad", true, opt.blanklines_after_declarations),
 bool_option("bap", true, opt.blanklines_after_procs),
 bool_option("bbb", true, opt.blanklines_before_blockcomments),
-bool_option("bc", false, opt.leave_comma),
+bool_option("bc", true, opt.break_after_comma),
 bool_option("bl", false, opt.btype_2),
 bool_option("br", true, opt.btype_2),
 bool_option("bs", true, opt.blank_after_sizeof),
@@ -127,7 +127,7 @@ static const struct pro {
 bool_option("nbad", false, opt.blanklines_after_declarations),
 bool_option("nbap", false, opt.blanklines_after_procs),
 bool_option("nbbb", false, opt.blanklines_before_blockcomments),
-bool_option("nbc", true, opt.leave_comma),
+bool_option("nbc", false, opt.break_after_comma),
 bool_option("nbs", false, opt.blank_after_sizeof),
 bool_option("ncdb", false, opt.comment_delimiter_on_blankline),
 bool_option("nce", false, opt.cuddle_else),

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.86 src/usr.bin/indent/indent.c:1.87
--- src/usr.bin/indent/indent.c:1.86	Sun Sep 26 19:37:11 2021
+++ src/usr.bin/indent/indent.c	Sun Sep 26 19:57:23 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.86 2021/09/26 19:37:11 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.87 2021/09/26 19:57:23 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c	5.1
 
 #include 
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: indent.c,v 1.86 2021/09/26 19:37:11 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.87 2021/09/26 19:57:23 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -65,7 +65,6 @@ __FBSDID("$FreeBSD: head/usr.bin/indent/
 #include "indent.h"
 
 struct options opt = {
-.leave_comma = true,
 .btype_2 = true,
 .comment_delimiter_on_blankline = true,
 .cuddle_else = true,
@@ -556,8 +555,8 @@ process_form_feed(void)
 static void
 process_newline(void)
 {
-if (ps.last_token != comma || ps.p_l_follow > 0
-	|| !opt.leave_comma || ps.block_init || !break_comma || com.s != com.e) {
+if (ps.last_token != comma || ps.p_l_follow > 0 || opt.break_after_comma
+	|| ps.block_init || !break_comma || com.s != com.e) {
 	dump_line();
 	ps.want_blank = false;
 }
@@ -1047,7 +1046,7 @@ process_comma(int dec_ind, bool tabs_to_
 if (ps.p_l_follow == 0) {
 	if (ps.block_init_level <= 0)
 	ps.block_init = false;
-	if (break_comma && (!opt.leave_comma ||
+	if (break_comma && (opt.break_after_comma ||
 			indentation_after_range(
 compute_code_indent(), code.s, code.e)
 			>= opt.max_line_length - opt.tabsize))

Index: src/usr.bin/indent/indent_globs.h
diff -u src/usr.bin/indent/indent_globs.h:1.37 src/usr.bin/indent/indent_globs.h:1.38
--- src/usr.bin/indent/indent_globs.h:1.37	Sat Sep 25 22:57:04 2021
+++ src/usr.bin/indent/indent_globs.h	Sun Sep 26 19:57:23 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent_globs.h,v 1.37 2021/09/25 22:57:04 rillig Exp $	*/
+/*	$NetBSD: indent_globs.h,v 1.38 2021/09/26 19:57:23 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -89,7 +89,7 @@ extern struct options {
 bool	blanklines_after_declarations;
 bool	blanklines_after_procs;
 bool	blanklines_before_blockcomments;
-bool	leave_comma;	/* if true, never break declarations after
+bool	break_after_comma; /* 

CVS commit: src/usr.bin/indent

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 19:57:23 UTC 2021

Modified Files:
src/usr.bin/indent: args.c indent.c indent_globs.h

Log Message:
indent: negate and rename option.leave_comma

The old name did not mirror the description in the manual page, and it
was the only option that is negated. Inverting it allows the options
table to be compressed.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/indent/args.c
cvs rdiff -u -r1.86 -r1.87 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.37 -r1.38 src/usr.bin/indent/indent_globs.h

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



CVS commit: src/usr.bin/indent

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 19:37:11 UTC 2021

Modified Files:
src/usr.bin/indent: args.c indent.c io.c lexi.c parse.c pr_comment.c

Log Message:
indent: let indent format its own code -- in supervised mode

After running indent on the code, I manually selected each change that
now looks better than before. The remaining changes are left for later.
All in all, indent did a pretty good job, except for syntactic additions
from after 1990, but that was to be expected. Examples for such
additions are GCC's __attribute__ and C99 designated initializers.

Indent has only few knobs to tune the indentation. The knob for the
continuation indentation applies to function declarations as well as to
expressions. The knob for indentation of local variable declarations
applies to struct members as well, even if these are members of a
top-level struct.

Several code comments crossed the right margin in column 78. Several
other code comments were correctly broken though. The cause for this
difference was not obvious.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/indent/args.c
cvs rdiff -u -r1.85 -r1.86 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.66 -r1.67 src/usr.bin/indent/io.c
cvs rdiff -u -r1.58 -r1.59 src/usr.bin/indent/lexi.c
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/indent/parse.c
cvs rdiff -u -r1.46 -r1.47 src/usr.bin/indent/pr_comment.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/indent/args.c
diff -u src/usr.bin/indent/args.c:1.32 src/usr.bin/indent/args.c:1.33
--- src/usr.bin/indent/args.c:1.32	Sun Sep 26 00:57:28 2021
+++ src/usr.bin/indent/args.c	Sun Sep 26 19:37:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: args.c,v 1.32 2021/09/26 00:57:28 rillig Exp $	*/
+/*	$NetBSD: args.c,v 1.33 2021/09/26 19:37:11 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)args.c	8.1 (
 
 #include 
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: args.c,v 1.32 2021/09/26 00:57:28 rillig Exp $");
+__RCSID("$NetBSD: args.c,v 1.33 2021/09/26 19:37:11 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $");
 #endif
@@ -87,11 +87,11 @@ static const char *option_source = "?";
  * See also set_special_option.
  */
 static const struct pro {
-const char  p_name[6];	/* name, e.g. "bl", "cli" */
-bool	p_is_bool;
-bool	p_bool_value;
-void*p_obj;		/* the associated variable (bool, int) */
-}   pro[] = {
+const char p_name[6];	/* name, e.g. "bl", "cli" */
+bool p_is_bool;
+bool p_bool_value;
+void *p_obj;		/* the associated variable (bool, int) */
+}   pro[] = {
 bool_option("bacc", true, opt.blanklines_around_conditional_compilation),
 bool_option("badp", true, opt.blanklines_after_declarations_at_proctop),
 bool_option("bad", true, opt.blanklines_after_declarations),
@@ -174,11 +174,11 @@ set_profile(const char *profile_name)
 	snprintf(fname, sizeof(fname), "%s", profile_name + 2);
 if ((f = fopen(option_source = fname, "r")) != NULL) {
 	scan_profile(f);
-	(void) fclose(f);
+	(void)fclose(f);
 }
 if ((f = fopen(option_source = prof, "r")) != NULL) {
 	scan_profile(f);
-	(void) fclose(f);
+	(void)fclose(f);
 }
 option_source = "Command line";
 }
@@ -186,9 +186,9 @@ set_profile(const char *profile_name)
 static void
 scan_profile(FILE *f)
 {
-int		comment_index, i;
-char	*p;
-charbuf[BUFSIZ];
+int comment_index, i;
+char *p;
+char buf[BUFSIZ];
 
 for (;;) {
 	p = buf;
@@ -235,7 +235,7 @@ set_special_option(const char *arg)
 if (strncmp(arg, "-version", 8) == 0) {
 	printf("FreeBSD indent %s\n", INDENT_VERSION);
 	exit(0);
-	/*NOTREACHED*/
+	/* NOTREACHED */
 }
 
 if (arg[0] == 'P' || strncmp(arg, "npro", 4) == 0)
@@ -285,7 +285,7 @@ void
 set_option(const char *arg)
 {
 const struct pro *p;
-const char	*param_start;
+const char *param_start;
 
 arg++;			/* ignore leading "-" */
 if (set_special_option(arg))

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.85 src/usr.bin/indent/indent.c:1.86
--- src/usr.bin/indent/indent.c:1.85	Sun Sep 26 18:52:16 2021
+++ src/usr.bin/indent/indent.c	Sun Sep 26 19:37:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.85 2021/09/26 18:52:16 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.86 2021/09/26 19:37:11 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c	5.1
 
 #include 
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: indent.c,v 1.85 2021/09/26 18:52:16 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.86 2021/09/26 19:37:11 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 

CVS commit: src/usr.bin/indent

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 19:37:11 UTC 2021

Modified Files:
src/usr.bin/indent: args.c indent.c io.c lexi.c parse.c pr_comment.c

Log Message:
indent: let indent format its own code -- in supervised mode

After running indent on the code, I manually selected each change that
now looks better than before. The remaining changes are left for later.
All in all, indent did a pretty good job, except for syntactic additions
from after 1990, but that was to be expected. Examples for such
additions are GCC's __attribute__ and C99 designated initializers.

Indent has only few knobs to tune the indentation. The knob for the
continuation indentation applies to function declarations as well as to
expressions. The knob for indentation of local variable declarations
applies to struct members as well, even if these are members of a
top-level struct.

Several code comments crossed the right margin in column 78. Several
other code comments were correctly broken though. The cause for this
difference was not obvious.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/indent/args.c
cvs rdiff -u -r1.85 -r1.86 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.66 -r1.67 src/usr.bin/indent/io.c
cvs rdiff -u -r1.58 -r1.59 src/usr.bin/indent/lexi.c
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/indent/parse.c
cvs rdiff -u -r1.46 -r1.47 src/usr.bin/indent/pr_comment.c

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



CVS commit: src/usr.bin/indent

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 19:02:35 UTC 2021

Added Files:
src/usr.bin/indent: .indent.pro

Log Message:
indent: add .indent.pro that almost matches the source code

One might expect that the code of indent is properly indented according
to its own capabilities, but that's not the case, there are many
deviations.

This indentation profile comes close to the existing code. Maybe someday
indent's own source code can be formatted using this profile, but before
attempting that, its remaining bugs have to be fixed.

Development of indent has essentially stopped somewhere around 1990, as
demonstrated by the wrong formatting of '...' that has only been fixed a
few minutes ago. The '...' is an invention of C90. Indent's parser still
considers '...' as consisting of the 3 tokens period-period-period, but
that's OK since the effect is the same.

Another feature that had been missing for a long time were C99 comments
that span from '//' to the next newline. Before March 2021, these were
parsed as a binary operator, which produced lots of funny side effects.

Since indent's code makes use of several C99 features, as soon as it can
properly indent its own code, the worst of these bugs will have been
fixed.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/usr.bin/indent/.indent.pro

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

Added files:

Index: src/usr.bin/indent/.indent.pro
diff -u /dev/null src/usr.bin/indent/.indent.pro:1.1
--- /dev/null	Sun Sep 26 19:02:35 2021
+++ src/usr.bin/indent/.indent.pro	Sun Sep 26 19:02:35 2021
@@ -0,0 +1,10 @@
+/* $NetBSD: .indent.pro,v 1.1 2021/09/26 19:02:35 rillig Exp $ */
+
+-di0		/* Do not indent variable names in global declarations. */
+-nfc1		/* Do not format CVS Id comments. */
+-i4		/* Indent by 4 spaces, for traditional reasons. */
+-ldi0		/* Do not indent variable names in local declarations. */
+-nlp		/* Do not indent function arguments. */
+-ta		/* Identifiers ending in '_t' are considered type names. */
+-TFILE		/* Additional types, for proper formatting of '*'. */
+-Ttoken_type



CVS commit: src/usr.bin/indent

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 19:02:35 UTC 2021

Added Files:
src/usr.bin/indent: .indent.pro

Log Message:
indent: add .indent.pro that almost matches the source code

One might expect that the code of indent is properly indented according
to its own capabilities, but that's not the case, there are many
deviations.

This indentation profile comes close to the existing code. Maybe someday
indent's own source code can be formatted using this profile, but before
attempting that, its remaining bugs have to be fixed.

Development of indent has essentially stopped somewhere around 1990, as
demonstrated by the wrong formatting of '...' that has only been fixed a
few minutes ago. The '...' is an invention of C90. Indent's parser still
considers '...' as consisting of the 3 tokens period-period-period, but
that's OK since the effect is the same.

Another feature that had been missing for a long time were C99 comments
that span from '//' to the next newline. Before March 2021, these were
parsed as a binary operator, which produced lots of funny side effects.

Since indent's code makes use of several C99 features, as soon as it can
properly indent its own code, the worst of these bugs will have been
fixed.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/usr.bin/indent/.indent.pro

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



CVS commit: src

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 18:52:16 UTC 2021

Modified Files:
src/tests/usr.bin/indent: declarations.0.stdout
src/usr.bin/indent: indent.c

Log Message:
indent: fix missing space between comma and ellipsis

According to lint's C grammar, in standard C an ellipsis only occurs
after a comma. There are GCC extensions that allow an ellipsis as the
only function parameter, as well as in 'case a ... b', but these are
rare.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/indent/declarations.0.stdout
cvs rdiff -u -r1.84 -r1.85 src/usr.bin/indent/indent.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/indent/declarations.0.stdout
diff -u src/tests/usr.bin/indent/declarations.0.stdout:1.3 src/tests/usr.bin/indent/declarations.0.stdout:1.4
--- src/tests/usr.bin/indent/declarations.0.stdout:1.3	Sun Sep 26 18:42:46 2021
+++ src/tests/usr.bin/indent/declarations.0.stdout	Sun Sep 26 18:52:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: declarations.0.stdout,v 1.3 2021/09/26 18:42:46 rillig Exp $	*/
+/*	$NetBSD: declarations.0.stdout,v 1.4 2021/09/26 18:52:16 rillig Exp $	*/
 /* $FreeBSD: head/usr.bin/indent/tests/declarations.0.stdout 334480 2018-06-01 09:58:44Z pstef $ */
 /* See r303570 */
 
@@ -55,7 +55,7 @@ int_create(void)
 static
 _attribute_printf(1, 2)
 void
-print_error(const char *fmt,...)
+print_error(const char *fmt, ...)
 {
 
 }
@@ -124,7 +124,6 @@ struct s01 {
 };
 
 int
-/* $ FIXME: There must be a space before the ellipsis. */
-my_printf(const char *fmt,...)
+my_printf(const char *fmt, ...)
 {
 }

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.84 src/usr.bin/indent/indent.c:1.85
--- src/usr.bin/indent/indent.c:1.84	Sat Sep 25 22:57:04 2021
+++ src/usr.bin/indent/indent.c	Sun Sep 26 18:52:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.84 2021/09/25 22:57:04 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.85 2021/09/26 18:52:16 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c	5.1
 
 #include 
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: indent.c,v 1.84 2021/09/25 22:57:04 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.85 2021/09/26 18:52:16 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -1028,6 +1028,8 @@ process_string_prefix(void)
 static void
 process_period(void)
 {
+if (code.e[-1] == ',')
+	*code.e++ = ' ';
 *code.e++ = '.';		/* move the period into line */
 ps.want_blank = false;	/* dont put a blank after a period */
 }



CVS commit: src

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 18:52:16 UTC 2021

Modified Files:
src/tests/usr.bin/indent: declarations.0.stdout
src/usr.bin/indent: indent.c

Log Message:
indent: fix missing space between comma and ellipsis

According to lint's C grammar, in standard C an ellipsis only occurs
after a comma. There are GCC extensions that allow an ellipsis as the
only function parameter, as well as in 'case a ... b', but these are
rare.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/indent/declarations.0.stdout
cvs rdiff -u -r1.84 -r1.85 src/usr.bin/indent/indent.c

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



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

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 18:42:46 UTC 2021

Modified Files:
src/tests/usr.bin/indent: declarations.0 declarations.0.stdout

Log Message:
tests/indent: demonstrate missing space before ellipsis


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/indent/declarations.0
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/indent/declarations.0.stdout

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/indent/declarations.0
diff -u src/tests/usr.bin/indent/declarations.0:1.3 src/tests/usr.bin/indent/declarations.0:1.4
--- src/tests/usr.bin/indent/declarations.0:1.3	Sat Sep 25 13:04:55 2021
+++ src/tests/usr.bin/indent/declarations.0	Sun Sep 26 18:42:46 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: declarations.0,v 1.3 2021/09/25 13:04:55 rillig Exp $	*/
+/*	$NetBSD: declarations.0,v 1.4 2021/09/26 18:42:46 rillig Exp $	*/
 /* $FreeBSD: head/usr.bin/indent/tests/declarations.0 334478 2018-06-01 09:41:15Z pstef $ */
 /* See r303570 */
 
@@ -128,3 +128,8 @@ struct s24 {
 };
 };
 };
+
+int
+my_printf(const char *fmt, ...)
+{
+}

Index: src/tests/usr.bin/indent/declarations.0.stdout
diff -u src/tests/usr.bin/indent/declarations.0.stdout:1.2 src/tests/usr.bin/indent/declarations.0.stdout:1.3
--- src/tests/usr.bin/indent/declarations.0.stdout:1.2	Sat Sep 25 13:04:55 2021
+++ src/tests/usr.bin/indent/declarations.0.stdout	Sun Sep 26 18:42:46 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: declarations.0.stdout,v 1.2 2021/09/25 13:04:55 rillig Exp $	*/
+/*	$NetBSD: declarations.0.stdout,v 1.3 2021/09/26 18:42:46 rillig Exp $	*/
 /* $FreeBSD: head/usr.bin/indent/tests/declarations.0.stdout 334480 2018-06-01 09:58:44Z pstef $ */
 /* See r303570 */
 
@@ -122,3 +122,9 @@ struct s01 {
 		};
 	};
 };
+
+int
+/* $ FIXME: There must be a space before the ellipsis. */
+my_printf(const char *fmt,...)
+{
+}



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

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 18:42:46 UTC 2021

Modified Files:
src/tests/usr.bin/indent: declarations.0 declarations.0.stdout

Log Message:
tests/indent: demonstrate missing space before ellipsis


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/indent/declarations.0
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/indent/declarations.0.stdout

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



CVS commit: src/sys/kern

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 18:13:58 UTC 2021

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

Log Message:
Mark kqread_filtops, user_filtops, and seltrue_filtops as MPSAFE.


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/sys/kern/kern_event.c

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

Modified files:

Index: src/sys/kern/kern_event.c
diff -u src/sys/kern/kern_event.c:1.122 src/sys/kern/kern_event.c:1.123
--- src/sys/kern/kern_event.c:1.122	Sun Sep 26 03:12:50 2021
+++ src/sys/kern/kern_event.c	Sun Sep 26 18:13:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_event.c,v 1.122 2021/09/26 03:12:50 thorpej Exp $	*/
+/*	$NetBSD: kern_event.c,v 1.123 2021/09/26 18:13:58 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.122 2021/09/26 03:12:50 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.123 2021/09/26 18:13:58 thorpej Exp $");
 
 #include 
 #include 
@@ -130,7 +130,7 @@ static const struct fileops kqueueops = 
 };
 
 static const struct filterops kqread_filtops = {
-	.f_flags = FILTEROP_ISFD,
+	.f_flags = FILTEROP_ISFD | FILTEROP_MPSAFE,
 	.f_attach = NULL,
 	.f_detach = filt_kqdetach,
 	.f_event = filt_kqueue,
@@ -171,7 +171,7 @@ static const struct filterops fs_filtops
 };
 
 static const struct filterops user_filtops = {
-	.f_flags = 0,
+	.f_flags = FILTEROP_MPSAFE,
 	.f_attach = filt_userattach,
 	.f_detach = filt_userdetach,
 	.f_event = filt_user,
@@ -990,7 +990,7 @@ filt_seltruedetach(struct knote *kn)
 }
 
 const struct filterops seltrue_filtops = {
-	.f_flags = FILTEROP_ISFD,
+	.f_flags = FILTEROP_ISFD | FILTEROP_MPSAFE,
 	.f_attach = NULL,
 	.f_detach = filt_seltruedetach,
 	.f_event = filt_seltrue,



CVS commit: src/sys/kern

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 18:13:58 UTC 2021

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

Log Message:
Mark kqread_filtops, user_filtops, and seltrue_filtops as MPSAFE.


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/sys/kern/kern_event.c

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



CVS commit: src/sys/kern

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 17:34:19 UTC 2021

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

Log Message:
sig_filtops is MPSAFE.


To generate a diff of this commit:
cvs rdiff -u -r1.398 -r1.399 src/sys/kern/kern_sig.c

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

Modified files:

Index: src/sys/kern/kern_sig.c
diff -u src/sys/kern/kern_sig.c:1.398 src/sys/kern/kern_sig.c:1.399
--- src/sys/kern/kern_sig.c:1.398	Sun Sep 26 01:16:10 2021
+++ src/sys/kern/kern_sig.c	Sun Sep 26 17:34:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_sig.c,v 1.398 2021/09/26 01:16:10 thorpej Exp $	*/
+/*	$NetBSD: kern_sig.c,v 1.399 2021/09/26 17:34:19 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008, 2019 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.398 2021/09/26 01:16:10 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.399 2021/09/26 17:34:19 thorpej Exp $");
 
 #include "opt_execfmt.h"
 #include "opt_ptrace.h"
@@ -2693,7 +2693,7 @@ filt_signal(struct knote *kn, long hint)
 }
 
 const struct filterops sig_filtops = {
-	.f_flags = 0,
+	.f_flags = FILTEROP_MPSAFE,
 	.f_attach = filt_sigattach,
 	.f_detach = filt_sigdetach,
 	.f_event = filt_signal,



CVS commit: src/sys/kern

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 17:34:19 UTC 2021

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

Log Message:
sig_filtops is MPSAFE.


To generate a diff of this commit:
cvs rdiff -u -r1.398 -r1.399 src/sys/kern/kern_sig.c

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



CVS commit: src/sys/arch

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 16:36:19 UTC 2021

Modified Files:
src/sys/arch/amiga/dev: event.c
src/sys/arch/arc/dev: opms.c
src/sys/arch/arm/xscale: pxa2x0_apm.c
src/sys/arch/atari/dev: event.c
src/sys/arch/landisk/dev: button.c
src/sys/arch/mac68k/dev: aed.c
src/sys/arch/macppc/dev: aed.c apm.c
src/sys/arch/sparc/dev: tctrl.c
src/sys/arch/x68k/dev: event.c

Log Message:
Driver "kqfilter" entry points return an error code, so if an invalid
filter is requested, return EINVAL rather than 1.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/amiga/dev/event.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arc/dev/opms.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/xscale/pxa2x0_apm.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/atari/dev/event.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/landisk/dev/button.c
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/mac68k/dev/aed.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/macppc/dev/aed.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/macppc/dev/apm.c
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/sparc/dev/tctrl.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/x68k/dev/event.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/amiga/dev/event.c
diff -u src/sys/arch/amiga/dev/event.c:1.16 src/sys/arch/amiga/dev/event.c:1.17
--- src/sys/arch/amiga/dev/event.c:1.16	Sun Sep 26 01:16:07 2021
+++ src/sys/arch/amiga/dev/event.c	Sun Sep 26 16:36:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: event.c,v 1.16 2021/09/26 01:16:07 thorpej Exp $ */
+/*	$NetBSD: event.c,v 1.17 2021/09/26 16:36:18 thorpej Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: event.c,v 1.16 2021/09/26 01:16:07 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: event.c,v 1.17 2021/09/26 16:36:18 thorpej Exp $");
 
 /*
  * Internal `Firm_event' interface for the keyboard and mouse drivers.
@@ -208,7 +208,7 @@ ev_kqfilter(struct evvar *ev, struct kno
 		break;
 
 	default:
-		return (1);
+		return (EINVAL);
 	}
 
 	kn->kn_hook = ev;

Index: src/sys/arch/arc/dev/opms.c
diff -u src/sys/arch/arc/dev/opms.c:1.25 src/sys/arch/arc/dev/opms.c:1.26
--- src/sys/arch/arc/dev/opms.c:1.25	Sun Sep 26 01:16:07 2021
+++ src/sys/arch/arc/dev/opms.c	Sun Sep 26 16:36:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: opms.c,v 1.25 2021/09/26 01:16:07 thorpej Exp $	*/
+/*	$NetBSD: opms.c,v 1.26 2021/09/26 16:36:18 thorpej Exp $	*/
 /*	$OpenBSD: pccons.c,v 1.22 1999/01/30 22:39:37 imp Exp $	*/
 /*	NetBSD: pms.c,v 1.21 1995/04/18 02:25:18 mycroft Exp	*/
 
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: opms.c,v 1.25 2021/09/26 01:16:07 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: opms.c,v 1.26 2021/09/26 16:36:18 thorpej Exp $");
 
 #include 
 #include 
@@ -491,7 +491,7 @@ opmskqfilter(dev_t dev, struct knote *kn
 		break;
 
 	default:
-		return 1;
+		return EINVAL;
 	}
 
 	kn->kn_hook = sc;

Index: src/sys/arch/arm/xscale/pxa2x0_apm.c
diff -u src/sys/arch/arm/xscale/pxa2x0_apm.c:1.6 src/sys/arch/arm/xscale/pxa2x0_apm.c:1.7
--- src/sys/arch/arm/xscale/pxa2x0_apm.c:1.6	Sun Sep 26 01:16:07 2021
+++ src/sys/arch/arm/xscale/pxa2x0_apm.c	Sun Sep 26 16:36:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pxa2x0_apm.c,v 1.6 2021/09/26 01:16:07 thorpej Exp $	*/
+/*	$NetBSD: pxa2x0_apm.c,v 1.7 2021/09/26 16:36:18 thorpej Exp $	*/
 /*	$OpenBSD: pxa2x0_apm.c,v 1.28 2007/03/29 18:42:38 uwe Exp $	*/
 
 /*-
@@ -629,7 +629,7 @@ apmkqfilter(dev_t dev, struct knote *kn)
 		kn->kn_fop = _filtops;
 		break;
 	default:
-		return (1);
+		return (EINVAL);
 	}
 
 	kn->kn_hook = (caddr_t)sc;

Index: src/sys/arch/atari/dev/event.c
diff -u src/sys/arch/atari/dev/event.c:1.16 src/sys/arch/atari/dev/event.c:1.17
--- src/sys/arch/atari/dev/event.c:1.16	Sun Sep 26 01:16:07 2021
+++ src/sys/arch/atari/dev/event.c	Sun Sep 26 16:36:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: event.c,v 1.16 2021/09/26 01:16:07 thorpej Exp $	*/
+/*	$NetBSD: event.c,v 1.17 2021/09/26 16:36:18 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: event.c,v 1.16 2021/09/26 01:16:07 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: event.c,v 1.17 2021/09/26 16:36:18 thorpej Exp $");
 
 #include 
 #include 
@@ -208,7 +208,7 @@ ev_kqfilter(struct evvar *ev, struct kno
 		break;
 
 	default:
-		return (1);
+		return (EINVAL);
 	}
 
 	kn->kn_hook = ev;

Index: src/sys/arch/landisk/dev/button.c
diff -u src/sys/arch/landisk/dev/button.c:1.13 src/sys/arch/landisk/dev/button.c:1.14
--- src/sys/arch/landisk/dev/button.c:1.13	Sun Sep 26 14:32:02 2021
+++ src/sys/arch/landisk/dev/button.c	Sun Sep 26 16:36:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: button.c,v 1.13 2021/09/26 14:32:02 thorpej Exp $	*/
+/*	$NetBSD: button.c,v 1.14 2021/09/26 16:36:18 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 

CVS commit: src/sys/arch

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 16:36:19 UTC 2021

Modified Files:
src/sys/arch/amiga/dev: event.c
src/sys/arch/arc/dev: opms.c
src/sys/arch/arm/xscale: pxa2x0_apm.c
src/sys/arch/atari/dev: event.c
src/sys/arch/landisk/dev: button.c
src/sys/arch/mac68k/dev: aed.c
src/sys/arch/macppc/dev: aed.c apm.c
src/sys/arch/sparc/dev: tctrl.c
src/sys/arch/x68k/dev: event.c

Log Message:
Driver "kqfilter" entry points return an error code, so if an invalid
filter is requested, return EINVAL rather than 1.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/amiga/dev/event.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arc/dev/opms.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/xscale/pxa2x0_apm.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/atari/dev/event.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/landisk/dev/button.c
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/mac68k/dev/aed.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/macppc/dev/aed.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/macppc/dev/apm.c
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/sparc/dev/tctrl.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/x68k/dev/event.c

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



CVS commit: src/sys/dev/sysmon

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 16:24:21 UTC 2021

Modified Files:
src/sys/dev/sysmon: sysmon_power.c

Log Message:
- Call selnotify() with sysmon_power_event_queue_mtx held, passing the
  correct hints.  Adjust filt_sysmon_power_read() accordingly (assert
  that the mutex is held iff NOTE_SUBMIT).
- Mark sysmon_power_read_filtops as MPSAFE.
- Use seltrue_filtops rather than rolling our own with filt_seltrue.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/dev/sysmon/sysmon_power.c

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

Modified files:

Index: src/sys/dev/sysmon/sysmon_power.c
diff -u src/sys/dev/sysmon/sysmon_power.c:1.67 src/sys/dev/sysmon/sysmon_power.c:1.68
--- src/sys/dev/sysmon/sysmon_power.c:1.67	Sun Sep 26 01:16:09 2021
+++ src/sys/dev/sysmon/sysmon_power.c	Sun Sep 26 16:24:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysmon_power.c,v 1.67 2021/09/26 01:16:09 thorpej Exp $	*/
+/*	$NetBSD: sysmon_power.c,v 1.68 2021/09/26 16:24:21 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2007 Juan Romero Pardines.
@@ -69,7 +69,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysmon_power.c,v 1.67 2021/09/26 01:16:09 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_power.c,v 1.68 2021/09/26 16:24:21 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -419,8 +419,9 @@ sysmon_power_daemon_task(struct power_ev
 		ped->flags |= SYSMON_POWER_DICTIONARY_READY;
 		SIMPLEQ_INSERT_TAIL(_dict_list, ped, pev_dict_head);
 		cv_broadcast(_power_event_queue_cv);
+		selnotify(_power_event_queue_selinfo,
+		POLLIN | POLLRDNORM, NOTE_SUBMIT);
 		mutex_exit(_power_event_queue_mtx);
-		selnotify(_power_event_queue_selinfo, 0, 0);
 	}
 
 out:
@@ -546,27 +547,28 @@ static int
 filt_sysmon_power_read(struct knote *kn, long hint)
 {
 
-	mutex_enter(_power_event_queue_mtx);
+	if (hint & NOTE_SUBMIT) {
+		KASSERT(mutex_owned(_power_event_queue_mtx));
+	} else {
+		mutex_enter(_power_event_queue_mtx);
+	}
+
 	kn->kn_data = sysmon_power_event_queue_count;
-	mutex_exit(_power_event_queue_mtx);
+
+	if ((hint & NOTE_SUBMIT) == 0) {
+		mutex_exit(_power_event_queue_mtx);
+	}
 
 	return kn->kn_data > 0;
 }
 
 static const struct filterops sysmon_power_read_filtops = {
-	.f_flags = FILTEROP_ISFD,
+	.f_flags = FILTEROP_ISFD | FILTEROP_MPSAFE,
 	.f_attach = NULL,
 	.f_detach = filt_sysmon_power_rdetach,
 	.f_event = filt_sysmon_power_read,
 };
 
-static const struct filterops sysmon_power_write_filtops = {
-	.f_flags = FILTEROP_ISFD,
-	.f_attach = NULL,
-	.f_detach = filt_sysmon_power_rdetach,
-	.f_event = filt_seltrue,
-};
-
 /*
  * sysmonkqfilter_power:
  *
@@ -579,20 +581,19 @@ sysmonkqfilter_power(dev_t dev, struct k
 	switch (kn->kn_filter) {
 	case EVFILT_READ:
 		kn->kn_fop = _power_read_filtops;
+		mutex_enter(_power_event_queue_mtx);
+		selrecord_knote(_power_event_queue_selinfo, kn);
+		mutex_exit(_power_event_queue_mtx);
 		break;
 
 	case EVFILT_WRITE:
-		kn->kn_fop = _power_write_filtops;
+		kn->kn_fop = _filtops;
 		break;
 
 	default:
 		return EINVAL;
 	}
 
-	mutex_enter(_power_event_queue_mtx);
-	selrecord_knote(_power_event_queue_selinfo, kn);
-	mutex_exit(_power_event_queue_mtx);
-
 	return 0;
 }
 



CVS commit: src/sys/dev/sysmon

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 16:24:21 UTC 2021

Modified Files:
src/sys/dev/sysmon: sysmon_power.c

Log Message:
- Call selnotify() with sysmon_power_event_queue_mtx held, passing the
  correct hints.  Adjust filt_sysmon_power_read() accordingly (assert
  that the mutex is held iff NOTE_SUBMIT).
- Mark sysmon_power_read_filtops as MPSAFE.
- Use seltrue_filtops rather than rolling our own with filt_seltrue.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/dev/sysmon/sysmon_power.c

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



CVS commit: src/sys/net

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 15:58:33 UTC 2021

Modified Files:
src/sys/net: if_tap.c if_tun.c

Log Message:
Use seltrue_filtops rather than rolling our own with filt_seltrue.


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/net/if_tap.c
cvs rdiff -u -r1.163 -r1.164 src/sys/net/if_tun.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_tap.c
diff -u src/sys/net/if_tap.c:1.123 src/sys/net/if_tap.c:1.124
--- src/sys/net/if_tap.c:1.123	Sun Sep 26 01:16:10 2021
+++ src/sys/net/if_tap.c	Sun Sep 26 15:58:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tap.c,v 1.123 2021/09/26 01:16:10 thorpej Exp $	*/
+/*	$NetBSD: if_tap.c,v 1.124 2021/09/26 15:58:33 thorpej Exp $	*/
 
 /*
  *  Copyright (c) 2003, 2004, 2008, 2009 The NetBSD Foundation.
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.123 2021/09/26 01:16:10 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.124 2021/09/26 15:58:33 thorpej Exp $");
 
 #if defined(_KERNEL_OPT)
 
@@ -1175,13 +1175,6 @@ static struct filterops tap_read_filtero
 	.f_event = tap_kqread,
 };
 
-static struct filterops tap_seltrue_filterops = {
-	.f_flags = FILTEROP_ISFD,
-	.f_attach = NULL,
-	.f_detach = tap_kqdetach,
-	.f_event = filt_seltrue,
-};
-
 static int
 tap_cdev_kqfilter(dev_t dev, struct knote *kn)
 {
@@ -1204,24 +1197,25 @@ tap_dev_kqfilter(int unit, struct knote 
 	if (sc == NULL)
 		return ENXIO;
 
-	KERNEL_LOCK(1, NULL);
 	switch(kn->kn_filter) {
 	case EVFILT_READ:
 		kn->kn_fop = _read_filterops;
+		kn->kn_hook = sc;
+		KERNEL_LOCK(1, NULL);
+		mutex_spin_enter(>sc_lock);
+		selrecord_knote(>sc_rsel, kn);
+		mutex_spin_exit(>sc_lock);
+		KERNEL_UNLOCK_ONE(NULL);
 		break;
+
 	case EVFILT_WRITE:
-		kn->kn_fop = _seltrue_filterops;
+		kn->kn_fop = _filtops;
 		break;
+
 	default:
-		KERNEL_UNLOCK_ONE(NULL);
 		return EINVAL;
 	}
 
-	kn->kn_hook = sc;
-	mutex_spin_enter(>sc_lock);
-	selrecord_knote(>sc_rsel, kn);
-	mutex_spin_exit(>sc_lock);
-	KERNEL_UNLOCK_ONE(NULL);
 	return 0;
 }
 

Index: src/sys/net/if_tun.c
diff -u src/sys/net/if_tun.c:1.163 src/sys/net/if_tun.c:1.164
--- src/sys/net/if_tun.c:1.163	Sun Sep 26 01:16:10 2021
+++ src/sys/net/if_tun.c	Sun Sep 26 15:58:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tun.c,v 1.163 2021/09/26 01:16:10 thorpej Exp $	*/
+/*	$NetBSD: if_tun.c,v 1.164 2021/09/26 15:58:33 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988, Julian Onions 
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.163 2021/09/26 01:16:10 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.164 2021/09/26 15:58:33 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1088,13 +1088,6 @@ static const struct filterops tunread_fi
 	.f_event = filt_tunread,
 };
 
-static const struct filterops tun_seltrue_filtops = {
-	.f_flags = FILTEROP_ISFD,
-	.f_attach = NULL,
-	.f_detach = filt_tunrdetach,
-	.f_event = filt_seltrue,
-};
-
 int
 tunkqfilter(dev_t dev, struct knote *kn)
 {
@@ -1108,10 +1101,12 @@ tunkqfilter(dev_t dev, struct knote *kn)
 	switch (kn->kn_filter) {
 	case EVFILT_READ:
 		kn->kn_fop = _filtops;
+		kn->kn_hook = tp;
+		selrecord_knote(>tun_rsel, kn);
 		break;
 
 	case EVFILT_WRITE:
-		kn->kn_fop = _seltrue_filtops;
+		kn->kn_fop = _filtops;
 		break;
 
 	default:
@@ -1119,10 +1114,6 @@ tunkqfilter(dev_t dev, struct knote *kn)
 		goto out;
 	}
 
-	kn->kn_hook = tp;
-
-	selrecord_knote(>tun_rsel, kn);
-
 out:
 	mutex_exit(>tun_lock);
 out_nolock:



CVS commit: src/sys/net

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 15:58:33 UTC 2021

Modified Files:
src/sys/net: if_tap.c if_tun.c

Log Message:
Use seltrue_filtops rather than rolling our own with filt_seltrue.


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/net/if_tap.c
cvs rdiff -u -r1.163 -r1.164 src/sys/net/if_tun.c

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



CVS commit: src

2021-09-26 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sun Sep 26 15:52:41 UTC 2021

Modified Files:
src/etc: Makefile
src/external/nvidia-firmware: Makefile
src/share/mk: bsd.README bsd.own.mk
src/sys/dev/microcode/radeon: Makefile
src/usr.sbin/sysinst: Makefile.inc defs.h util.c

Log Message:
Restore MKNOUVEAUFIRMWARE and MKRADEONFIRMWARE and make gpufw set unconditional

Simplifies logic.
(Second commit - first one was partial)

Restoring MK* requested by mrg on tech-kern discussion
https://mail-index.netbsd.org/tech-kern/2021/09/25/msg027695.html


To generate a diff of this commit:
cvs rdiff -u -r1.451 -r1.452 src/etc/Makefile
cvs rdiff -u -r1.4 -r1.5 src/external/nvidia-firmware/Makefile
cvs rdiff -u -r1.417 -r1.418 src/share/mk/bsd.README
cvs rdiff -u -r1.1261 -r1.1262 src/share/mk/bsd.own.mk
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/microcode/radeon/Makefile
cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/sysinst/Makefile.inc
cvs rdiff -u -r1.73 -r1.74 src/usr.sbin/sysinst/defs.h
cvs rdiff -u -r1.60 -r1.61 src/usr.sbin/sysinst/util.c

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

Modified files:

Index: src/etc/Makefile
diff -u src/etc/Makefile:1.451 src/etc/Makefile:1.452
--- src/etc/Makefile:1.451	Sat Sep 25 08:54:30 2021
+++ src/etc/Makefile	Sun Sep 26 15:52:40 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.451 2021/09/25 08:54:30 maya Exp $
+#	$NetBSD: Makefile,v 1.452 2021/09/26 15:52:40 maya Exp $
 #	from: @(#)Makefile	8.7 (Berkeley) 5/25/95
 
 # Environment variables without default values:
@@ -368,16 +368,13 @@ install-etc-files: .PHONY .MAKE check_DE
 #	Install var/db/obsolete set lists; this is performed by "make build"
 #
 OBSOLETE.dir=		${.OBJDIR}/obsolete.dir
-OBSOLETE.files=		base comp etc games man misc rescue text
+OBSOLETE.files=		base comp etc games gpufw man misc rescue text
 .if ${MKDEBUG} != "no"
 OBSOLETE.files+=	debug
 .endif
 .if ${MKDTB} != "no"
 OBSOLETE.files+=	dtb
 .endif
-.if ${MKGPUFIRMWARE} != "no"
-OBSOLETE.files+=	gpufw
-.endif
 .if ${MKKMOD} != "no"
 OBSOLETE.files+=	modules
 .endif

Index: src/external/nvidia-firmware/Makefile
diff -u src/external/nvidia-firmware/Makefile:1.4 src/external/nvidia-firmware/Makefile:1.5
--- src/external/nvidia-firmware/Makefile:1.4	Sat Sep 25 08:54:30 2021
+++ src/external/nvidia-firmware/Makefile	Sun Sep 26 15:52:40 2021
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.4 2021/09/25 08:54:30 maya Exp $
+# $NetBSD: Makefile,v 1.5 2021/09/26 15:52:40 maya Exp $
 
 .include 
 
-.if ${MKGPUFIRMWARE} != "no"
+.if ${MKNOUVEAUFIRMWARE} != "no"
 SUBDIR+=	gm20x
 .endif
 

Index: src/share/mk/bsd.README
diff -u src/share/mk/bsd.README:1.417 src/share/mk/bsd.README:1.418
--- src/share/mk/bsd.README:1.417	Sat Sep 25 08:54:30 2021
+++ src/share/mk/bsd.README	Sun Sep 26 15:52:40 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.README,v 1.417 2021/09/25 08:54:30 maya Exp $
+#	$NetBSD: bsd.README,v 1.418 2021/09/26 15:52:40 maya Exp $
 #	@(#)bsd.README	8.2 (Berkeley) 4/2/94
 
 This is the README file for the make "include" files for the NetBSD
@@ -218,10 +218,6 @@ MKFIRMWARE  If not "no", install the
 		Default: yes on amd64, cobalt, evbarm evbmips, evbppc, hpcarm,
 		hppa, i386, mac68k, macppc, sandpoint, and sparc64, no elsewhere.
 
-MKGPUFIRMWARE	If not "no", install the /libdata/firmware directory,
-		which is necessary for GPU drivers.
-		Default: yes on amd64, i386, evbarm. No elsewhere.
-
 MKGCC		If "no", don't build gcc(1) or any of the GCC-related
 		libraries (libgcc, libobjc, libstdc++).
 		Default: yes
@@ -373,6 +369,10 @@ MKNLS		If "no", don't build or install t
 		definition files.
 		Default: yes
 
+MKNOUVEAUFIRMWARE If "yes", install the /libdata/firmware/nouveau directory,
+		which is necessary for the nouveau DRM driver.
+		Default: yes on amd64 and i386, no elsewhere.
+
 MKNPF		If "no", don't build or install the NPF and its modules.
 		Default: yes
 

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1261 src/share/mk/bsd.own.mk:1.1262
--- src/share/mk/bsd.own.mk:1.1261	Sat Sep 25 08:54:30 2021
+++ src/share/mk/bsd.own.mk	Sun Sep 26 15:52:40 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1261 2021/09/25 08:54:30 maya Exp $
+#	$NetBSD: bsd.own.mk,v 1.1262 2021/09/26 15:52:40 maya Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -1236,9 +1236,12 @@ MKFIRMWARE.sandpoint=		yes
 MKFIRMWARE.sparc64=		yes
 
 # Only install the GPU firmware on DRM-happy systems.
-MKGPUFIRMWARE.x86_64=		yes
-MKGPUFIRMWARE.i386=		yes
-MKGPUFIRMWARE.aarch64=		yes
+MKNOUVEAUFIRMWARE.x86_64=	yes
+MKNOUVEAUFIRMWARE.i386=		yes
+MKNOUVEAUFIRMWARE.aarch64=	yes
+MKRADEONFIRMWARE.x86_64=	yes
+MKRADEONFIRMWARE.i386=		yes
+MKRADEONFIRMWARE.aarch64=	yes
 
 # Only install the tegra firmware on evbarm.
 MKTEGRAFIRMWARE.evbarm=		yes
@@ -1288,9 +1291,10 @@ _MKVARS.no= \
 	MKKYUA \
 	MKLIBCXX MKLLD MKLLDB MKLLVM MKLLVMRT MKLINT \
 	MKMANZ 

CVS commit: src

2021-09-26 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sun Sep 26 15:52:41 UTC 2021

Modified Files:
src/etc: Makefile
src/external/nvidia-firmware: Makefile
src/share/mk: bsd.README bsd.own.mk
src/sys/dev/microcode/radeon: Makefile
src/usr.sbin/sysinst: Makefile.inc defs.h util.c

Log Message:
Restore MKNOUVEAUFIRMWARE and MKRADEONFIRMWARE and make gpufw set unconditional

Simplifies logic.
(Second commit - first one was partial)

Restoring MK* requested by mrg on tech-kern discussion
https://mail-index.netbsd.org/tech-kern/2021/09/25/msg027695.html


To generate a diff of this commit:
cvs rdiff -u -r1.451 -r1.452 src/etc/Makefile
cvs rdiff -u -r1.4 -r1.5 src/external/nvidia-firmware/Makefile
cvs rdiff -u -r1.417 -r1.418 src/share/mk/bsd.README
cvs rdiff -u -r1.1261 -r1.1262 src/share/mk/bsd.own.mk
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/microcode/radeon/Makefile
cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/sysinst/Makefile.inc
cvs rdiff -u -r1.73 -r1.74 src/usr.sbin/sysinst/defs.h
cvs rdiff -u -r1.60 -r1.61 src/usr.sbin/sysinst/util.c

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



CVS commit: src/sys/kern

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 15:48:54 UTC 2021

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

Log Message:
The pipe kq filter ops are MPSAFE.


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 src/sys/kern/sys_pipe.c

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

Modified files:

Index: src/sys/kern/sys_pipe.c
diff -u src/sys/kern/sys_pipe.c:1.154 src/sys/kern/sys_pipe.c:1.155
--- src/sys/kern/sys_pipe.c:1.154	Sun Sep 26 01:16:10 2021
+++ src/sys/kern/sys_pipe.c	Sun Sep 26 15:48:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_pipe.c,v 1.154 2021/09/26 01:16:10 thorpej Exp $	*/
+/*	$NetBSD: sys_pipe.c,v 1.155 2021/09/26 15:48:54 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.154 2021/09/26 01:16:10 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.155 2021/09/26 15:48:54 thorpej Exp $");
 
 #include 
 #include 
@@ -1095,14 +1095,14 @@ filt_pipewrite(struct knote *kn, long hi
 }
 
 static const struct filterops pipe_rfiltops = {
-	.f_flags = FILTEROP_ISFD,
+	.f_flags = FILTEROP_ISFD | FILTEROP_MPSAFE,
 	.f_attach = NULL,
 	.f_detach = filt_pipedetach,
 	.f_event = filt_piperead,
 };
 
 static const struct filterops pipe_wfiltops = {
-	.f_flags = FILTEROP_ISFD,
+	.f_flags = FILTEROP_ISFD | FILTEROP_MPSAFE,
 	.f_attach = NULL,
 	.f_detach = filt_pipedetach,
 	.f_event = filt_pipewrite,



CVS commit: src/sys/kern

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 15:48:54 UTC 2021

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

Log Message:
The pipe kq filter ops are MPSAFE.


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 src/sys/kern/sys_pipe.c

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



CVS commit: src/sys/kern

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 15:11:33 UTC 2021

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

Log Message:
logread_filtops is MPSAFE.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/kern/subr_log.c

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

Modified files:

Index: src/sys/kern/subr_log.c
diff -u src/sys/kern/subr_log.c:1.61 src/sys/kern/subr_log.c:1.62
--- src/sys/kern/subr_log.c:1.61	Sun Sep 26 01:16:10 2021
+++ src/sys/kern/subr_log.c	Sun Sep 26 15:11:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_log.c,v 1.61 2021/09/26 01:16:10 thorpej Exp $	*/
+/*	$NetBSD: subr_log.c,v 1.62 2021/09/26 15:11:33 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_log.c,v 1.61 2021/09/26 01:16:10 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_log.c,v 1.62 2021/09/26 15:11:33 thorpej Exp $");
 
 #include 
 #include 
@@ -290,7 +290,7 @@ filt_logread(struct knote *kn, long hint
 }
 
 static const struct filterops logread_filtops = {
-	.f_flags = FILTEROP_ISFD,
+	.f_flags = FILTEROP_ISFD | FILTEROP_MPSAFE,
 	.f_attach = NULL,
 	.f_detach = filt_logrdetach,
 	.f_event = filt_logread,
@@ -303,18 +303,15 @@ logkqfilter(dev_t dev, struct knote *kn)
 	switch (kn->kn_filter) {
 	case EVFILT_READ:
 		kn->kn_fop = _filtops;
+		mutex_spin_enter(_lock);
+		selrecord_knote(_selp, kn);
+		mutex_spin_exit(_lock);
 		break;
 
 	default:
 		return (EINVAL);
 	}
 
-	kn->kn_hook = NULL;
-
-	mutex_spin_enter(_lock);
-	selrecord_knote(_selp, kn);
-	mutex_spin_exit(_lock);
-
 	return (0);
 }
 



CVS commit: src/sys/kern

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 15:11:33 UTC 2021

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

Log Message:
logread_filtops is MPSAFE.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/kern/subr_log.c

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



CVS commit: src/sys/kern

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 15:10:51 UTC 2021

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

Log Message:
entropy_read_filtops is MPSAFE.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/kern/kern_entropy.c

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

Modified files:

Index: src/sys/kern/kern_entropy.c
diff -u src/sys/kern/kern_entropy.c:1.32 src/sys/kern/kern_entropy.c:1.33
--- src/sys/kern/kern_entropy.c:1.32	Sun Sep 26 01:16:10 2021
+++ src/sys/kern/kern_entropy.c	Sun Sep 26 15:10:51 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_entropy.c,v 1.32 2021/09/26 01:16:10 thorpej Exp $	*/
+/*	$NetBSD: kern_entropy.c,v 1.33 2021/09/26 15:10:51 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.32 2021/09/26 01:16:10 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.33 2021/09/26 15:10:51 thorpej Exp $");
 
 #include 
 #include 
@@ -1465,8 +1465,9 @@ filt_entropy_read_event(struct knote *kn
 	return ret;
 }
 
+/* XXX Makes sense only for /dev/u?random.  */
 static const struct filterops entropy_read_filtops = {
-	.f_flags = FILTEROP_ISFD,/* XXX Makes sense only for /dev/u?random.  */
+	.f_flags = FILTEROP_ISFD | FILTEROP_MPSAFE,
 	.f_attach = NULL,
 	.f_detach = filt_entropy_read_detach,
 	.f_event = filt_entropy_read_event,



CVS commit: src/sys/kern

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 15:10:51 UTC 2021

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

Log Message:
entropy_read_filtops is MPSAFE.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/kern/kern_entropy.c

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



CVS commit: src/sys/dev/usb

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 15:08:29 UTC 2021

Modified Files:
src/sys/dev/usb: uirda.c uirdavar.h

Log Message:
- Use seltrue_filtops rather than rolling our own with filt_seltrue.
- Remove sc_wr_sel completely; nothing actually uses it.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/usb/uirda.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/usb/uirdavar.h

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

Modified files:

Index: src/sys/dev/usb/uirda.c
diff -u src/sys/dev/usb/uirda.c:1.51 src/sys/dev/usb/uirda.c:1.52
--- src/sys/dev/usb/uirda.c:1.51	Sun Sep 26 01:16:09 2021
+++ src/sys/dev/usb/uirda.c	Sun Sep 26 15:08:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: uirda.c,v 1.51 2021/09/26 01:16:09 thorpej Exp $	*/
+/*	$NetBSD: uirda.c,v 1.52 2021/09/26 15:08:29 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uirda.c,v 1.51 2021/09/26 01:16:09 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uirda.c,v 1.52 2021/09/26 15:08:29 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -283,7 +283,6 @@ uirda_attach(device_t parent, device_t s
 	mutex_init(>sc_wr_buf_lk, MUTEX_DEFAULT, IPL_NONE);
 	mutex_init(>sc_rd_buf_lk, MUTEX_DEFAULT, IPL_NONE);
 	selinit(>sc_rd_sel);
-	selinit(>sc_wr_sel);
 
 	ia.ia_type = IR_TYPE_IRFRAME;
 	ia.ia_methods = sc->sc_irm ? sc->sc_irm : _methods;
@@ -346,7 +345,6 @@ uirda_detach(device_t self, int flags)
 	mutex_destroy(>sc_wr_buf_lk);
 	mutex_destroy(>sc_rd_buf_lk);
 	seldestroy(>sc_rd_sel);
-	seldestroy(>sc_wr_sel);
 
 	return rv;
 }
@@ -629,17 +627,6 @@ filt_uirdaread(struct knote *kn, long hi
 	return kn->kn_data > 0;
 }
 
-static void
-filt_uirdawdetach(struct knote *kn)
-{
-	struct uirda_softc *sc = kn->kn_hook;
-	int s;
-
-	s = splusb();
-	selremove_knote(>sc_wr_sel, kn);
-	splx(s);
-}
-
 static const struct filterops uirdaread_filtops = {
 	.f_flags = FILTEROP_ISFD,
 	.f_attach = NULL,
@@ -647,39 +634,29 @@ static const struct filterops uirdaread_
 	.f_event = filt_uirdaread,
 };
 
-static const struct filterops uirdawrite_filtops = {
-	.f_flags = FILTEROP_ISFD,
-	.f_attach = NULL,
-	.f_detach = filt_uirdawdetach,
-	.f_event = filt_seltrue,
-};
-
 int
 uirda_kqfilter(void *h, struct knote *kn)
 {
 	struct uirda_softc *sc = kn->kn_hook;
-	struct selinfo *sip;
 	int s;
 
 	switch (kn->kn_filter) {
 	case EVFILT_READ:
-		sip = >sc_rd_sel;
 		kn->kn_fop = _filtops;
+		kn->kn_hook = sc;
+		s = splusb();
+		selrecord_knote(>sc_rd_sel, kn);
+		splx(s);
 		break;
+
 	case EVFILT_WRITE:
-		sip = >sc_wr_sel;
-		kn->kn_fop = _filtops;
+		kn->kn_fop = _filtops;
 		break;
+
 	default:
 		return EINVAL;
 	}
 
-	kn->kn_hook = sc;
-
-	s = splusb();
-	selrecord_knote(sip, kn);
-	splx(s);
-
 	return 0;
 }
 

Index: src/sys/dev/usb/uirdavar.h
diff -u src/sys/dev/usb/uirdavar.h:1.7 src/sys/dev/usb/uirdavar.h:1.8
--- src/sys/dev/usb/uirdavar.h:1.7	Sun Dec  4 10:12:35 2016
+++ src/sys/dev/usb/uirdavar.h	Sun Sep 26 15:08:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: uirdavar.h,v 1.7 2016/12/04 10:12:35 skrll Exp $	*/
+/*	$NetBSD: uirdavar.h,v 1.8 2021/09/26 15:08:29 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2001,2007 The NetBSD Foundation, Inc.
@@ -136,7 +136,6 @@ struct uirda_softc {
 	struct usbd_xfer	*sc_wr_xfer;
 	struct usbd_pipe	*sc_wr_pipe;
 	int			sc_wr_hdr;
-	struct selinfo		sc_wr_sel;
 
 	device_t		sc_child;
 	struct irda_params	sc_params;



CVS commit: src/sys/dev/usb

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 15:08:29 UTC 2021

Modified Files:
src/sys/dev/usb: uirda.c uirdavar.h

Log Message:
- Use seltrue_filtops rather than rolling our own with filt_seltrue.
- Remove sc_wr_sel completely; nothing actually uses it.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/usb/uirda.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/usb/uirdavar.h

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



CVS commit: src/sys/dev/usb

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 15:07:17 UTC 2021

Modified Files:
src/sys/dev/usb: uhid.c

Log Message:
Use seltrue_filtops rather than rolling our own with filt_seltrue.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/dev/usb/uhid.c

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



CVS commit: src/sys/dev/usb

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 15:07:17 UTC 2021

Modified Files:
src/sys/dev/usb: uhid.c

Log Message:
Use seltrue_filtops rather than rolling our own with filt_seltrue.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/dev/usb/uhid.c

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

Modified files:

Index: src/sys/dev/usb/uhid.c
diff -u src/sys/dev/usb/uhid.c:1.118 src/sys/dev/usb/uhid.c:1.119
--- src/sys/dev/usb/uhid.c:1.118	Sun Sep 26 01:16:09 2021
+++ src/sys/dev/usb/uhid.c	Sun Sep 26 15:07:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhid.c,v 1.118 2021/09/26 01:16:09 thorpej Exp $	*/
+/*	$NetBSD: uhid.c,v 1.119 2021/09/26 15:07:17 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2008, 2012 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhid.c,v 1.118 2021/09/26 01:16:09 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhid.c,v 1.119 2021/09/26 15:07:17 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -862,13 +862,6 @@ static const struct filterops uhidread_f
 	.f_event = filt_uhidread,
 };
 
-static const struct filterops uhid_seltrue_filtops = {
-	.f_flags = FILTEROP_ISFD,
-	.f_attach = NULL,
-	.f_detach = filt_uhidrdetach,
-	.f_event = filt_seltrue,
-};
-
 static int
 uhidkqfilter(dev_t dev, struct knote *kn)
 {
@@ -882,21 +875,21 @@ uhidkqfilter(dev_t dev, struct knote *kn
 	switch (kn->kn_filter) {
 	case EVFILT_READ:
 		kn->kn_fop = _filtops;
+		kn->kn_hook = sc;
+		mutex_enter(>sc_lock);
+		selrecord_knote(>sc_rsel, kn);
+		mutex_exit(>sc_lock);
 		break;
+
 	case EVFILT_WRITE:
-		kn->kn_fop = _seltrue_filtops;
+		kn->kn_fop = _filtops;
 		break;
+
 	default:
 		error = EINVAL;
 		goto out;
 	}
 
-	kn->kn_hook = sc;
-
-	mutex_enter(>sc_lock);
-	selrecord_knote(>sc_rsel, kn);
-	mutex_exit(>sc_lock);
-
 out:	uhid_exit(sc);
 	return error;
 }



CVS commit: src/sys/dev/pci

2021-09-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep 26 15:01:55 UTC 2021

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

Log Message:
We are not mapping registers prefetchable so no need for explicit bs
barriers.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/pci/if_mcx.c

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

Modified files:

Index: src/sys/dev/pci/if_mcx.c
diff -u src/sys/dev/pci/if_mcx.c:1.20 src/sys/dev/pci/if_mcx.c:1.21
--- src/sys/dev/pci/if_mcx.c:1.20	Sat Sep 25 15:16:36 2021
+++ src/sys/dev/pci/if_mcx.c	Sun Sep 26 15:01:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mcx.c,v 1.20 2021/09/25 15:16:36 jmcneill Exp $ */
+/*	$NetBSD: if_mcx.c,v 1.21 2021/09/26 15:01:55 jmcneill Exp $ */
 /*	$OpenBSD: if_mcx.c,v 1.101 2021/06/02 19:16:11 patrick Exp $ */
 
 /*
@@ -23,7 +23,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mcx.c,v 1.20 2021/09/25 15:16:36 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mcx.c,v 1.21 2021/09/26 15:01:55 jmcneill Exp $");
 
 #include 
 #include 
@@ -2764,7 +2764,12 @@ mcx_attach(device_t parent, device_t sel
 	/* Map the PCI memory space */
 	memtype = pci_mapreg_type(sc->sc_pc, sc->sc_tag, MCX_HCA_BAR);
 	if (pci_mapreg_map(pa, MCX_HCA_BAR, memtype,
-	0 /*BUS_SPACE_MAP_PREFETCHABLE*/, >sc_memt, >sc_memh,
+#ifdef __NetBSD__
+	0,
+#else
+	BUS_SPACE_MAP_PREFETCHABLE,
+#endif
+	>sc_memt, >sc_memh,
 	NULL, >sc_mems)) {
 		aprint_error(": unable to map register memory\n");
 		return;
@@ -8206,7 +8211,9 @@ mcx_wr(struct mcx_softc *sc, bus_size_t 
 static inline void
 mcx_bar(struct mcx_softc *sc, bus_size_t r, bus_size_t l, int f)
 {
+#ifndef __NetBSD__
 	bus_space_barrier(sc->sc_memt, sc->sc_memh, r, l, f);
+#endif
 }
 
 static uint64_t



CVS commit: src/sys/dev/pci

2021-09-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep 26 15:01:55 UTC 2021

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

Log Message:
We are not mapping registers prefetchable so no need for explicit bs
barriers.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/pci/if_mcx.c

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



CVS commit: src/sys/dev/scsipi

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 14:57:19 UTC 2021

Modified Files:
src/sys/dev/scsipi: ch.c

Log Message:
Use seltrue_filtops rather than rolling our own with filt_seltrue.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/dev/scsipi/ch.c

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

Modified files:

Index: src/sys/dev/scsipi/ch.c
diff -u src/sys/dev/scsipi/ch.c:1.94 src/sys/dev/scsipi/ch.c:1.95
--- src/sys/dev/scsipi/ch.c:1.94	Sun Sep 26 01:16:09 2021
+++ src/sys/dev/scsipi/ch.c	Sun Sep 26 14:57:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ch.c,v 1.94 2021/09/26 01:16:09 thorpej Exp $	*/
+/*	$NetBSD: ch.c,v 1.95 2021/09/26 14:57:19 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ch.c,v 1.94 2021/09/26 01:16:09 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ch.c,v 1.95 2021/09/26 14:57:19 thorpej Exp $");
 
 #include 
 #include 
@@ -494,13 +494,6 @@ static const struct filterops chread_fil
 	.f_event = filt_chread,
 };
 
-static const struct filterops chwrite_filtops = {
-	.f_flags = FILTEROP_ISFD,
-	.f_attach = NULL,
-	.f_detach = filt_chdetach,
-	.f_event = filt_seltrue,
-};
-
 static int
 chkqfilter(dev_t dev, struct knote *kn)
 {
@@ -509,20 +502,18 @@ chkqfilter(dev_t dev, struct knote *kn)
 	switch (kn->kn_filter) {
 	case EVFILT_READ:
 		kn->kn_fop = _filtops;
+		kn->kn_hook = sc;
+		selrecord_knote(>sc_selq, kn);
 		break;
 
 	case EVFILT_WRITE:
-		kn->kn_fop = _filtops;
+		kn->kn_fop = _filtops;
 		break;
 
 	default:
 		return (EINVAL);
 	}
 
-	kn->kn_hook = sc;
-
-	selrecord_knote(>sc_selq, kn);
-
 	return (0);
 }
 



CVS commit: src/sys/dev/scsipi

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 14:57:19 UTC 2021

Modified Files:
src/sys/dev/scsipi: ch.c

Log Message:
Use seltrue_filtops rather than rolling our own with filt_seltrue.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/dev/scsipi/ch.c

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



CVS commit: src/sys/dev/pci

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 14:56:36 UTC 2021

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

Log Message:
- Use seltrue_filtops rather than rolling our own with filt_seltrue.
- Remove sc_wsel completely; nothing actually uses it.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/pci/oboe.c

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

Modified files:

Index: src/sys/dev/pci/oboe.c
diff -u src/sys/dev/pci/oboe.c:1.50 src/sys/dev/pci/oboe.c:1.51
--- src/sys/dev/pci/oboe.c:1.50	Sun Sep 26 01:16:09 2021
+++ src/sys/dev/pci/oboe.c	Sun Sep 26 14:56:36 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: oboe.c,v 1.50 2021/09/26 01:16:09 thorpej Exp $	*/
+/*	$NetBSD: oboe.c,v 1.51 2021/09/26 14:56:36 thorpej Exp $	*/
 
 /*	FVDL THIS DRIVER IS BROKEN FOR NON-i386 -- vtophys() usage	*/
 
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: oboe.c,v 1.50 2021/09/26 01:16:09 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: oboe.c,v 1.51 2021/09/26 14:56:36 thorpej Exp $");
 
 #include 
 #include 
@@ -96,7 +96,6 @@ struct oboe_softc {
 	bus_space_handle_t	sc_ioh;
 	bus_dma_tag_t		sc_dmatag;
 	struct selinfo		sc_rsel;
-	struct selinfo		sc_wsel;
 
 	int			sc_state;
 #define	OBOE_RSLP		0x01	/* waiting for data (read) */
@@ -227,7 +226,6 @@ oboe_attach(device_t parent, device_t se
 	aprint_normal_dev(self, "interrupting at %s\n", intrstring);
 
 	selinit(>sc_rsel);
-	selinit(>sc_wsel);
 
 	sc->sc_txs = 0;
 	sc->sc_rxs = 0;
@@ -252,7 +250,6 @@ oboe_detach(device_t self, int flags)
 	DPRINTF(("%s: sc=%p\n", __func__, sc));
 #endif
 	seldestroy(>sc_rsel);
-	seldestroy(>sc_wsel);
 	return (0);
 }
 
@@ -483,17 +480,6 @@ filt_oboeread(struct knote *kn, long hin
 	return (kn->kn_data > 0);
 }
 
-static void
-filt_oboewdetach(struct knote *kn)
-{
-	struct oboe_softc *sc = kn->kn_hook;
-	int s;
-
-	s = splir();
-	selremove_knote(>sc_wsel, kn);
-	splx(s);
-}
-
 static const struct filterops oboeread_filtops = {
 	.f_flags = FILTEROP_ISFD,
 	.f_attach = NULL,
@@ -501,39 +487,28 @@ static const struct filterops oboeread_f
 	.f_event = filt_oboeread,
 };
 
-static const struct filterops oboewrite_filtops = {
-	.f_flags = FILTEROP_ISFD,
-	.f_attach = NULL,
-	.f_detach = filt_oboewdetach,
-	.f_event = filt_seltrue,
-};
-
 static int
 oboe_kqfilter(void *h, struct knote *kn)
 {
 	struct oboe_softc *sc = h;
-	struct selinfo *sip;
 	int s;
 
 	switch (kn->kn_filter) {
 	case EVFILT_READ:
-		sip = >sc_rsel;
 		kn->kn_fop = _filtops;
+		kn->kn_hook = sc;
+		s = splir();
+		selrecord_knote(>sc_rsel, kn);
+		splx(s);
 		break;
+
 	case EVFILT_WRITE:
-		sip = >sc_wsel;
-		kn->kn_fop = _filtops;
+		kn->kn_fop = _filtops;
 		break;
 	default:
 		return (EINVAL);
 	}
 
-	kn->kn_hook = sc;
-
-	s = splir();
-	selrecord_knote(sip, kn);
-	splx(s);
-
 	return (0);
 }
 
@@ -613,7 +588,6 @@ oboe_intr(void *p)
 			DPRINTF(("oboe_intr: waking up writer\n"));
 			wakeup(>sc_txs);
 		}
-		selnotify(>sc_wsel, 0, 0);
 	}
 	return (1);
 }



CVS commit: src/sys/dev/pci

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 14:56:36 UTC 2021

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

Log Message:
- Use seltrue_filtops rather than rolling our own with filt_seltrue.
- Remove sc_wsel completely; nothing actually uses it.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/pci/oboe.c

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



CVS commit: src

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 14:52:37 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: platform_int.c platform_int.exp
platform_long.c platform_long.exp
src/usr.bin/xlint/lint1: tree.c

Log Message:
tests/lint: explain difference between i386 and sparc for 259

Seen in usr.bin/make/cond.c 1.278 from 2021-09-21, line 800, the call to
is_token, where unsigned char gets converted to unsigned int or unsigned
long, depending on the platform.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/platform_int.c \
src/tests/usr.bin/xlint/lint1/platform_long.c
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/platform_int.exp \
src/tests/usr.bin/xlint/lint1/platform_long.exp
cvs rdiff -u -r1.382 -r1.383 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/tests/usr.bin/xlint/lint1/platform_int.c
diff -u src/tests/usr.bin/xlint/lint1/platform_int.c:1.2 src/tests/usr.bin/xlint/lint1/platform_int.c:1.3
--- src/tests/usr.bin/xlint/lint1/platform_int.c:1.2	Sun Sep 26 14:28:22 2021
+++ src/tests/usr.bin/xlint/lint1/platform_int.c	Sun Sep 26 14:52:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: platform_int.c,v 1.2 2021/09/26 14:28:22 rillig Exp $	*/
+/*	$NetBSD: platform_int.c,v 1.3 2021/09/26 14:52:37 rillig Exp $	*/
 # 3 "platform_int.c"
 
 /*
@@ -11,9 +11,16 @@
 
 void to_size(typeof(sizeof(int)));
 
+/* See should_warn_about_prototype_conversion. */
 void
 convert_unsigned_char_to_size(unsigned char uc)
 {
+	/*
+	 * In this function call, uc is first promoted to INT. It is then
+	 * converted to size_t, which is UINT. The portable bit size of INT
+	 * and UINT is the same, 32, but the signedness changes, therefore
+	 * the warning.
+	 */
 	/* expect+1: warning: argument #1 is converted from 'unsigned char' to 'unsigned int' due to prototype [259] */
 	to_size(uc);
 }
Index: src/tests/usr.bin/xlint/lint1/platform_long.c
diff -u src/tests/usr.bin/xlint/lint1/platform_long.c:1.2 src/tests/usr.bin/xlint/lint1/platform_long.c:1.3
--- src/tests/usr.bin/xlint/lint1/platform_long.c:1.2	Sun Sep 26 14:28:22 2021
+++ src/tests/usr.bin/xlint/lint1/platform_long.c	Sun Sep 26 14:52:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: platform_long.c,v 1.2 2021/09/26 14:28:22 rillig Exp $	*/
+/*	$NetBSD: platform_long.c,v 1.3 2021/09/26 14:52:37 rillig Exp $	*/
 # 3 "platform_long.c"
 
 /*
@@ -11,10 +11,22 @@
 
 void to_size(typeof(sizeof(int)));
 
+/* See should_warn_about_prototype_conversion. */
 void
 convert_unsigned_char_to_size(unsigned char uc)
 {
-	/* no warning, unlike in platform_int */
+	/*
+	 * In this function call, uc is first promoted to INT. It is then
+	 * converted to size_t, which is ULONG. The portable bit size of INT
+	 * is 24 (see INT_RSIZE in inittyp.c), which is less than the 32 of
+	 * ULONG. Since the portable bit size increases from 24 to 32, there
+	 * is no warning.
+	 *
+	 * XXX: Investigate whether this rule makes sense. Warning 259 is
+	 * about prototype mismatch, not about lossy integer conversions,
+	 * and there is a clear mismatch here between INT and LONG,
+	 * therefore a warning makes sense.
+	 */
 	to_size(uc);
 }
 

Index: src/tests/usr.bin/xlint/lint1/platform_int.exp
diff -u src/tests/usr.bin/xlint/lint1/platform_int.exp:1.1 src/tests/usr.bin/xlint/lint1/platform_int.exp:1.2
--- src/tests/usr.bin/xlint/lint1/platform_int.exp:1.1	Sun Sep 26 03:17:59 2021
+++ src/tests/usr.bin/xlint/lint1/platform_int.exp	Sun Sep 26 14:52:37 2021
@@ -1 +1 @@
-platform_int.c(18): warning: argument #1 is converted from 'unsigned char' to 'unsigned int' due to prototype [259]
+platform_int.c(25): warning: argument #1 is converted from 'unsigned char' to 'unsigned int' due to prototype [259]
Index: src/tests/usr.bin/xlint/lint1/platform_long.exp
diff -u src/tests/usr.bin/xlint/lint1/platform_long.exp:1.1 src/tests/usr.bin/xlint/lint1/platform_long.exp:1.2
--- src/tests/usr.bin/xlint/lint1/platform_long.exp:1.1	Sun Sep 26 03:17:59 2021
+++ src/tests/usr.bin/xlint/lint1/platform_long.exp	Sun Sep 26 14:52:37 2021
@@ -1 +1 @@
-platform_long.c(22): warning: static variable unused_variable unused [226]
+platform_long.c(34): warning: static variable unused_variable unused [226]

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.382 src/usr.bin/xlint/lint1/tree.c:1.383
--- src/usr.bin/xlint/lint1/tree.c:1.382	Sat Sep 18 10:46:17 2021
+++ src/usr.bin/xlint/lint1/tree.c	Sun Sep 26 14:52:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.382 2021/09/18 10:46:17 jmcneill Exp $	*/
+/*	$NetBSD: tree.c,v 1.383 2021/09/26 14:52:37 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.382 2021/09/18 10:46:17 jmcneill Exp $");
+__RCSID("$NetBSD: tree.c,v 1.383 2021/09/26 

CVS commit: src

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 14:52:37 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: platform_int.c platform_int.exp
platform_long.c platform_long.exp
src/usr.bin/xlint/lint1: tree.c

Log Message:
tests/lint: explain difference between i386 and sparc for 259

Seen in usr.bin/make/cond.c 1.278 from 2021-09-21, line 800, the call to
is_token, where unsigned char gets converted to unsigned int or unsigned
long, depending on the platform.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/platform_int.c \
src/tests/usr.bin/xlint/lint1/platform_long.c
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/platform_int.exp \
src/tests/usr.bin/xlint/lint1/platform_long.exp
cvs rdiff -u -r1.382 -r1.383 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.



CVS commit: src/sys/arch

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 14:36:48 UTC 2021

Modified Files:
src/sys/arch/mac68k/dev: aed.c
src/sys/arch/macppc/dev: aed.c

Log Message:
Use seltrue_filtops rather than rolling our own with filt_seltrue.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/mac68k/dev/aed.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/macppc/dev/aed.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/mac68k/dev/aed.c
diff -u src/sys/arch/mac68k/dev/aed.c:1.36 src/sys/arch/mac68k/dev/aed.c:1.37
--- src/sys/arch/mac68k/dev/aed.c:1.36	Sun Sep 26 01:16:07 2021
+++ src/sys/arch/mac68k/dev/aed.c	Sun Sep 26 14:36:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: aed.c,v 1.36 2021/09/26 01:16:07 thorpej Exp $	*/
+/*	$NetBSD: aed.c,v 1.37 2021/09/26 14:36:48 thorpej Exp $	*/
 
 /*
  * Copyright (C) 1994	Bradley A. Grantham
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.36 2021/09/26 01:16:07 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.37 2021/09/26 14:36:48 thorpej Exp $");
 
 #include "opt_adb.h"
 
@@ -604,13 +604,6 @@ static const struct filterops aedread_fi
 	.f_event = filt_aedread,
 };
 
-static const struct filterops aed_seltrue_filtops = {
-	.f_flags = FILTEROP_ISFD,
-	.f_attach = NULL,
-	.f_detach = filt_aedrdetach,
-	.f_event = filt_seltrue,
-};
-
 int
 aedkqfilter(dev_t dev, struct knote *kn)
 {
@@ -619,21 +612,18 @@ aedkqfilter(dev_t dev, struct knote *kn)
 	switch (kn->kn_filter) {
 	case EVFILT_READ:
 		kn->kn_fop = _filtops;
+		s = splvm();
+		selrecord_knote(_sc->sc_selinfo, kn);
+		splx(s);
 		break;
 
 	case EVFILT_WRITE:
-		kn->kn_fop = _seltrue_filtops;
+		kn->kn_fop = _filtops;
 		break;
 
 	default:
 		return (1);
 	}
 
-	kn->kn_hook = NULL;
-
-	s = splvm();
-	selrecord_knote(_sc->sc_selinfo, kn);
-	splx(s);
-
 	return (0);
 }

Index: src/sys/arch/macppc/dev/aed.c
diff -u src/sys/arch/macppc/dev/aed.c:1.32 src/sys/arch/macppc/dev/aed.c:1.33
--- src/sys/arch/macppc/dev/aed.c:1.32	Sun Sep 26 01:16:07 2021
+++ src/sys/arch/macppc/dev/aed.c	Sun Sep 26 14:36:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: aed.c,v 1.32 2021/09/26 01:16:07 thorpej Exp $	*/
+/*	$NetBSD: aed.c,v 1.33 2021/09/26 14:36:48 thorpej Exp $	*/
 
 /*
  * Copyright (C) 1994	Bradley A. Grantham
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.32 2021/09/26 01:16:07 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.33 2021/09/26 14:36:48 thorpej Exp $");
 
 #include 
 #include 
@@ -609,13 +609,6 @@ static const struct filterops aedread_fi
 	.f_event = filt_aedread
 };
 
-static const struct filterops aed_seltrue_filtops = {
-	.f_flags = FILTEROP_ISFD,
-	.f_attach = NULL,
-	.f_detach = filt_aedrdetach,
-	.f_event = filt_seltrue
-};
-
 int
 aedkqfilter(dev_t dev, struct knote *kn)
 {
@@ -624,21 +617,18 @@ aedkqfilter(dev_t dev, struct knote *kn)
 	switch (kn->kn_filter) {
 	case EVFILT_READ:
 		kn->kn_fop = _filtops;
+		s = spladb();
+		selrecord_knote(_sc->sc_selinfo, kn);
+		splx(s);
 		break;
 
 	case EVFILT_WRITE:
-		kn->kn_fop = _seltrue_filtops;
+		kn->kn_fop = _filtops;
 		break;
 
 	default:
 		return (1);
 	}
 
-	kn->kn_hook = NULL;
-
-	s = spladb();
-	selrecord_knote(_sc->sc_selinfo, kn);
-	splx(s);
-
 	return (0);
 }



CVS commit: src/sys/arch

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 14:36:48 UTC 2021

Modified Files:
src/sys/arch/mac68k/dev: aed.c
src/sys/arch/macppc/dev: aed.c

Log Message:
Use seltrue_filtops rather than rolling our own with filt_seltrue.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/mac68k/dev/aed.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/macppc/dev/aed.c

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



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

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 14:32:02 UTC 2021

Modified Files:
src/sys/arch/landisk/dev: button.c

Log Message:
Use seltrue_filtops rather than rolling our own with filt_seltrue.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/landisk/dev/button.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/landisk/dev/button.c
diff -u src/sys/arch/landisk/dev/button.c:1.12 src/sys/arch/landisk/dev/button.c:1.13
--- src/sys/arch/landisk/dev/button.c:1.12	Sun Sep 26 01:16:07 2021
+++ src/sys/arch/landisk/dev/button.c	Sun Sep 26 14:32:02 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: button.c,v 1.12 2021/09/26 01:16:07 thorpej Exp $	*/
+/*	$NetBSD: button.c,v 1.13 2021/09/26 14:32:02 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: button.c,v 1.12 2021/09/26 01:16:07 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: button.c,v 1.13 2021/09/26 14:32:02 thorpej Exp $");
 
 #include 
 #include 
@@ -312,13 +312,6 @@ static const struct filterops btn_read_f
 .f_event = filt_btn_read,
 };
 
-static const struct filterops btn_write_filtops = {
-.f_flags = FILTEROP_ISFD,
-.f_attach = NULL,
-.f_detach = filt_btn_rdetach,
-.f_event = filt_seltrue,
-};
-
 int
 btnkqfilter(dev_t dev, struct knote *kn)
 {
@@ -330,20 +323,19 @@ btnkqfilter(dev_t dev, struct knote *kn)
 	switch (kn->kn_filter) {
 	case EVFILT_READ:
 		kn->kn_fop = _read_filtops;
+		mutex_enter(_event_queue_lock);
+		selrecord_knote(_event_queue_selinfo, kn);
+		mutex_exit(_event_queue_lock);
 		break;
 
 	case EVFILT_WRITE:
-		kn->kn_fop = _write_filtops;
+		kn->kn_fop = _filtops;
 		break;
 
 	default:
 		return (1);
 	}
 
-	mutex_enter(_event_queue_lock);
-	selrecord_knote(_event_queue_selinfo, kn);
-	mutex_exit(_event_queue_lock);
-
 	return (0);
 }
 



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

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 14:32:02 UTC 2021

Modified Files:
src/sys/arch/landisk/dev: button.c

Log Message:
Use seltrue_filtops rather than rolling our own with filt_seltrue.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/landisk/dev/button.c

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



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

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 14:28:22 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: platform_ilp32.c platform_ilp32.exp
platform_int.c platform_ldbl128.c platform_ldbl128.exp
platform_ldbl64.c platform_ldbl64.exp platform_ldbl96.c
platform_ldbl96.exp platform_long.c platform_lp64.c
platform_lp64.exp platform_schar.c platform_schar.exp
platform_uchar.c platform_uchar.exp

Log Message:
tests/lint: run all platform tests with the same options


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/platform_ilp32.c \
src/tests/usr.bin/xlint/lint1/platform_ilp32.exp \
src/tests/usr.bin/xlint/lint1/platform_int.c \
src/tests/usr.bin/xlint/lint1/platform_ldbl128.c \
src/tests/usr.bin/xlint/lint1/platform_ldbl128.exp \
src/tests/usr.bin/xlint/lint1/platform_ldbl64.c \
src/tests/usr.bin/xlint/lint1/platform_ldbl64.exp \
src/tests/usr.bin/xlint/lint1/platform_ldbl96.c \
src/tests/usr.bin/xlint/lint1/platform_ldbl96.exp \
src/tests/usr.bin/xlint/lint1/platform_long.c \
src/tests/usr.bin/xlint/lint1/platform_lp64.c \
src/tests/usr.bin/xlint/lint1/platform_lp64.exp \
src/tests/usr.bin/xlint/lint1/platform_schar.c \
src/tests/usr.bin/xlint/lint1/platform_schar.exp \
src/tests/usr.bin/xlint/lint1/platform_uchar.c \
src/tests/usr.bin/xlint/lint1/platform_uchar.exp

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/platform_ilp32.c
diff -u src/tests/usr.bin/xlint/lint1/platform_ilp32.c:1.1 src/tests/usr.bin/xlint/lint1/platform_ilp32.c:1.2
--- src/tests/usr.bin/xlint/lint1/platform_ilp32.c:1.1	Sun Sep 26 03:17:59 2021
+++ src/tests/usr.bin/xlint/lint1/platform_ilp32.c	Sun Sep 26 14:28:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: platform_ilp32.c,v 1.1 2021/09/26 03:17:59 rillig Exp $	*/
+/*	$NetBSD: platform_ilp32.c,v 1.2 2021/09/26 14:28:22 rillig Exp $	*/
 # 3 "platform_ilp32.c"
 
 /*
@@ -6,8 +6,10 @@
  * pointer types.
  */
 
+/* lint1-extra-flags: -c -h -a -p -b -r -z */
 /* lint1-only-if: ilp32 */
 
 // TODO: Add some code that passes.
 // TODO: Add some code that fails.
+
 /* expect+1: warning: empty translation unit [272] */
Index: src/tests/usr.bin/xlint/lint1/platform_ilp32.exp
diff -u src/tests/usr.bin/xlint/lint1/platform_ilp32.exp:1.1 src/tests/usr.bin/xlint/lint1/platform_ilp32.exp:1.2
--- src/tests/usr.bin/xlint/lint1/platform_ilp32.exp:1.1	Sun Sep 26 03:17:59 2021
+++ src/tests/usr.bin/xlint/lint1/platform_ilp32.exp	Sun Sep 26 14:28:22 2021
@@ -1 +1 @@
-platform_ilp32.c(14): warning: empty translation unit [272]
+platform_ilp32.c(16): warning: empty translation unit [272]
Index: src/tests/usr.bin/xlint/lint1/platform_int.c
diff -u src/tests/usr.bin/xlint/lint1/platform_int.c:1.1 src/tests/usr.bin/xlint/lint1/platform_int.c:1.2
--- src/tests/usr.bin/xlint/lint1/platform_int.c:1.1	Sun Sep 26 03:17:59 2021
+++ src/tests/usr.bin/xlint/lint1/platform_int.c	Sun Sep 26 14:28:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: platform_int.c,v 1.1 2021/09/26 03:17:59 rillig Exp $	*/
+/*	$NetBSD: platform_int.c,v 1.2 2021/09/26 14:28:22 rillig Exp $	*/
 # 3 "platform_int.c"
 
 /*
@@ -6,7 +6,7 @@
  * int and ptr_diff is signed int.
  */
 
-/* lint1-extra-flags: -h */
+/* lint1-extra-flags: -c -h -a -p -b -r -z */
 /* lint1-only-if: int */
 
 void to_size(typeof(sizeof(int)));
Index: src/tests/usr.bin/xlint/lint1/platform_ldbl128.c
diff -u src/tests/usr.bin/xlint/lint1/platform_ldbl128.c:1.1 src/tests/usr.bin/xlint/lint1/platform_ldbl128.c:1.2
--- src/tests/usr.bin/xlint/lint1/platform_ldbl128.c:1.1	Sun Sep 26 03:17:59 2021
+++ src/tests/usr.bin/xlint/lint1/platform_ldbl128.c	Sun Sep 26 14:28:22 2021
@@ -1,12 +1,14 @@
-/*	$NetBSD: platform_ldbl128.c,v 1.1 2021/09/26 03:17:59 rillig Exp $	*/
+/*	$NetBSD: platform_ldbl128.c,v 1.2 2021/09/26 14:28:22 rillig Exp $	*/
 # 3 "platform_ldbl128.c"
 
 /*
  * Test features that only apply to platforms that have 128-bit long double.
  */
 
+/* lint1-extra-flags: -c -h -a -p -b -r -z */
 /* lint1-only-if: ldbl-128 */
 
 // TODO: Add some code that passes.
 // TODO: Add some code that fails.
+
 /* expect+1: warning: empty translation unit [272] */
Index: src/tests/usr.bin/xlint/lint1/platform_ldbl128.exp
diff -u src/tests/usr.bin/xlint/lint1/platform_ldbl128.exp:1.1 src/tests/usr.bin/xlint/lint1/platform_ldbl128.exp:1.2
--- src/tests/usr.bin/xlint/lint1/platform_ldbl128.exp:1.1	Sun Sep 26 03:17:59 2021
+++ src/tests/usr.bin/xlint/lint1/platform_ldbl128.exp	Sun Sep 26 14:28:22 2021
@@ -1 +1 @@
-platform_ldbl128.c(13): warning: empty translation unit [272]
+platform_ldbl128.c(15): warning: empty translation unit [272]
Index: src/tests/usr.bin/xlint/lint1/platform_ldbl64.c
diff -u src/tests/usr.bin/xlint/lint1/platform_ldbl64.c:1.1 

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

2021-09-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 26 14:28:22 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: platform_ilp32.c platform_ilp32.exp
platform_int.c platform_ldbl128.c platform_ldbl128.exp
platform_ldbl64.c platform_ldbl64.exp platform_ldbl96.c
platform_ldbl96.exp platform_long.c platform_lp64.c
platform_lp64.exp platform_schar.c platform_schar.exp
platform_uchar.c platform_uchar.exp

Log Message:
tests/lint: run all platform tests with the same options


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/platform_ilp32.c \
src/tests/usr.bin/xlint/lint1/platform_ilp32.exp \
src/tests/usr.bin/xlint/lint1/platform_int.c \
src/tests/usr.bin/xlint/lint1/platform_ldbl128.c \
src/tests/usr.bin/xlint/lint1/platform_ldbl128.exp \
src/tests/usr.bin/xlint/lint1/platform_ldbl64.c \
src/tests/usr.bin/xlint/lint1/platform_ldbl64.exp \
src/tests/usr.bin/xlint/lint1/platform_ldbl96.c \
src/tests/usr.bin/xlint/lint1/platform_ldbl96.exp \
src/tests/usr.bin/xlint/lint1/platform_long.c \
src/tests/usr.bin/xlint/lint1/platform_lp64.c \
src/tests/usr.bin/xlint/lint1/platform_lp64.exp \
src/tests/usr.bin/xlint/lint1/platform_schar.c \
src/tests/usr.bin/xlint/lint1/platform_schar.exp \
src/tests/usr.bin/xlint/lint1/platform_uchar.c \
src/tests/usr.bin/xlint/lint1/platform_uchar.exp

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



CVS commit: src/lib/libedit

2021-09-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Sep 26 13:45:54 UTC 2021

Modified Files:
src/lib/libedit: filecomplete.h

Log Message:
make flag unsigned to match prototype of the function used


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/libedit/filecomplete.h

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

Modified files:

Index: src/lib/libedit/filecomplete.h
diff -u src/lib/libedit/filecomplete.h:1.13 src/lib/libedit/filecomplete.h:1.14
--- src/lib/libedit/filecomplete.h:1.13	Sun Mar 28 09:38:10 2021
+++ src/lib/libedit/filecomplete.h	Sun Sep 26 09:45:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: filecomplete.h,v 1.13 2021/03/28 13:38:10 christos Exp $	*/
+/*	$NetBSD: filecomplete.h,v 1.14 2021/09/26 13:45:54 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@ int fn_complete2(EditLine *,
 char **(*)(const char *, int, int),
 const wchar_t *, const wchar_t *, const char *(*)(const char *), size_t,
 int *, int *, int *, int *, unsigned int);
-#define FN_QUOTE_MATCH 1		/* Quote the returned match */
+#define FN_QUOTE_MATCH 1U		/* Quote the returned match */
 
 void fn_display_match_list(EditLine *, char **, size_t, size_t,
 	const char *(*)(const char *));



CVS commit: src/lib/libedit

2021-09-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Sep 26 13:45:54 UTC 2021

Modified Files:
src/lib/libedit: filecomplete.h

Log Message:
make flag unsigned to match prototype of the function used


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/libedit/filecomplete.h

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



CVS commit: src/lib/libedit

2021-09-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Sep 26 13:45:37 UTC 2021

Modified Files:
src/lib/libedit: filecomplete.c

Log Message:
- Completion should not add a quote at the end of the line to match an
  already quoted quote. (Piotr Stefaniak)
- fix lint unconst warnings for strchr


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/lib/libedit/filecomplete.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/libedit/filecomplete.c
diff -u src/lib/libedit/filecomplete.c:1.68 src/lib/libedit/filecomplete.c:1.69
--- src/lib/libedit/filecomplete.c:1.68	Wed May  5 10:49:59 2021
+++ src/lib/libedit/filecomplete.c	Sun Sep 26 09:45:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: filecomplete.c,v 1.68 2021/05/05 14:49:59 christos Exp $	*/
+/*	$NetBSD: filecomplete.c,v 1.69 2021/09/26 13:45:37 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: filecomplete.c,v 1.68 2021/05/05 14:49:59 christos Exp $");
+__RCSID("$NetBSD: filecomplete.c,v 1.69 2021/09/26 13:45:37 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include 
@@ -69,20 +69,21 @@ fn_tilde_expand(const char *txt)
 	char pwbuf[1024];
 #endif
 	struct passwd *pass;
+	const char *pos;
 	char *temp;
 	size_t len = 0;
 
 	if (txt[0] != '~')
 		return strdup(txt);
 
-	temp = strchr(txt + 1, '/');
-	if (temp == NULL) {
+	pos = strchr(txt + 1, '/');
+	if (pos == NULL) {
 		temp = strdup(txt + 1);
 		if (temp == NULL)
 			return NULL;
 	} else {
 		/* text until string after slash */
-		len = (size_t)(temp - txt + 1);
+		len = (size_t)(pos - txt + 1);
 		temp = el_calloc(len, sizeof(*temp));
 		if (temp == NULL)
 			return NULL;
@@ -212,9 +213,10 @@ escape_filename(EditLine * el, const cha
 	while (temp != el->el_line.cursor) {
 		/*
 		 * If we see a single quote but have not seen a double quote
-		 * so far set/unset s_quote
+		 * so far set/unset s_quote, unless it is already quoted
 		 */
-		if (temp[0] == '\'' && !d_quoted)
+		if (temp[0] == '\'' && !d_quoted &&
+		(temp == el->el_line.buffer || temp[-1] != '\\'))
 			s_quoted = !s_quoted;
 		/*
 		 * vice versa to the above condition
@@ -327,14 +329,15 @@ fn_filename_completion_function(const ch
 	static size_t filename_len = 0;
 	struct dirent *entry;
 	char *temp;
+	const char *pos;
 	size_t len;
 
 	if (state == 0 || dir == NULL) {
-		temp = strrchr(text, '/');
-		if (temp) {
+		pos = strrchr(text, '/');
+		if (pos) {
 			char *nptr;
-			temp++;
-			nptr = el_realloc(filename, (strlen(temp) + 1) *
+			pos++;
+			nptr = el_realloc(filename, (strlen(pos) + 1) *
 			sizeof(*nptr));
 			if (nptr == NULL) {
 el_free(filename);
@@ -342,8 +345,8 @@ fn_filename_completion_function(const ch
 return NULL;
 			}
 			filename = nptr;
-			(void)strcpy(filename, temp);
-			len = (size_t)(temp - text);	/* including last slash */
+			(void)strcpy(filename, pos);
+			len = (size_t)(pos - text);	/* including last slash */
 
 			nptr = el_realloc(dirname, (len + 1) *
 			sizeof(*nptr));



CVS commit: src/lib/libedit

2021-09-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Sep 26 13:45:37 UTC 2021

Modified Files:
src/lib/libedit: filecomplete.c

Log Message:
- Completion should not add a quote at the end of the line to match an
  already quoted quote. (Piotr Stefaniak)
- fix lint unconst warnings for strchr


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/lib/libedit/filecomplete.c

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



CVS commit: src/sys/arch/luna68k/include

2021-09-26 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Sep 26 13:43:30 UTC 2021

Modified Files:
src/sys/arch/luna68k/include: board.h

Log Message:
TAB/space cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/luna68k/include/board.h

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

Modified files:

Index: src/sys/arch/luna68k/include/board.h
diff -u src/sys/arch/luna68k/include/board.h:1.1 src/sys/arch/luna68k/include/board.h:1.2
--- src/sys/arch/luna68k/include/board.h:1.1	Sun Jun 30 05:04:48 2019
+++ src/sys/arch/luna68k/include/board.h	Sun Sep 26 13:43:30 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: board.h,v 1.1 2019/06/30 05:04:48 tsutsui Exp $	*/
+/*	$NetBSD: board.h,v 1.2 2021/09/26 13:43:30 tsutsui Exp $	*/
 /*	$OpenBSD: board.h,v 1.15 2017/11/03 06:55:08 aoyama Exp $	*/
 /*
  * Mach Operating System
@@ -46,72 +46,72 @@
 #define U(num)  num/**/U
 #endif
 
-#define PROM_ADDR	U(0x4100) 	/* PROM */
-#define PROM_SPACE	U(0x0004) 
-#define NVRAM_ADDR	U(0x4500) 	/* Non Volatile */
-#define NVRAM_SPACE	U(0x1FDC) 
-#define	FUSE_ROM_ADDR	U(0x4300) 	/* FUSE_ROM */
-#define	FUSE_ROM_SPACE	1024
-#define	OBIO_CLOCK_BASE	U(0x4500) 	/* Mostek or Dallas TimeKeeper */
-#define OBIO_PIO0_BASE	U(0x4900) 	/* PIO-0 */
-#define OBIO_PIO0_SPACE	U(0x0004) 
-#define OBIO_PIO0A	U(0x4900) 	/* PIO-0 port A */
-#define OBIO_PIO0B	U(0x4901) 	/* PIO-0 port B */
-#define OBIO_PIO0C	U(0x4902) 	/* PIO-0 port C*/
-#define OBIO_PIO0	U(0x4903) 	/* PIO-0 control */
-#define OBIO_PIO1_BASE	U(0x4D00) 	/* PIO-1 */
-#define OBIO_PIO1_SPACE U(0x0004) 
-#define OBIO_PIO1A	U(0x4D00) 	/* PIO-1 port A */
-#define OBIO_PIO1B	U(0x4D01) 	/* PIO-1 port B */
-#define OBIO_PIO1C	U(0x4D02) 	/* PIO-1 port C*/
-#define OBIO_PIO1	U(0x4D03) 	/* PIO-1 control */
-#define OBIO_SIO	U(0x5100) 	/* SIO */
-#define	OBIO_TAS	U(0x6100) 	/* TAS register */
-#define	OBIO_CLOCK	U(0x6300) 	/* system clock */
+#define PROM_ADDR	U(0x4100)	/* PROM */
+#define PROM_SPACE	U(0x0004)
+#define NVRAM_ADDR	U(0x4500)	/* Non Volatile */
+#define NVRAM_SPACE	U(0x1FDC)
+#define FUSE_ROM_ADDR	U(0x4300)	/* FUSE_ROM */
+#define FUSE_ROM_SPACE	1024
+#define OBIO_CLOCK_BASE	U(0x4500)	/* Mostek or Dallas TimeKeeper */
+#define OBIO_PIO0_BASE	U(0x4900)	/* PIO-0 */
+#define OBIO_PIO0_SPACE	U(0x0004)
+#define OBIO_PIO0A	U(0x4900)	/* PIO-0 port A */
+#define OBIO_PIO0B	U(0x4901)	/* PIO-0 port B */
+#define OBIO_PIO0C	U(0x4902)	/* PIO-0 port C*/
+#define OBIO_PIO0	U(0x4903)	/* PIO-0 control */
+#define OBIO_PIO1_BASE	U(0x4D00)	/* PIO-1 */
+#define OBIO_PIO1_SPACE U(0x0004)
+#define OBIO_PIO1A	U(0x4D00)	/* PIO-1 port A */
+#define OBIO_PIO1B	U(0x4D01)	/* PIO-1 port B */
+#define OBIO_PIO1C	U(0x4D02)	/* PIO-1 port C*/
+#define OBIO_PIO1	U(0x4D03)	/* PIO-1 control */
+#define OBIO_SIO	U(0x5100)	/* SIO */
+#define OBIO_TAS	U(0x6100)	/* TAS register */
+#define OBIO_CLOCK	U(0x6300)	/* system clock */
 
-#define TRI_PORT_RAM	U(0x7100) 	/* 3 port RAM */
+#define TRI_PORT_RAM	U(0x7100)	/* 3 port RAM */
 #define TRI_PORT_RAM_SPACE	0x2
-#define EXT_A_ADDR	U(0x8100) 	/* extension board A */
-#define EXT_A_SPACE	U(0x0200) 
-#define EXT_B_ADDR	U(0x8300) 	/* extension board B */
-#define EXT_B_SPACE	U(0x0100) 
-#define	PC_BASE		U(0x9000) 	/* pc-98 extension board */
-#define	PC_SPACE	U(0x0200) 
+#define EXT_A_ADDR	U(0x8100)	/* extension board A */
+#define EXT_A_SPACE	U(0x0200)
+#define EXT_B_ADDR	U(0x8300)	/* extension board B */
+#define EXT_B_SPACE	U(0x0100)
+#define PC_BASE		U(0x9000)	/* pc-98 extension board */
+#define PC_SPACE	U(0x0200)
 
-#define MROM_ADDR	U(0xA100) 	/* Mask ROM address */
+#define MROM_ADDR	U(0xA100)	/* Mask ROM address */
 #define MROM_SPACE		0x40
-#define	BMAP_START	U(0xB100) 	/* Bitmap start address */
-#define	BMAP_SPACE	(BMAP_END - BMAP_START)
-#define BMAP_RFCNT	U(0xB100) 	/* RFCNT register */
-#define BMAP_BMSEL	U(0xB104) 	/* BMSEL register */
-#define BMAP_BMP	U(0xB108) 	/* common bitmap plane */
-#define BMAP_BMAP0	U(0xB10C) 	/* bitmap plane 0 */
-#define BMAP_BMAP1	U(0xB110) 	/* bitmap plane 1 */
-#define BMAP_BMAP2	U(0xB114) 	/* bitmap plane 2 */
-#define BMAP_BMAP3	U(0xB118) 	/* bitmap plane 3 */
-#define BMAP_BMAP4	U(0xB11C) 	/* bitmap plane 4 */
-#define BMAP_BMAP5	U(0xB120) 	/* bitmap plane 5 */
-#define BMAP_BMAP6	U(0xB124) 	/* bitmap plane 6 */
-#define BMAP_BMAP7	U(0xB128) 	/* bitmap plane 7 */
-#define BMAP_FN		U(0xB12C) 	/* common bitmap function */
-#define BMAP_FN0	U(0xB130) 	/* bitmap function 0 */
-#define BMAP_FN1	U(0xB134) 	/* bitmap function 1 */
-#define BMAP_FN2	U(0xB138) 	/* bitmap function 2 */
-#define BMAP_FN3	U(0xB13C) 	/* 

CVS commit: src/sys/arch/luna68k/include

2021-09-26 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Sep 26 13:43:30 UTC 2021

Modified Files:
src/sys/arch/luna68k/include: board.h

Log Message:
TAB/space cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/luna68k/include/board.h

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



CVS commit: src/sys/arch/arm

2021-09-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep 26 13:38:50 UTC 2021

Modified Files:
src/sys/arch/arm/cortex: gic.c gicv3.c
src/sys/arch/arm/pic: pic.c picvar.h

Log Message:
If an SGI or PPI is established after interrupts are enabled, make sure
we unblock the source on _all_ CPUs and not just the CPU that is
establishing the interrupt.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/arm/cortex/gic.c
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/arm/cortex/gicv3.c
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/arm/pic/pic.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/arm/pic/picvar.h

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

Modified files:

Index: src/sys/arch/arm/cortex/gic.c
diff -u src/sys/arch/arm/cortex/gic.c:1.49 src/sys/arch/arm/cortex/gic.c:1.50
--- src/sys/arch/arm/cortex/gic.c:1.49	Tue Aug 10 17:12:31 2021
+++ src/sys/arch/arm/cortex/gic.c	Sun Sep 26 13:38:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: gic.c,v 1.49 2021/08/10 17:12:31 jmcneill Exp $	*/
+/*	$NetBSD: gic.c,v 1.50 2021/09/26 13:38:50 jmcneill Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -35,7 +35,7 @@
 #define _INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.49 2021/08/10 17:12:31 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.50 2021/09/26 13:38:50 jmcneill Exp $");
 
 #include 
 #include 
@@ -462,6 +462,7 @@ armgic_establish_irq(struct pic_softc *p
 		 * default.
 		 */
 		is->is_mpsafe = true;
+		is->is_percpu = true;
 #endif
 	}
 

Index: src/sys/arch/arm/cortex/gicv3.c
diff -u src/sys/arch/arm/cortex/gicv3.c:1.47 src/sys/arch/arm/cortex/gicv3.c:1.48
--- src/sys/arch/arm/cortex/gicv3.c:1.47	Sat Sep 11 01:49:11 2021
+++ src/sys/arch/arm/cortex/gicv3.c	Sun Sep 26 13:38:50 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3.c,v 1.47 2021/09/11 01:49:11 jmcneill Exp $ */
+/* $NetBSD: gicv3.c,v 1.48 2021/09/26 13:38:50 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -32,7 +32,7 @@
 #define	_INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.47 2021/09/11 01:49:11 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.48 2021/09/26 13:38:50 jmcneill Exp $");
 
 #include 
 #include 
@@ -185,8 +185,9 @@ gicv3_establish_irq(struct pic_softc *pi
 	const u_int icfg_shift = (is->is_irq & 0xf) * 2;
 
 	if (group == 0) {
-		/* SGIs and PPIs are always MP-safe */
+		/* SGIs and PPIs are per-CPU and always MP-safe */
 		is->is_mpsafe = true;
+		is->is_percpu = true;
 
 		/* Update interrupt configuration and priority on all redistributors */
 		for (n = 0; n < sc->sc_bsh_r_count; n++) {

Index: src/sys/arch/arm/pic/pic.c
diff -u src/sys/arch/arm/pic/pic.c:1.71 src/sys/arch/arm/pic/pic.c:1.72
--- src/sys/arch/arm/pic/pic.c:1.71	Sun Aug  8 19:28:08 2021
+++ src/sys/arch/arm/pic/pic.c	Sun Sep 26 13:38:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pic.c,v 1.71 2021/08/08 19:28:08 skrll Exp $	*/
+/*	$NetBSD: pic.c,v 1.72 2021/09/26 13:38:49 jmcneill Exp $	*/
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -33,7 +33,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.71 2021/08/08 19:28:08 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.72 2021/09/26 13:38:49 jmcneill Exp $");
 
 #include 
 #include 
@@ -704,6 +704,16 @@ pic_percpu_evcnt_attach(void *v0, void *
 	pcpu->pcpu_name, is->is_source);
 }
 
+static void
+pic_unblock_percpu(void *arg1, void *arg2)
+{
+	struct pic_softc *pic = arg1;
+	struct intrsource *is = arg2;
+
+	(*pic->pic_ops->pic_unblock_irqs)(pic, is->is_irq & ~0x1f,
+	__BIT(is->is_irq & 0x1f));
+}
+
 void *
 pic_establish_intr(struct pic_softc *pic, int irq, int ipl, int type,
 	int (*func)(void *), void *arg, const char *xname)
@@ -780,8 +790,13 @@ pic_establish_intr(struct pic_softc *pic
 	(*pic->pic_ops->pic_establish_irq)(pic, is);
 
 unblock:
-	(*pic->pic_ops->pic_unblock_irqs)(pic, is->is_irq & ~0x1f,
-	__BIT(is->is_irq & 0x1f));
+	if (cold || !is->is_mpsafe) {
+		(*pic->pic_ops->pic_unblock_irqs)(pic, is->is_irq & ~0x1f,
+		__BIT(is->is_irq & 0x1f));
+	} else {
+		uint64_t xc = xc_broadcast(0, pic_unblock_percpu, pic, is);
+		xc_wait(xc);
+	}
 
 	if (xname) {
 		if (is->is_xname == NULL)

Index: src/sys/arch/arm/pic/picvar.h
diff -u src/sys/arch/arm/pic/picvar.h:1.36 src/sys/arch/arm/pic/picvar.h:1.37
--- src/sys/arch/arm/pic/picvar.h:1.36	Mon Sep 20 21:05:15 2021
+++ src/sys/arch/arm/pic/picvar.h	Sun Sep 26 13:38:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: picvar.h,v 1.36 2021/09/20 21:05:15 jmcneill Exp $	*/
+/*	$NetBSD: picvar.h,v 1.37 2021/09/26 13:38:49 jmcneill Exp $	*/
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -128,6 +128,7 @@ struct intrsource {
 	char is_source[16];
 	char *is_xname;
 	uint32_t is_mask_count;
+	bool is_percpu;
 };
 
 struct pic_percpu {



CVS commit: src/sys/arch/arm

2021-09-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep 26 13:38:50 UTC 2021

Modified Files:
src/sys/arch/arm/cortex: gic.c gicv3.c
src/sys/arch/arm/pic: pic.c picvar.h

Log Message:
If an SGI or PPI is established after interrupts are enabled, make sure
we unblock the source on _all_ CPUs and not just the CPU that is
establishing the interrupt.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/arm/cortex/gic.c
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/arm/cortex/gicv3.c
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/arm/pic/pic.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/arm/pic/picvar.h

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



CVS commit: src/sys/dev/tprof

2021-09-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep 26 13:37:36 UTC 2021

Modified Files:
src/sys/dev/tprof: tprof_armv8.c

Log Message:
Make sure setup happens on all CPUs.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/tprof/tprof_armv8.c

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

Modified files:

Index: src/sys/dev/tprof/tprof_armv8.c
diff -u src/sys/dev/tprof/tprof_armv8.c:1.6 src/sys/dev/tprof/tprof_armv8.c:1.7
--- src/sys/dev/tprof/tprof_armv8.c:1.6	Fri Oct 30 18:54:37 2020
+++ src/sys/dev/tprof/tprof_armv8.c	Sun Sep 26 13:37:36 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: tprof_armv8.c,v 1.6 2020/10/30 18:54:37 skrll Exp $ */
+/* $NetBSD: tprof_armv8.c,v 1.7 2021/09/26 13:37:36 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tprof_armv8.c,v 1.6 2020/10/30 18:54:37 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tprof_armv8.c,v 1.7 2021/09/26 13:37:36 jmcneill Exp $");
 
 #include 
 #include 
@@ -111,6 +111,7 @@ armv8_pmu_start_cpu(void *arg1, void *ar
 
 	/* Enable event counter */
 	reg_pmcntenset_el0_write(counter_mask);
+	reg_pmcr_el0_write(PMCR_E);
 }
 
 static void
@@ -123,6 +124,7 @@ armv8_pmu_stop_cpu(void *arg1, void *arg
 
 	/* Disable event counter */
 	reg_pmcntenclr_el0_write(counter_mask);
+	reg_pmcr_el0_write(0);
 }
 
 static uint64_t
@@ -130,16 +132,11 @@ armv8_pmu_estimate_freq(void)
 {
 	uint64_t cpufreq = curcpu()->ci_data.cpu_cc_freq;
 	uint64_t freq = 1;
-	uint32_t pmcr;
 
 	counter_val = cpufreq / freq;
 	if (counter_val == 0)
 		counter_val = 40ULL / freq;
 
-	pmcr = reg_pmcr_el0_read();
-	if (pmcr & PMCR_D)
-		counter_val /= 64;
-
 	return freq;
 }
 
@@ -206,9 +203,9 @@ armv8_pmu_intr(void *priv)
 	return 1;
 }
 
-int
-armv8_pmu_init(void)
-{
+static void
+armv8_pmu_init_cpu(void *arg1, void *arg2)
+{	
 	/* Disable EL0 access to performance monitors */
 	reg_pmuserenr_el0_write(0);
 
@@ -217,6 +214,15 @@ armv8_pmu_init(void)
 
 	/* Disable event counters */
 	reg_pmcntenclr_el0_write(PMCNTEN_P);
+}
+
+int
+armv8_pmu_init(void)
+{
+	uint64_t xc;
+
+	xc = xc_broadcast(0, armv8_pmu_init_cpu, NULL, NULL);
+	xc_wait(xc);
 
 	return tprof_backend_register("tprof_armv8", _armv8_pmu_ops,
 	TPROF_BACKEND_VERSION);



CVS commit: src/sys/dev/tprof

2021-09-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep 26 13:37:36 UTC 2021

Modified Files:
src/sys/dev/tprof: tprof_armv8.c

Log Message:
Make sure setup happens on all CPUs.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/tprof/tprof_armv8.c

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



CVS commit: src/share/man/man8

2021-09-26 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sun Sep 26 11:22:29 UTC 2021

Modified Files:
src/share/man/man8: compat_linux.8

Log Message:
Update remarks on Linux-flavored procfs.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/share/man/man8/compat_linux.8

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

Modified files:

Index: src/share/man/man8/compat_linux.8
diff -u src/share/man/man8/compat_linux.8:1.43 src/share/man/man8/compat_linux.8:1.44
--- src/share/man/man8/compat_linux.8:1.43	Thu Sep 23 09:07:39 2021
+++ src/share/man/man8/compat_linux.8	Sun Sep 26 11:22:29 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: compat_linux.8,v 1.43 2021/09/23 09:07:39 ryo Exp $
+.\"	$NetBSD: compat_linux.8,v 1.44 2021/09/26 11:22:29 nia Exp $
 .\"
 .\" Copyright (c) 1995 Frank van der Linden
 .\" All rights reserved.
@@ -29,7 +29,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd September 23, 2021
+.Dd September 26, 2021
 .Dt COMPAT_LINUX 8
 .Os
 .Sh NAME
@@ -165,16 +165,23 @@ Mount procfs on
 .Nx
 using following command:
 .Bl -tag -width 123 -offset indent
-.It $ mount_procfs -o linux procfs /emul/linux/proc
+.It $ mount_procfs procfs /emul/linux/proc
 .El
 .Pp
 You can also set up your system so that procfs is mounted automatically
 on system boot, by putting an entry like the one below to
 .Pa /etc/fstab .
 .Bl -tag -width 123 -offset indent
-.It procfs /emul/linux/proc procfs ro,linux
+.It procfs /emul/linux/proc procfs ro
 .El
 .Pp
+Note: 
+.Xr mount_procfs 8
+defaults to Linux flavored procfs since
+.Nx 5.0 .
+Ensure you do not mount procfs with
+.Ar nolinux .
+.Pp
 See
 .Xr mount_procfs 8
 for further information.



CVS commit: src/share/man/man8

2021-09-26 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sun Sep 26 11:22:29 UTC 2021

Modified Files:
src/share/man/man8: compat_linux.8

Log Message:
Update remarks on Linux-flavored procfs.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/share/man/man8/compat_linux.8

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



CVS commit: src/etc/rc.d

2021-09-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 26 10:53:20 UTC 2021

Modified Files:
src/etc/rc.d: sshd

Log Message:
If key generation happens with not enough entropy in the system, add
a warning to motd pointing at entropy(7) and give instructions how to
re-generate the (weak) keys after fixing up entropy.

Add a "keyregen" command, which forces regeneration of all host keys
to simplify the replacement of weak keys.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/etc/rc.d/sshd

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

Modified files:

Index: src/etc/rc.d/sshd
diff -u src/etc/rc.d/sshd:1.30 src/etc/rc.d/sshd:1.31
--- src/etc/rc.d/sshd:1.30	Wed Oct 23 14:45:38 2019
+++ src/etc/rc.d/sshd	Sun Sep 26 10:53:20 2021
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: sshd,v 1.30 2019/10/23 14:45:38 christos Exp $
+# $NetBSD: sshd,v 1.31 2021/09/26 10:53:20 martin Exp $
 #
 
 # PROVIDE: sshd
@@ -13,7 +13,32 @@ rcvar=$name
 command="/usr/sbin/${name}"
 pidfile="/var/run/${name}.pid"
 required_files="/etc/ssh/sshd_config"
-extra_commands="keygen reload"
+extra_commands="keygen keyregen reload"
+
+sshd_motd_unsafe_keys_warning()
+{
+(
+	umask 022
+	T=/etc/_motd
+	sed -E '/^-- UNSAFE KEYS WARNING:/,$d' < /etc/motd > $T
+	if [ $( sysctl -n kern.entropy.needed ) -ne 0 ]; then
+		cat >> $T << _EOF
+-- UNSAFE KEYS WARNING:
+
+	The ssh host keys on this machine have been generated with
+	not enough entropy configured, so may be predictable.
+
+	To fix, follow the "Adding entropy" section in the entropy(7)
+	man page and after this machine has enough entropy, re-generate
+	the ssh host keys by running:
+
+		sh /etc/rc.d/sshd keyregen
+_EOF
+	fi
+	cmp -s $T /etc/motd || cp $T /etc/motd
+	rm -f $T
+)
+}
 
 sshd_keygen()
 {
@@ -22,9 +47,10 @@ sshd_keygen()
 	umask 022
 	while read type bits filename;  do
 		f="/etc/ssh/$filename"
-		if [ -f "$f" ]; then
+		if [ "$1" != "force" ] && [ -f "$f" ]; then
 			continue
 		fi
+		rm -f "$f"
 		case "${bits}" in
 		-1)	bitarg=;;
 		0)	bitarg="${ssh_keygen_flags}";;
@@ -39,6 +65,7 @@ ed25519	-1	ssh_host_ed25519_key
 rsa	0	ssh_host_rsa_key
 _EOF
 )
+	sshd_motd_unsafe_keys_warning
 }
 
 sshd_precmd()
@@ -47,6 +74,7 @@ sshd_precmd()
 }
 
 keygen_cmd=sshd_keygen
+keyregen_cmd="sshd_keygen force"
 start_precmd=sshd_precmd
 
 load_rc_config $name



CVS commit: src/etc/rc.d

2021-09-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 26 10:53:20 UTC 2021

Modified Files:
src/etc/rc.d: sshd

Log Message:
If key generation happens with not enough entropy in the system, add
a warning to motd pointing at entropy(7) and give instructions how to
re-generate the (weak) keys after fixing up entropy.

Add a "keyregen" command, which forces regeneration of all host keys
to simplify the replacement of weak keys.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/etc/rc.d/sshd

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



CVS commit: src/sys/arch/aarch64/aarch64

2021-09-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep 26 09:58:13 UTC 2021

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

Log Message:
Use UVMHIST_CALLARGS


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/arch/aarch64/aarch64/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/aarch64/aarch64/pmap.c
diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.114 src/sys/arch/aarch64/aarch64/pmap.c:1.115
--- src/sys/arch/aarch64/aarch64/pmap.c:1.114	Sun Sep 26 08:04:35 2021
+++ src/sys/arch/aarch64/aarch64/pmap.c	Sun Sep 26 09:58:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.114 2021/09/26 08:04:35 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.115 2021/09/26 09:58:13 skrll Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.114 2021/09/26 08:04:35 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.115 2021/09/26 09:58:13 skrll Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -578,9 +578,7 @@ pmap_steal_memory(vsize_t size, vaddr_t 
 	uvm_physseg_t bank;
 
 	UVMHIST_FUNC(__func__);
-	UVMHIST_CALLED(pmaphist);
-
-	UVMHIST_LOG(pmaphist, "size=%llu, *vstartp=%llx, *vendp=%llx",
+	UVMHIST_CALLARGS(pmaphist, "size=%llu, *vstartp=%llx, *vendp=%llx",
 	size, *vstartp, *vendp, 0);
 
 	size = round_page(size);
@@ -623,7 +621,8 @@ pmap_alloc_pdp(struct pmap *pm, struct v
 	struct vm_page *pg;
 
 	UVMHIST_FUNC(__func__);
-	UVMHIST_CALLED(pmaphist);
+	UVMHIST_CALLARGS(pmaphist, "pm=%p, flags=%08x, waitok=%d",
+	pm, flags, waitok, 0);
 
 	if (uvm.page_init_done) {
 		int aflags = ((flags & PMAP_CANFAIL) ? 0 : UVM_PGA_USERESERVE) |
@@ -755,9 +754,7 @@ pmap_growkernel(vaddr_t maxkvaddr)
 	paddr_t pa;
 
 	UVMHIST_FUNC(__func__);
-	UVMHIST_CALLED(pmaphist);
-
-	UVMHIST_LOG(pmaphist, "maxkvaddr=%llx, pmap_maxkvaddr=%llx",
+	UVMHIST_CALLARGS(pmaphist, "maxkvaddr=%llx, pmap_maxkvaddr=%llx",
 	maxkvaddr, pmap_maxkvaddr, 0, 0);
 
 	mutex_enter(>pm_lock);
@@ -1109,9 +1106,7 @@ _pmap_remove_pv(struct pmap_page *pp, st
 	struct pv_entry *pv, *ppv;
 
 	UVMHIST_FUNC(__func__);
-	UVMHIST_CALLED(pmaphist);
-
-	UVMHIST_LOG(pmaphist, "pp=%p, pm=%p, va=%llx, pte=%llx",
+	UVMHIST_CALLARGS(pmaphist, "pp=%p, pm=%p, va=%llx, pte=%llx",
 	pp, pm, va, pte);
 
 	KASSERT(mutex_owned(>pm_lock));	/* for pv_proc */
@@ -1204,9 +1199,8 @@ _pmap_enter_pv(struct pmap_page *pp, str
 	struct pv_entry *pv;
 
 	UVMHIST_FUNC(__func__);
-	UVMHIST_CALLED(pmaphist);
-
-	UVMHIST_LOG(pmaphist, "pp=%p, pm=%p, va=%llx, pa=%llx", pp, pm, va, pa);
+	UVMHIST_CALLARGS(pmaphist, "pp=%p, pm=%p, va=%llx, pa=%llx", pp, pm, va,
+	pa);
 	UVMHIST_LOG(pmaphist, "ptep=%p, flags=%08x", ptep, flags, 0, 0);
 
 	KASSERT(mutex_owned(>pp_pvlock));
@@ -1263,9 +1257,7 @@ pmap_kremove(vaddr_t va, vsize_t size)
 	struct pmap *kpm = pmap_kernel();
 
 	UVMHIST_FUNC(__func__);
-	UVMHIST_CALLED(pmaphist);
-
-	UVMHIST_LOG(pmaphist, "va=%llx, size=%llx", va, size, 0, 0);
+	UVMHIST_CALLARGS(pmaphist, "va=%llx, size=%llx", va, size, 0, 0);
 
 	KDASSERT((va & PGOFSET) == 0);
 	KDASSERT((size & PGOFSET) == 0);
@@ -1285,9 +1277,8 @@ _pmap_protect_pv(struct pmap_page *pp, s
 	const bool user = (pv->pv_pmap != pmap_kernel());
 
 	UVMHIST_FUNC(__func__);
-	UVMHIST_CALLED(pmaphist);
+	UVMHIST_CALLARGS(pmaphist, "pp=%p, pv=%p, prot=%08x", pp, pv, prot, 0);
 
-	UVMHIST_LOG(pmaphist, "pp=%p, pv=%p, prot=%08x", pp, pv, prot, 0);
 	KASSERT(mutex_owned(>pv_pmap->pm_lock));
 
 	/* get prot mask from referenced/modified */
@@ -1322,9 +1313,7 @@ pmap_protect(struct pmap *pm, vaddr_t sv
 	KASSERT((prot & VM_PROT_READ) || !(prot & VM_PROT_WRITE));
 
 	UVMHIST_FUNC(__func__);
-	UVMHIST_CALLED(pmaphist);
-
-	UVMHIST_LOG(pmaphist, "pm=%p, sva=%016lx, eva=%016lx, prot=%08x",
+	UVMHIST_CALLARGS(pmaphist, "pm=%p, sva=%016lx, eva=%016lx, prot=%08x",
 	pm, sva, eva, prot);
 
 	KASSERT_PM_ADDR(pm, sva);
@@ -1434,7 +1423,8 @@ pmap_activate(struct lwp *l)
 	uint64_t ttbr0, tcr;
 
 	UVMHIST_FUNC(__func__);
-	UVMHIST_CALLED(pmaphist);
+	UVMHIST_CALLARGS(pmaphist, "lwp=%p asid=%d (pid=%d)", l, pm->pm_asid,
+	l->l_proc->p_pid, 0);
 
 	if (pm == pmap_kernel())
 		return;
@@ -1443,7 +1433,6 @@ pmap_activate(struct lwp *l)
 
 	KASSERT(pm->pm_l0table != NULL);
 
-	UVMHIST_LOG(pmaphist, "lwp=%p (pid=%d)", l, l->l_proc->p_pid, 0, 0);
 
 	/* XXX: allocate asid, and regenerate if needed */
 	if (pm->pm_asid == -1)
@@ -1471,13 +1460,11 @@ pmap_deactivate(struct lwp *l)
 	uint64_t tcr;
 
 	UVMHIST_FUNC(__func__);
-	UVMHIST_CALLED(pmaphist);
+	UVMHIST_CALLARGS(pmaphist, "lwp=%p, asid=%d", l, pm->pm_asid, 0, 0);
 
 	if (pm == pmap_kernel())
 		return;
 
-	UVMHIST_LOG(pmaphist, "lwp=%p, asid=%d", l, pm->pm_asid, 0, 0);
-
 	/* Disable translation table walks using TTBR0 */
 	tcr = reg_tcr_el1_read();
 	reg_tcr_el1_write(tcr | TCR_EPD0);
@@ -1524,9 +1511,7 @@ pmap_destroy(struct pmap 

CVS commit: src/sys/arch/aarch64/aarch64

2021-09-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep 26 09:58:13 UTC 2021

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

Log Message:
Use UVMHIST_CALLARGS


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/arch/aarch64/aarch64/pmap.c

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



CVS commit: src/sys/arch/aarch64/aarch64

2021-09-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep 26 08:04:35 UTC 2021

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

Log Message:
'\n' is not required in KASSERTMSG either.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/aarch64/aarch64/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/aarch64/aarch64/pmap.c
diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.113 src/sys/arch/aarch64/aarch64/pmap.c:1.114
--- src/sys/arch/aarch64/aarch64/pmap.c:1.113	Sun Sep 26 08:02:48 2021
+++ src/sys/arch/aarch64/aarch64/pmap.c	Sun Sep 26 08:04:35 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.113 2021/09/26 08:02:48 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.114 2021/09/26 08:04:35 skrll Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.113 2021/09/26 08:02:48 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.114 2021/09/26 08:04:35 skrll Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -300,22 +300,22 @@ phys_to_pp(paddr_t pa)
 		if ((pm) == pmap_kernel()) {\
 			KASSERTMSG(space == AARCH64_ADDRSPACE_UPPER,	\
 			"%s: kernel pm %p: va=%016lx"		\
-			" is out of upper address space\n",		\
+			" is out of upper address space",		\
 			__func__, (pm), (va));			\
 			KASSERTMSG(IN_RANGE((va), VM_MIN_KERNEL_ADDRESS, \
 			VM_MAX_KERNEL_ADDRESS),			\
 			"%s: kernel pm %p: va=%016lx"		\
-			" is not kernel address\n",			\
+			" is not kernel address",			\
 			__func__, (pm), (va));			\
 		} else {		\
 			KASSERTMSG(space == AARCH64_ADDRSPACE_LOWER,	\
 			"%s: user pm %p: va=%016lx"			\
-			" is out of lower address space\n",		\
+			" is out of lower address space",		\
 			__func__, (pm), (va));			\
 			KASSERTMSG(IN_RANGE((va),			\
 			VM_MIN_ADDRESS, VM_MAX_ADDRESS),		\
 			"%s: user pm %p: va=%016lx"			\
-			" is not user address\n",			\
+			" is not user address",			\
 			__func__, (pm), (va));			\
 		}			\
 	} while (0 /* CONSTCOND */)
@@ -2063,7 +2063,7 @@ pmap_remove_all(struct pmap *pm)
 		pte = *ptep;
 
 		KASSERTMSG(lxpde_valid(pte),
-		"pte is not valid: pmap=%p, asid=%d, va=%016lx\n",
+		"pte is not valid: pmap=%p, asid=%d, va=%016lx",
 		pm, pm->pm_asid, pv->pv_va);
 
 		pa = lxpde_pa(pte);
@@ -2071,7 +2071,7 @@ pmap_remove_all(struct pmap *pm)
 
 		KASSERTMSG(pp != NULL,
 		"no pmap_page of physical address:%016lx, "
-		"pmap=%p, asid=%d, va=%016lx\n",
+		"pmap=%p, asid=%d, va=%016lx",
 		pa, pm, pm->pm_asid, pv->pv_va);
 
 		pmap_pv_lock(pp);



CVS commit: src/sys/arch/aarch64/aarch64

2021-09-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep 26 08:04:35 UTC 2021

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

Log Message:
'\n' is not required in KASSERTMSG either.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/aarch64/aarch64/pmap.c

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



CVS commit: src/sys/arch/aarch64/aarch64

2021-09-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep 26 08:02:48 UTC 2021

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

Log Message:
"\n" is not required in KERNHIST


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/arch/aarch64/aarch64/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/aarch64/aarch64/pmap.c
diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.112 src/sys/arch/aarch64/aarch64/pmap.c:1.113
--- src/sys/arch/aarch64/aarch64/pmap.c:1.112	Wed Sep 15 07:49:54 2021
+++ src/sys/arch/aarch64/aarch64/pmap.c	Sun Sep 26 08:02:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.112 2021/09/15 07:49:54 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.113 2021/09/26 08:02:48 skrll Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.112 2021/09/15 07:49:54 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.113 2021/09/26 08:02:48 skrll Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -1887,7 +1887,7 @@ _pmap_enter(struct pmap *pm, vaddr_t va,
 #endif
 		UVMHIST_LOG(pmaphist,
 		"va=%016lx has already mapped."
-		" old-pa=%016lx new-pa=%016lx, old-pte=%016llx\n",
+		" old-pa=%016lx new-pa=%016lx, old-pte=%016llx",
 		va, l3pte_pa(opte), pa, opte);
 
 		if (pa == l3pte_pa(opte)) {



CVS commit: src/sys/arch/aarch64/aarch64

2021-09-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep 26 08:02:48 UTC 2021

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

Log Message:
"\n" is not required in KERNHIST


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/arch/aarch64/aarch64/pmap.c

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