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

2021-11-24 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Nov 24 10:01:24 UTC 2021

Modified Files:
src/sys/arch/arm/acpi: cpu_acpi.c

Log Message:
arm64: acpi: Set capacity_dmips_mhz for CPUs

The GICC structure describes a relative power efficiency for each
processor. Use this value as-is for the capacity_dmips_mhz value of a
cpu. This makes the assumption that "more efficient" means "slower".


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/acpi/cpu_acpi.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/acpi

2021-11-24 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Nov 24 10:01:24 UTC 2021

Modified Files:
src/sys/arch/arm/acpi: cpu_acpi.c

Log Message:
arm64: acpi: Set capacity_dmips_mhz for CPUs

The GICC structure describes a relative power efficiency for each
processor. Use this value as-is for the capacity_dmips_mhz value of a
cpu. This makes the assumption that "more efficient" means "slower".


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/acpi/cpu_acpi.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/acpi/cpu_acpi.c
diff -u src/sys/arch/arm/acpi/cpu_acpi.c:1.11 src/sys/arch/arm/acpi/cpu_acpi.c:1.12
--- src/sys/arch/arm/acpi/cpu_acpi.c:1.11	Sun Oct 17 12:41:05 2021
+++ src/sys/arch/arm/acpi/cpu_acpi.c	Wed Nov 24 10:01:24 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_acpi.c,v 1.11 2021/10/17 12:41:05 jmcneill Exp $ */
+/* $NetBSD: cpu_acpi.c,v 1.12 2021/11/24 10:01:24 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_acpi.c,v 1.11 2021/10/17 12:41:05 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_acpi.c,v 1.12 2021/11/24 10:01:24 jmcneill Exp $");
 
 #include 
 #include 
@@ -93,6 +93,7 @@ cpu_acpi_match(device_t parent, cfdata_t
 static void
 cpu_acpi_attach(device_t parent, device_t self, void *aux)
 {
+	prop_dictionary_t dict = device_properties(self);
 	ACPI_MADT_GENERIC_INTERRUPT *gicc = aux;
 	const uint64_t mpidr = gicc->ArmMpidr;
 	const int unit = device_unit(self);
@@ -123,6 +124,10 @@ cpu_acpi_attach(device_t parent, device_
 	}
 #endif /* MULTIPROCESSOR */
 
+	/* Assume that less efficient processors are faster. */
+	prop_dictionary_set_uint32(dict, "capacity_dmips_mhz",
+	gicc->EfficiencyClass);
+
 	/* Store the ACPI Processor UID in cpu_info */
 	ci->ci_acpiid = gicc->Uid;
 



CVS commit: src/usr.sbin/wsmoused

2021-11-24 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed Nov 24 14:34:51 UTC 2021

Modified Files:
src/usr.sbin/wsmoused: selection.c wsmoused.c wsmoused.h

Log Message:
wsmoused: support absolute mouse position events

Tested with VirtualBox Guest Addtions.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/wsmoused/selection.c
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/wsmoused/wsmoused.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/wsmoused/wsmoused.h

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



CVS commit: src/usr.sbin/wsmoused

2021-11-24 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed Nov 24 14:34:51 UTC 2021

Modified Files:
src/usr.sbin/wsmoused: selection.c wsmoused.c wsmoused.h

Log Message:
wsmoused: support absolute mouse position events

Tested with VirtualBox Guest Addtions.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/wsmoused/selection.c
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/wsmoused/wsmoused.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/wsmoused/wsmoused.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.sbin/wsmoused/selection.c
diff -u src/usr.sbin/wsmoused/selection.c:1.10 src/usr.sbin/wsmoused/selection.c:1.11
--- src/usr.sbin/wsmoused/selection.c:1.10	Sun May 27 15:05:00 2007
+++ src/usr.sbin/wsmoused/selection.c	Wed Nov 24 14:34:51 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: selection.c,v 1.10 2007/05/27 15:05:00 jmmv Exp $ */
+/* $NetBSD: selection.c,v 1.11 2021/11/24 14:34:51 uwe Exp $ */
 
 /*
  * Copyright (c) 2002, 2003, 2004, 2007 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: selection.c,v 1.10 2007/05/27 15:05:00 jmmv Exp $");
+__RCSID("$NetBSD: selection.c,v 1.11 2021/11/24 14:34:51 uwe Exp $");
 #endif /* not lint */
 
 #include 
@@ -226,6 +226,7 @@ selection_cleanup(void)
 void
 selection_wsmouse_event(struct wscons_event evt)
 {
+	const struct wsmouse_calibcoords *abs = &Selmouse.sm_mouse->m_calib;
 
 	if (IS_MOTION_EVENT(evt.type)) {
 		if (Selmouse.sm_selecting)
@@ -259,7 +260,30 @@ selection_wsmouse_event(struct wscons_ev
 Selmouse.sm_count_y++;
 			break;
 
-		case WSCONS_EVENT_MOUSE_DELTA_Z:
+		case WSCONS_EVENT_MOUSE_DELTA_Z: /* FALLTHROUGH */
+		case WSCONS_EVENT_MOUSE_DELTA_W:
+			break;
+
+		case WSCONS_EVENT_MOUSE_ABSOLUTE_X:
+			if (!Selmouse.sm_mouse->m_doabs)
+break;
+			/* max x is inclusive in both selmouse and tpcalib */
+			Selmouse.sm_x
+			= ((evt.value - abs->minx) * (Selmouse.sm_max_x + 1))
+			  / (abs->maxx - abs->minx + 1);
+			break;
+
+		case WSCONS_EVENT_MOUSE_ABSOLUTE_Y:
+			if (!Selmouse.sm_mouse->m_doabs)
+break;
+			/* max y is inclusive in both selmouse and tpcalib */
+			Selmouse.sm_y
+			= ((evt.value - abs->miny) * (Selmouse.sm_max_y + 1))
+			  / (abs->maxy - abs->miny + 1);
+			break;
+
+		case WSCONS_EVENT_MOUSE_ABSOLUTE_Z: /* FALLTHROUGH */
+		case WSCONS_EVENT_MOUSE_ABSOLUTE_W:
 			break;
 
 		default:

Index: src/usr.sbin/wsmoused/wsmoused.c
diff -u src/usr.sbin/wsmoused/wsmoused.c:1.27 src/usr.sbin/wsmoused/wsmoused.c:1.28
--- src/usr.sbin/wsmoused/wsmoused.c:1.27	Wed Sep  1 06:10:06 2021
+++ src/usr.sbin/wsmoused/wsmoused.c	Wed Nov 24 14:34:51 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: wsmoused.c,v 1.27 2021/09/01 06:10:06 mlelstv Exp $ */
+/* $NetBSD: wsmoused.c,v 1.28 2021/11/24 14:34:51 uwe Exp $ */
 
 /*
  * Copyright (c) 2002, 2003, 2004 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 2002, 2003\
  The NetBSD Foundation, Inc.  All rights reserved.");
-__RCSID("$NetBSD: wsmoused.c,v 1.27 2021/09/01 06:10:06 mlelstv Exp $");
+__RCSID("$NetBSD: wsmoused.c,v 1.28 2021/11/24 14:34:51 uwe Exp $");
 #endif /* not lint */
 
 #include 
@@ -250,7 +250,7 @@ init_mouse(void)
 static void
 open_device(unsigned int secs)
 {
-	int version = WSMOUSE_EVENT_VERSION;
+	int status;
 
 	if (Mouse.m_devfd != -1)
 		return;
@@ -262,10 +262,38 @@ open_device(unsigned int secs)
 	if (Mouse.m_devfd == -1)
 		log_err(EXIT_FAILURE, "cannot open %s", Mouse.m_devname);
 
-	if (ioctl(Mouse.m_devfd, WSMOUSEIO_SETVERSION, &version) == -1)
+	const int version = WSMOUSE_EVENT_VERSION;
+	status = ioctl(Mouse.m_devfd, WSMOUSEIO_SETVERSION, &version);
+	if (status == -1)
 		log_err(EXIT_FAILURE, "cannot set version %s", Mouse.m_devname);
+
+
+	/*
+	 * Get calibration data for touch panel.  Not fatal if we can't.
+	 */
+	Mouse.m_doabs = 0;
+
+	unsigned int mouse_type = 0; /* defined WSMOUSE_TYPE_* start at 1 */
+	status = ioctl(Mouse.m_devfd, WSMOUSEIO_GTYPE, &mouse_type);
+	if (status == -1) {
+		log_warn("WSMOUSEIO_GTYPE");
+		return;
+	}
+
+	/* absolute position events make no sense for free-ranging mice */
+	if (mouse_type != WSMOUSE_TYPE_TPANEL)
+		return;
+
+	status = ioctl(Mouse.m_devfd, WSMOUSEIO_GCALIBCOORDS, &Mouse.m_calib);
+	if (status == -1) {
+		log_warn("WSMOUSEIO_GCALIBCOORDS");
+		return;
+	}
+
+	Mouse.m_doabs = 1;
 }
 
+
 /* - */
 
 /* Main program event loop.  This function polls the wscons status

Index: src/usr.sbin/wsmoused/wsmoused.h
diff -u src/usr.sbin/wsmoused/wsmoused.h:1.9 src/usr.sbin/wsmoused/wsmoused.h:1.10
--- src/usr.sbin/wsmoused/wsmoused.h:1.9	Sat Mar 18 02:06:38 2006
+++ src/usr.sbin/wsmoused/wsmoused.h	Wed Nov 24 14:34:51 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: wsmoused.h,v 1.9 2006/03/18 02:06:38 elad Exp $ */
+/* $NetBSD: wsmoused.h,v 1.10 2021/11/24 14:34:51 uwe 

CVS commit: src/lib/libc/arch/vax

2021-11-24 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Nov 24 15:05:16 UTC 2021

Modified Files:
src/lib/libc/arch/vax: genassym.cf
src/lib/libc/arch/vax/sys: __sigtramp3.S

Log Message:
Decorate the VAX signal trampoline with the appropriate .cfi
directives to allow exception unwind / backtrace across a signal
handler.

N.B. This is currently disabled, as these .cfi directives cause
linker warnings about incompatible TEXTREL relocations in .eh_frame.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/arch/vax/genassym.cf
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/arch/vax/sys/__sigtramp3.S

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



CVS commit: src/lib/libc/arch/vax

2021-11-24 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Nov 24 15:05:16 UTC 2021

Modified Files:
src/lib/libc/arch/vax: genassym.cf
src/lib/libc/arch/vax/sys: __sigtramp3.S

Log Message:
Decorate the VAX signal trampoline with the appropriate .cfi
directives to allow exception unwind / backtrace across a signal
handler.

N.B. This is currently disabled, as these .cfi directives cause
linker warnings about incompatible TEXTREL relocations in .eh_frame.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/arch/vax/genassym.cf
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/arch/vax/sys/__sigtramp3.S

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

Modified files:

Index: src/lib/libc/arch/vax/genassym.cf
diff -u src/lib/libc/arch/vax/genassym.cf:1.5 src/lib/libc/arch/vax/genassym.cf:1.6
--- src/lib/libc/arch/vax/genassym.cf:1.5	Tue Jan 25 02:38:15 2011
+++ src/lib/libc/arch/vax/genassym.cf	Wed Nov 24 15:05:15 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.5 2011/01/25 02:38:15 matt Exp $
+#	$NetBSD: genassym.cf,v 1.6 2021/11/24 15:05:15 thorpej Exp $
 
 #
 # Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -43,18 +43,25 @@ define _UC_SIGMASK	_UC_SIGMASK
 define _UC_STACK	_UC_STACK
 define _UC_CPU		_UC_CPU
 
-define _REG_R0		4*_REG_R0
-define _REG_R1		4*_REG_R1
-define _REG_R2		4*_REG_R2
-define _REG_R4		4*_REG_R4
-define _REG_R6		4*_REG_R6
-define _REG_R8		4*_REG_R8
-define _REG_R10		4*_REG_R10
-define _REG_AP		4*_REG_AP
-define _REG_SP		4*_REG_SP
-define _REG_FP		4*_REG_FP
-define _REG_PC		4*_REG_PC
-define _REG_PSL		4*_REG_PSL
+define _REG_R0		_REG_R0
+define _REG_R1		_REG_R1
+define _REG_R2		_REG_R2
+define _REG_R3		_REG_R3
+define _REG_R4		_REG_R4
+define _REG_R5		_REG_R5
+define _REG_R6		_REG_R6
+define _REG_R7		_REG_R7
+define _REG_R8		_REG_R8
+define _REG_R9		_REG_R9
+define _REG_R10		_REG_R10
+define _REG_R11		_REG_R11
+define _REG_AP		_REG_AP
+define _REG_FP		_REG_FP
+define _REG_SP		_REG_SP
+define _REG_PC		_REG_PC
+define _REG_PSL		_REG_PSL
+
+define SIZEOF_SIGINFO	sizeof(siginfo_t)
 
 define	SS_SP		offsetof(stack_t, ss_sp)
 define	SS_SIZE		offsetof(stack_t, ss_size)

Index: src/lib/libc/arch/vax/sys/__sigtramp3.S
diff -u src/lib/libc/arch/vax/sys/__sigtramp3.S:1.2 src/lib/libc/arch/vax/sys/__sigtramp3.S:1.3
--- src/lib/libc/arch/vax/sys/__sigtramp3.S:1.2	Tue Jan 25 02:38:15 2011
+++ src/lib/libc/arch/vax/sys/__sigtramp3.S	Wed Nov 24 15:05:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: __sigtramp3.S,v 1.2 2011/01/25 02:38:15 matt Exp $	*/
+/*	$NetBSD: __sigtramp3.S,v 1.3 2021/11/24 15:05:16 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2003 Matt Thomas 
@@ -27,23 +27,70 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "SYS.h"
+#include "assym.h"
+
+#ifdef SYSLIBC_SCCS
+RCSID("$NetBSD: __sigtramp3.S,v 1.3 2021/11/24 15:05:16 thorpej Exp $")
+#endif
+
 /*
  * Signal trampoline; registers when called:
  *	pc, psl - obvious
- *	sp, ap - points to argument list
- *	4(ap) -- signo
- *	8(ap) -- pointer to siginfo
- *	   12(ap) -- pointer to ucontext
+ *	sp, ap - points to a CALLG argument list
  *	fp - address of signal handler
+ *
+ * Stack is set up like so:
+ *		ucontext structure
+ *		siginfo structure
+ *		 CALLG argument list 
+ *		12(ap) -- pointer to ucontext
+ *		 8(ap) -- pointer to siginfo
+ *		 4(ap) -- signal number
+ *	sp ->	 0(ap) -- argument count
+ *		 CALLG argument list 
+ *
+ * N.B. all of the DWARF register numbers match our _REG_* constants.
+ * Also notice that while the %ap is adjusted inside the trampoline,
+ * the %sp is not adjusted, and so the CFA base does not change.
  */
 
-#include "SYS.h"
+#define	CFI_OFFSET(r)			.cfi_offset r, r * 4
 
-#ifdef SYSLIBC_SCCS
-RCSID("$NetBSD: __sigtramp3.S,v 1.2 2011/01/25 02:38:15 matt Exp $")
+	.text
+#if 0
+	.cfi_startproc simple
+	.cfi_signal_frame
+	.cfi_def_cfa _REG_SP, 16 + SIZEOF_SIGINFO + UC_GREGS
+	CFI_OFFSET(_REG_R0)
+	CFI_OFFSET(_REG_R1)
+	CFI_OFFSET(_REG_R2)
+	CFI_OFFSET(_REG_R3)
+	CFI_OFFSET(_REG_R4)
+	CFI_OFFSET(_REG_R5)
+	CFI_OFFSET(_REG_R6)
+	CFI_OFFSET(_REG_R7)
+	CFI_OFFSET(_REG_R8)
+	CFI_OFFSET(_REG_R9)
+	CFI_OFFSET(_REG_R10)
+	CFI_OFFSET(_REG_R11)
+	CFI_OFFSET(_REG_AP)
+	CFI_OFFSET(_REG_FP)
+	CFI_OFFSET(_REG_SP)
+	CFI_OFFSET(_REG_PC)
+	CFI_OFFSET(_REG_PSL)
 #endif
 
-	.text
+/*
+ * The unwind entry includes one instruction slot prior to the trampoline
+ * because the unwinder will look up to (return PC - 1) while unwinding.
+ * Normally this would be the jump / branch, but since there isn't one in
+ * this case, we place an explicit nop there instead.
+ */
+
+#if 0
+	nop
+#endif
 	_ALIGN_TEXT
 
 	.globl	_C_LABEL(__sigtramp_siginfo_3)
@@ -53,3 +100,6 @@ _C_LABEL(__sigtramp_siginfo_3):
 	addl2 $8,%ap			# arg is pointer to ucontext
 	SYSTRAP(setcontext)		# exit from here
 	halt# illegal insn
+#if 0
+	.cfi_endproc
+#endif



CVS commit: src/sys/kern

2021-11-24 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Nov 24 16:35:33 UTC 2021

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

Log Message:
Fix "restart" semantics -- restart is terminal, so don't clear the
condition when previous waiters have drained.  ("restart" is a bad
name for that this function does, fwiw.)

This should address a kernel assertion failure reported by Chavdar Ivanov
on current-users.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/kern/sys_eventfd.c
cvs rdiff -u -r1.6 -r1.7 src/sys/kern/sys_timerfd.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-11-24 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Nov 24 16:35:33 UTC 2021

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

Log Message:
Fix "restart" semantics -- restart is terminal, so don't clear the
condition when previous waiters have drained.  ("restart" is a bad
name for that this function does, fwiw.)

This should address a kernel assertion failure reported by Chavdar Ivanov
on current-users.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/kern/sys_eventfd.c
cvs rdiff -u -r1.6 -r1.7 src/sys/kern/sys_timerfd.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.7 src/sys/kern/sys_eventfd.c:1.8
--- src/sys/kern/sys_eventfd.c:1.7	Mon Sep 27 00:40:49 2021
+++ src/sys/kern/sys_eventfd.c	Wed Nov 24 16:35:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_eventfd.c,v 1.7 2021/09/27 00:40:49 thorpej Exp $	*/
+/*	$NetBSD: sys_eventfd.c,v 1.8 2021/11/24 16:35:33 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_eventfd.c,v 1.7 2021/09/27 00:40:49 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_eventfd.c,v 1.8 2021/11/24 16:35:33 thorpej Exp $");
 
 /*
  * eventfd
@@ -64,7 +64,6 @@ struct eventfd {
 	kmutex_t	efd_lock;
 	kcondvar_t	efd_read_wait;
 	kcondvar_t	efd_write_wait;
-	kcondvar_t	efd_restart_wait;
 	struct selinfo	efd_read_sel;
 	struct selinfo	efd_write_sel;
 	eventfd_t	efd_val;
@@ -97,7 +96,6 @@ eventfd_create(unsigned int const val, i
 	mutex_init(&efd->efd_lock, MUTEX_DEFAULT, IPL_NONE);
 	cv_init(&efd->efd_read_wait, "efdread");
 	cv_init(&efd->efd_write_wait, "efdwrite");
-	cv_init(&efd->efd_restart_wait, "efdrstrt");
 	selinit(&efd->efd_read_sel);
 	selinit(&efd->efd_write_sel);
 	efd->efd_val = val;
@@ -119,13 +117,11 @@ eventfd_destroy(struct eventfd * const e
 {
 
 	KASSERT(efd->efd_nwaiters == 0);
-	KASSERT(efd->efd_restarting == false);
 	KASSERT(efd->efd_has_read_waiters == false);
 	KASSERT(efd->efd_has_write_waiters == false);
 
 	cv_destroy(&efd->efd_read_wait);
 	cv_destroy(&efd->efd_write_wait);
-	cv_destroy(&efd->efd_restart_wait);
 
 	seldestroy(&efd->efd_read_sel);
 	seldestroy(&efd->efd_write_sel);
@@ -152,11 +148,10 @@ eventfd_wait(struct eventfd * const efd,
 	}
 
 	/*
-	 * We're going to block.  If there is a restart in-progress,
-	 * wait for that to complete first.
+	 * We're going to block.  Check if we need to return ERESTART.
 	 */
-	while (efd->efd_restarting) {
-		cv_wait(&efd->efd_restart_wait, &efd->efd_lock);
+	if (efd->efd_restarting) {
+		return ERESTART;
 	}
 
 	if (is_write) {
@@ -175,18 +170,12 @@ eventfd_wait(struct eventfd * const efd,
 
 	/*
 	 * If a restart was triggered while we were asleep, we need
-	 * to return ERESTART if no other error was returned.  If we
-	 * are the last waiter coming out of the restart drain, clear
-	 * the condition.
+	 * to return ERESTART if no other error was returned.
 	 */
 	if (efd->efd_restarting) {
 		if (error == 0) {
 			error = ERESTART;
 		}
-		if (efd->efd_nwaiters == 0) {
-			efd->efd_restarting = false;
-			cv_broadcast(&efd->efd_restart_wait);
-		}
 	}
 
 	return error;

Index: src/sys/kern/sys_timerfd.c
diff -u src/sys/kern/sys_timerfd.c:1.6 src/sys/kern/sys_timerfd.c:1.7
--- src/sys/kern/sys_timerfd.c:1.6	Mon Sep 27 00:40:49 2021
+++ src/sys/kern/sys_timerfd.c	Wed Nov 24 16:35:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_timerfd.c,v 1.6 2021/09/27 00:40:49 thorpej Exp $	*/
+/*	$NetBSD: sys_timerfd.c,v 1.7 2021/11/24 16:35:33 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_timerfd.c,v 1.6 2021/09/27 00:40:49 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_timerfd.c,v 1.7 2021/11/24 16:35:33 thorpej Exp $");
 
 /*
  * timerfd
@@ -71,7 +71,6 @@ __KERNEL_RCSID(0, "$NetBSD: sys_timerfd.
 struct timerfd {
 	struct itimer	tfd_itimer;
 	kcondvar_t	tfd_read_wait;
-	kcondvar_t	tfd_restart_wait;
 	struct selinfo	tfd_read_sel;
 	int64_t		tfd_nwaiters;
 	bool		tfd_cancel_on_set;
@@ -162,7 +161,6 @@ timerfd_create(clockid_t const clock_id,
 	KASSERT(clock_id == CLOCK_REALTIME || clock_id == CLOCK_MONOTONIC);
 
 	cv_init(&tfd->tfd_read_wait, "tfdread");
-	cv_init(&tfd->tfd_restart_wait, "tfdrstrt");
 	selinit(&tfd->tfd_read_sel);
 	getnanotime(&tfd->tfd_btime);
 
@@ -188,14 +186,12 @@ timerfd_destroy(struct timerfd * const t
 {
 
 	KASSERT(tfd->tfd_nwaiters == 0);
-	KASSERT(tfd->tfd_restarting == false);
 
 	itimer_lock();
 	itimer_poison(&tfd->tfd_itimer);
 	itimer_fini(&tfd->tfd_itimer);	/* drops itimer lock */
 
 	cv_destroy(&tfd->tfd_read_wait);
-	cv_destroy(&tfd->tfd_restart_wait);
 
 	seldestroy(&tfd->tfd_read_sel);
 
@@ -219,11 +215,10 @@ timerfd_wait(struct timerfd * const tfd,
 	}
 
 	/*
-	 * We're going to block.  If there is a restart in-

CVS commit: src/sys/compat/linux/arch

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Wed Nov 24 18:50:28 UTC 2021

Modified Files:
src/sys/compat/linux/arch: Makefile

Log Message:
add missing SUBDIR aarch64


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/linux/arch/Makefile

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

Modified files:

Index: src/sys/compat/linux/arch/Makefile
diff -u src/sys/compat/linux/arch/Makefile:1.2 src/sys/compat/linux/arch/Makefile:1.3
--- src/sys/compat/linux/arch/Makefile:1.2	Sat Nov  9 22:02:45 2019
+++ src/sys/compat/linux/arch/Makefile	Wed Nov 24 18:50:28 2021
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.2 2019/11/09 22:02:45 jdolecek Exp $
+# $NetBSD: Makefile,v 1.3 2021/11/24 18:50:28 ryo Exp $
 
 # XXX sparc sparc64 exist but have no syscalls.master
-SUBDIR=alpha amd64 arm i386 m68k mips powerpc
+SUBDIR=aarch64 alpha amd64 arm i386 m68k mips powerpc
 
 
 .include 



CVS commit: src/sys/compat/linux/arch

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Wed Nov 24 18:50:28 UTC 2021

Modified Files:
src/sys/compat/linux/arch: Makefile

Log Message:
add missing SUBDIR aarch64


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/linux/arch/Makefile

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



CVS commit: src/sys/compat/linux/arch

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Wed Nov 24 18:52:13 UTC 2021

Modified Files:
src/sys/compat/linux/arch/aarch64: syscalls.master
src/sys/compat/linux/arch/arm: syscalls.master
src/sys/compat/linux/arch/m68k: syscalls.master
src/sys/compat/linux/arch/mips: syscalls.master
src/sys/compat/linux/arch/powerpc: syscalls.master

Log Message:
add getrandom(2) syscall entry


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/compat/linux/arch/aarch64/syscalls.master
cvs rdiff -u -r1.73 -r1.74 src/sys/compat/linux/arch/arm/syscalls.master
cvs rdiff -u -r1.99 -r1.100 src/sys/compat/linux/arch/m68k/syscalls.master
cvs rdiff -u -r1.72 -r1.73 src/sys/compat/linux/arch/mips/syscalls.master
cvs rdiff -u -r1.78 -r1.79 src/sys/compat/linux/arch/powerpc/syscalls.master

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



CVS commit: src/sys/compat/linux/arch

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Wed Nov 24 18:52:13 UTC 2021

Modified Files:
src/sys/compat/linux/arch/aarch64: syscalls.master
src/sys/compat/linux/arch/arm: syscalls.master
src/sys/compat/linux/arch/m68k: syscalls.master
src/sys/compat/linux/arch/mips: syscalls.master
src/sys/compat/linux/arch/powerpc: syscalls.master

Log Message:
add getrandom(2) syscall entry


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/compat/linux/arch/aarch64/syscalls.master
cvs rdiff -u -r1.73 -r1.74 src/sys/compat/linux/arch/arm/syscalls.master
cvs rdiff -u -r1.99 -r1.100 src/sys/compat/linux/arch/m68k/syscalls.master
cvs rdiff -u -r1.72 -r1.73 src/sys/compat/linux/arch/mips/syscalls.master
cvs rdiff -u -r1.78 -r1.79 src/sys/compat/linux/arch/powerpc/syscalls.master

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

Modified files:

Index: src/sys/compat/linux/arch/aarch64/syscalls.master
diff -u src/sys/compat/linux/arch/aarch64/syscalls.master:1.1 src/sys/compat/linux/arch/aarch64/syscalls.master:1.2
--- src/sys/compat/linux/arch/aarch64/syscalls.master:1.1	Thu Sep 23 06:56:27 2021
+++ src/sys/compat/linux/arch/aarch64/syscalls.master	Wed Nov 24 18:52:13 2021
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.1 2021/09/23 06:56:27 ryo Exp $
+	$NetBSD: syscalls.master,v 1.2 2021/11/24 18:52:13 ryo Exp $
 
 ;	@(#)syscalls.master	8.1 (Berkeley) 7/19/93
 
@@ -509,7 +509,8 @@
 275	UNIMPL		sched_getattr
 276	UNIMPL		renameat2
 277	UNIMPL		seccomp
-278	UNIMPL		getrandom
+278	NOARGS		{ ssize_t|sys||getrandom(void *buf, size_t buflen, \
+			unsigned int flags); }
 279	UNIMPL		memfd_create
 280	UNIMPL		bpf
 281	UNIMPL		execveat

Index: src/sys/compat/linux/arch/arm/syscalls.master
diff -u src/sys/compat/linux/arch/arm/syscalls.master:1.73 src/sys/compat/linux/arch/arm/syscalls.master:1.74
--- src/sys/compat/linux/arch/arm/syscalls.master:1.73	Mon Sep 20 02:20:02 2021
+++ src/sys/compat/linux/arch/arm/syscalls.master	Wed Nov 24 18:52:13 2021
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.73 2021/09/20 02:20:02 thorpej Exp $
+	$NetBSD: syscalls.master,v 1.74 2021/11/24 18:52:13 ryo Exp $
 
 ; Derived from sys/compat/linux/arch/*/syscalls.master
 ; and from Linux 2.4.12 arch/arm/kernel/calls.S
@@ -613,7 +613,8 @@
 382	UNIMPL		renameat2
 383	UNIMPL		seccomp
 ; XXX FIX-me?
-; 384	UNIMPL		getrandom
+; 384	NOARGS		{ ssize_t|sys||getrandom(void *buf, size_t buflen, \
+			unsigned int flags); }
 ; 385	UNIMPL		memfd_create
 
 ; ARMLinux actually has two ranges of syscalls.  Normal syscalls use

Index: src/sys/compat/linux/arch/m68k/syscalls.master
diff -u src/sys/compat/linux/arch/m68k/syscalls.master:1.99 src/sys/compat/linux/arch/m68k/syscalls.master:1.100
--- src/sys/compat/linux/arch/m68k/syscalls.master:1.99	Mon Sep 20 02:20:02 2021
+++ src/sys/compat/linux/arch/m68k/syscalls.master	Wed Nov 24 18:52:13 2021
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.99 2021/09/20 02:20:02 thorpej Exp $
+	$NetBSD: syscalls.master,v 1.100 2021/11/24 18:52:13 ryo Exp $
 
 ;	@(#)syscalls.master	8.1 (Berkeley) 7/19/93
 
@@ -591,7 +591,8 @@
 349	UNIMPL		sched_setattr
 350	UNIMPL		sched_getattr
 351	UNIMPL		renameat2
-352	UNIMPL		getrandom
+352	NOARGS		{ ssize_t|sys||getrandom(void *buf, size_t buflen, \
+			unsigned int flags); }
 353	UNIMPL		memfd_create
 354	UNIMPL		bpf
 355	UNIMPL		execveat

Index: src/sys/compat/linux/arch/mips/syscalls.master
diff -u src/sys/compat/linux/arch/mips/syscalls.master:1.72 src/sys/compat/linux/arch/mips/syscalls.master:1.73
--- src/sys/compat/linux/arch/mips/syscalls.master:1.72	Mon Sep 20 02:20:02 2021
+++ src/sys/compat/linux/arch/mips/syscalls.master	Wed Nov 24 18:52:13 2021
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.72 2021/09/20 02:20:02 thorpej Exp $  
+	$NetBSD: syscalls.master,v 1.73 2021/11/24 18:52:13 ryo Exp $  
 
 ;	@(#)syscalls.master	8.1 (Berkeley) 7/19/93
 
@@ -587,7 +587,8 @@
 351	UNIMPL		sched_getattr
 352	UNIMPL		renameat2
 353	UNIMPL		seccomp
-354	UNIMPL		getrandom
+354	NOARGS		{ ssize_t|sys||getrandom(void *buf, size_t buflen, \
+			unsigned int flags); }
 355	UNIMPL		memfd_create
 356	UNIMPL		bpf
 357	UNIMPL		execveat

Index: src/sys/compat/linux/arch/powerpc/syscalls.master
diff -u src/sys/compat/linux/arch/powerpc/syscalls.master:1.78 src/sys/compat/linux/arch/powerpc/syscalls.master:1.79
--- src/sys/compat/linux/arch/powerpc/syscalls.master:1.78	Mon Sep 20 02:20:02 2021
+++ src/sys/compat/linux/arch/powerpc/syscalls.master	Wed Nov 24 18:52:13 2021
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.78 2021/09/20 02:20:02 thorpej Exp $  
+	$NetBSD: syscalls.master,v 1.79 2021/11/24 18:52:13 ryo Exp $  
 
 ;	@(#)syscalls.master	8.1 (Berkeley) 7/19/93
 
@@ -602,7 +602,8 @@
 356	UNIMPL		sched_getattr
 357	UNIMPL		renameat2
 358	UNIMPL		seccomp
-359	UNIMPL		getrandom
+359	NOARGS		{ ssize_t|sys||getrandom(void *buf, size_t buflen, \
+			unsigned 

CVS commit: src/sys/compat/linux/arch

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Wed Nov 24 18:57:25 UTC 2021

Modified Files:
src/sys/compat/linux/arch/aarch64: linux_syscall.h linux_syscallargs.h
linux_syscalls.c linux_sysent.c linux_systrace_args.c
src/sys/compat/linux/arch/arm: linux_syscall.h linux_syscallargs.h
linux_syscalls.c linux_sysent.c linux_systrace_args.c
src/sys/compat/linux/arch/m68k: linux_syscall.h linux_syscallargs.h
linux_syscalls.c linux_sysent.c
src/sys/compat/linux/arch/mips: linux_syscall.h linux_syscallargs.h
linux_syscalls.c linux_sysent.c
src/sys/compat/linux/arch/powerpc: linux_syscall.h linux_syscallargs.h
linux_syscalls.c linux_sysent.c

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/compat/linux/arch/aarch64/linux_syscall.h \
src/sys/compat/linux/arch/aarch64/linux_syscallargs.h \
src/sys/compat/linux/arch/aarch64/linux_syscalls.c \
src/sys/compat/linux/arch/aarch64/linux_sysent.c \
src/sys/compat/linux/arch/aarch64/linux_systrace_args.c
cvs rdiff -u -r1.86 -r1.87 src/sys/compat/linux/arch/arm/linux_syscall.h \
src/sys/compat/linux/arch/arm/linux_syscallargs.h \
src/sys/compat/linux/arch/arm/linux_syscalls.c \
src/sys/compat/linux/arch/arm/linux_sysent.c
cvs rdiff -u -r1.19 -r1.20 \
src/sys/compat/linux/arch/arm/linux_systrace_args.c
cvs rdiff -u -r1.112 -r1.113 src/sys/compat/linux/arch/m68k/linux_syscall.h \
src/sys/compat/linux/arch/m68k/linux_syscalls.c \
src/sys/compat/linux/arch/m68k/linux_sysent.c
cvs rdiff -u -r1.111 -r1.112 \
src/sys/compat/linux/arch/m68k/linux_syscallargs.h
cvs rdiff -u -r1.84 -r1.85 src/sys/compat/linux/arch/mips/linux_syscall.h
cvs rdiff -u -r1.83 -r1.84 src/sys/compat/linux/arch/mips/linux_syscallargs.h \
src/sys/compat/linux/arch/mips/linux_syscalls.c \
src/sys/compat/linux/arch/mips/linux_sysent.c
cvs rdiff -u -r1.90 -r1.91 src/sys/compat/linux/arch/powerpc/linux_syscall.h \
src/sys/compat/linux/arch/powerpc/linux_sysent.c
cvs rdiff -u -r1.89 -r1.90 \
src/sys/compat/linux/arch/powerpc/linux_syscallargs.h \
src/sys/compat/linux/arch/powerpc/linux_syscalls.c

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



CVS commit: src/sys/compat/linux/arch

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Wed Nov 24 18:57:25 UTC 2021

Modified Files:
src/sys/compat/linux/arch/aarch64: linux_syscall.h linux_syscallargs.h
linux_syscalls.c linux_sysent.c linux_systrace_args.c
src/sys/compat/linux/arch/arm: linux_syscall.h linux_syscallargs.h
linux_syscalls.c linux_sysent.c linux_systrace_args.c
src/sys/compat/linux/arch/m68k: linux_syscall.h linux_syscallargs.h
linux_syscalls.c linux_sysent.c
src/sys/compat/linux/arch/mips: linux_syscall.h linux_syscallargs.h
linux_syscalls.c linux_sysent.c
src/sys/compat/linux/arch/powerpc: linux_syscall.h linux_syscallargs.h
linux_syscalls.c linux_sysent.c

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/compat/linux/arch/aarch64/linux_syscall.h \
src/sys/compat/linux/arch/aarch64/linux_syscallargs.h \
src/sys/compat/linux/arch/aarch64/linux_syscalls.c \
src/sys/compat/linux/arch/aarch64/linux_sysent.c \
src/sys/compat/linux/arch/aarch64/linux_systrace_args.c
cvs rdiff -u -r1.86 -r1.87 src/sys/compat/linux/arch/arm/linux_syscall.h \
src/sys/compat/linux/arch/arm/linux_syscallargs.h \
src/sys/compat/linux/arch/arm/linux_syscalls.c \
src/sys/compat/linux/arch/arm/linux_sysent.c
cvs rdiff -u -r1.19 -r1.20 \
src/sys/compat/linux/arch/arm/linux_systrace_args.c
cvs rdiff -u -r1.112 -r1.113 src/sys/compat/linux/arch/m68k/linux_syscall.h \
src/sys/compat/linux/arch/m68k/linux_syscalls.c \
src/sys/compat/linux/arch/m68k/linux_sysent.c
cvs rdiff -u -r1.111 -r1.112 \
src/sys/compat/linux/arch/m68k/linux_syscallargs.h
cvs rdiff -u -r1.84 -r1.85 src/sys/compat/linux/arch/mips/linux_syscall.h
cvs rdiff -u -r1.83 -r1.84 src/sys/compat/linux/arch/mips/linux_syscallargs.h \
src/sys/compat/linux/arch/mips/linux_syscalls.c \
src/sys/compat/linux/arch/mips/linux_sysent.c
cvs rdiff -u -r1.90 -r1.91 src/sys/compat/linux/arch/powerpc/linux_syscall.h \
src/sys/compat/linux/arch/powerpc/linux_sysent.c
cvs rdiff -u -r1.89 -r1.90 \
src/sys/compat/linux/arch/powerpc/linux_syscallargs.h \
src/sys/compat/linux/arch/powerpc/linux_syscalls.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/compat/linux/arch/aarch64/linux_syscall.h
diff -u src/sys/compat/linux/arch/aarch64/linux_syscall.h:1.1 src/sys/compat/linux/arch/aarch64/linux_syscall.h:1.2
--- src/sys/compat/linux/arch/aarch64/linux_syscall.h:1.1	Thu Sep 23 06:56:27 2021
+++ src/sys/compat/linux/arch/aarch64/linux_syscall.h	Wed Nov 24 18:57:24 2021
@@ -1,10 +1,10 @@
-/* $NetBSD: linux_syscall.h,v 1.1 2021/09/23 06:56:27 ryo Exp $ */
+/* $NetBSD: linux_syscall.h,v 1.2 2021/11/24 18:57:24 ryo Exp $ */
 
 /*
  * System call numbers.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD
+ * created from	NetBSD: syscalls.master,v 1.1 2021/09/23 06:56:27 ryo Exp
  */
 
 #ifndef _LINUX_SYS_SYSCALL_H_
@@ -582,6 +582,9 @@
 /* syscall: "sendmmsg" ret: "int" args: "int" "struct linux_mmsghdr *" "unsigned int" "unsigned int" */
 #define	LINUX_SYS_sendmmsg	269
 
+/* syscall: "getrandom" ret: "ssize_t" args: "void *" "size_t" "unsigned int" */
+#define	LINUX_SYS_getrandom	278
+
 /* syscall: "nosys" ret: "int" args: */
 #define	LINUX_SYS_nosys	440
 
Index: src/sys/compat/linux/arch/aarch64/linux_syscallargs.h
diff -u src/sys/compat/linux/arch/aarch64/linux_syscallargs.h:1.1 src/sys/compat/linux/arch/aarch64/linux_syscallargs.h:1.2
--- src/sys/compat/linux/arch/aarch64/linux_syscallargs.h:1.1	Thu Sep 23 06:56:27 2021
+++ src/sys/compat/linux/arch/aarch64/linux_syscallargs.h	Wed Nov 24 18:57:24 2021
@@ -1,10 +1,10 @@
-/* $NetBSD: linux_syscallargs.h,v 1.1 2021/09/23 06:56:27 ryo Exp $ */
+/* $NetBSD: linux_syscallargs.h,v 1.2 2021/11/24 18:57:24 ryo Exp $ */
 
 /*
  * System call argument lists.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD
+ * created from	NetBSD: syscalls.master,v 1.1 2021/09/23 06:56:27 ryo Exp
  */
 
 #ifndef _LINUX_SYS_SYSCALLARGS_H_
@@ -965,6 +965,8 @@ struct linux_sys_sendmmsg_args {
 };
 check_syscall_args(linux_sys_sendmmsg)
 
+struct sys_getrandom_args;
+
 /*
  * System call prototypes.
  */
@@ -1352,6 +1354,8 @@ int	linux_sys_wait4(struct lwp *, const 
 
 int	linux_sys_sendmmsg(struct lwp *, const struct linux_sys_sendmmsg_args *, register_t *);
 
+int	sys_getrandom(struct lwp *, const struct sys_getrandom_args *, register_t *);
+
 int	linux_sys_nosys(struct lwp *, const void *, register_t *);
 
 #endif /* _LINUX_SYS_SYSCALLARGS_H_ */
Index: src/sys/compat/linux/arch/aarch64/linux_syscalls.c
diff -u src/sys/compat/linux/arch/aarch64/linux_syscalls.c:1.1 src/sys/compat/linux/arch/aarch64/linux_syscalls.c:1.2
--- src/sys/compat/linux/arch/aarch64/linux_syscalls.c:1.1	Thu Sep 23 06:56:27 2021
+++ src/sys/compat/linux/arch/aarc

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

2021-11-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Nov 24 21:34:34 UTC 2021

Modified Files:
src/tests/usr.bin/indent: fmt_decl.c lsym_case_label.c

Log Message:
tests/indent: demonstrate several real-life formatting bugs

Collected by indenting usr.bin/make with the default profile.

The heuristic for distinguishing between type names and other
identifiers is way too primitive, it seems to have stopped evolving
somewhere before function prototypes were standardized in C90, at least
it handles function prototypes poorly.

indent-2014.09.04.04.06.07 added seemingly random spaces to
declarations, which were fixed in indent-2019.04.04.15.27.35, which came
5 years later. The latter commit introduced many new bugs, but it also
fixed this one.

The wrongly indented struct member declaration for HashTable has been
there since at least indent-2000.10.11.14.46.04.

The wrongly indented initializer expression was added in
indent-2019.04.04.15.27.35 (see above).


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/tests/usr.bin/indent/fmt_decl.c
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/indent/lsym_case_label.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-11-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Nov 24 21:34:34 UTC 2021

Modified Files:
src/tests/usr.bin/indent: fmt_decl.c lsym_case_label.c

Log Message:
tests/indent: demonstrate several real-life formatting bugs

Collected by indenting usr.bin/make with the default profile.

The heuristic for distinguishing between type names and other
identifiers is way too primitive, it seems to have stopped evolving
somewhere before function prototypes were standardized in C90, at least
it handles function prototypes poorly.

indent-2014.09.04.04.06.07 added seemingly random spaces to
declarations, which were fixed in indent-2019.04.04.15.27.35, which came
5 years later. The latter commit introduced many new bugs, but it also
fixed this one.

The wrongly indented struct member declaration for HashTable has been
there since at least indent-2000.10.11.14.46.04.

The wrongly indented initializer expression was added in
indent-2019.04.04.15.27.35 (see above).


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/tests/usr.bin/indent/fmt_decl.c
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/indent/lsym_case_label.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/fmt_decl.c
diff -u src/tests/usr.bin/indent/fmt_decl.c:1.22 src/tests/usr.bin/indent/fmt_decl.c:1.23
--- src/tests/usr.bin/indent/fmt_decl.c:1.22	Sun Nov 21 11:02:25 2021
+++ src/tests/usr.bin/indent/fmt_decl.c	Wed Nov 24 21:34:34 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fmt_decl.c,v 1.22 2021/11/21 11:02:25 rillig Exp $	*/
+/*	$NetBSD: fmt_decl.c,v 1.23 2021/11/24 21:34:34 rillig Exp $	*/
 /* $FreeBSD: head/usr.bin/indent/tests/declarations.0 334478 2018-06-01 09:41:15Z pstef $ */
 
 /*
@@ -571,3 +571,209 @@ buffer_add(buffer * buf, char ch)
 	*buf->e++ = ch;
 }
 #indent end
+
+
+/*
+ * Indent gets easily confused by type names it does not know about.
+ */
+#indent input
+static Token
+ToToken(bool cond)
+{
+}
+#indent end
+
+#indent run
+static Token
+/* $ FIXME: missing space between ')' and '{'. */
+ToToken(bool cond){
+}
+#indent end
+
+#indent run-equals-input -TToken
+
+
+/*
+ * Indent gets easily confused by unknown type names in struct declarations.
+ */
+#indent input
+typedef struct OpenDirs {
+	CachedDirList	list;
+	HashTable /* of CachedDirListNode */ table;
+}		OpenDirs;
+#indent end
+
+/* FIXME: The word 'HashTable' must not be aligned like a member name. */
+#indent run
+typedef struct OpenDirs {
+	CachedDirList	list;
+			HashTable /* of CachedDirListNode */ table;
+}		OpenDirs;
+#indent end
+
+#indent run-equals-input -THashTable
+
+
+/*
+ * Indent gets easily confused by unknown type names, even in declarations
+ * that are syntactically unambiguous.
+ */
+#indent input
+static CachedDir *dot = NULL;
+#indent end
+
+/* FIXME: The space after '*' is wrong. */
+#indent run
+static CachedDir * dot = NULL;
+#indent end
+
+#indent run-equals-input -TCachedDir
+
+
+/*
+ * Indent gets easily confused by unknown type names in declarations.
+ */
+#indent input
+static CachedDir *
+CachedDir_New(const char *name)
+{
+}
+#indent end
+
+/* FIXME: The space between '){' is missing. */
+/* FIXME: The '{' must be in column 1 of the next line. */
+#indent run
+static CachedDir *
+CachedDir_New(const char *name){
+}
+#indent end
+
+
+/*
+ * Indent gets easily confused by unknown type names in function declarations.
+ */
+#indent input
+static CachedDir *
+CachedDir_Ref(CachedDir *dir)
+{
+}
+#indent end
+
+/* FIXME: Extraneous ' ' between '*' and 'dir'. */
+/* FIXME: The '{' must be in column 1 of the next line. */
+#indent run
+static CachedDir *
+CachedDir_Ref(CachedDir * dir) {
+}
+#indent end
+
+
+/*
+ * In some cases, indent does not get confused by unknown type names. At least
+ * it gets the placement of the '{' correct in this example.
+ */
+#indent input
+static bool
+HashEntry_KeyEquals(const HashEntry *he, Substring key)
+{
+}
+#indent end
+
+#indent run
+static bool
+HashEntry_KeyEquals(const HashEntry * he, Substring key)
+{
+}
+#indent end
+
+
+/*
+ * Indent doesn't notice that the two '*' are in a declaration, instead it
+ * interprets the first '*' as a binary operator.
+ */
+#indent input
+static void
+CachedDir_Assign(CachedDir **var, CachedDir *dir)
+{
+}
+#indent end
+
+/* FIXME: Extraneous space between '*' and '*'. */
+#indent run
+static void
+CachedDir_Assign(CachedDir * *var, CachedDir * dir)
+{
+}
+#indent end
+
+#indent run-equals-input -TCachedDir
+
+
+/*
+ * All initializer expressions after the first one are indented as if they
+ * would be statement continuations. Maybe the comma is interpreted as a
+ * binary operator instead of being a separator.
+ */
+#indent input
+static Shell shells[] = {
+	{
+		first,
+		second,
+	},
+};
+#indent end
+
+#indent run
+static Shell shells[] = {
+	{
+		first,
+/* $ FIXME: The identifier 'second' gets indented too far. */
+			second,
+	},
+};
+#indent end

CVS commit: src/sys/net

2021-11-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Nov 25 00:49:34 UTC 2021

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

Log Message:
Better counting for ierrors, iqdrops and noproto in ether_input().

 - Use if_noproto for unknown or unsupported protocols.
 - Use if_ierrors for wrong mbuf or oversized frame.


To generate a diff of this commit:
cvs rdiff -u -r1.304 -r1.305 src/sys/net/if_ethersubr.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-11-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Nov 25 00:49:34 UTC 2021

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

Log Message:
Better counting for ierrors, iqdrops and noproto in ether_input().

 - Use if_noproto for unknown or unsupported protocols.
 - Use if_ierrors for wrong mbuf or oversized frame.


To generate a diff of this commit:
cvs rdiff -u -r1.304 -r1.305 src/sys/net/if_ethersubr.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_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.304 src/sys/net/if_ethersubr.c:1.305
--- src/sys/net/if_ethersubr.c:1.304	Mon Nov 15 07:07:05 2021
+++ src/sys/net/if_ethersubr.c	Thu Nov 25 00:49:34 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.304 2021/11/15 07:07:05 yamaguchi Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.305 2021/11/25 00:49:34 msaitoh Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.304 2021/11/15 07:07:05 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.305 2021/11/25 00:49:34 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -584,7 +584,7 @@ ether_input_llc(struct ifnet *ifp, struc
 	struct llc *l;
 
 	if (m->m_len < sizeof(*eh) + sizeof(struct llc))
-		goto drop;
+		goto error;
 
 	l = (struct llc *)(eh+1);
 	switch (l->llc_dsap) {
@@ -593,7 +593,7 @@ ether_input_llc(struct ifnet *ifp, struc
 		switch (l->llc_control) {
 		case LLC_UI:
 			if (l->llc_ssap != LLC_SNAP_LSAP)
-goto drop;
+goto error;
 
 			if (memcmp(&(l->llc_snap_org_code)[0],
 			at_org_code, sizeof(at_org_code)) == 0 &&
@@ -618,21 +618,25 @@ ether_input_llc(struct ifnet *ifp, struc
 			}
 
 		default:
-			goto drop;
+			goto error;
 		}
 		break;
 #endif
 	default:
-		goto drop;
+		goto noproto;
 	}
 
 	KASSERT(inq != NULL);
 	IFQ_ENQUEUE_ISR(inq, m, isr);
 	return;
 
-drop:
+noproto:
 	m_freem(m);
-	if_statinc(ifp, if_ierrors); /* XXX should have a dedicated counter? */
+	if_statinc(ifp, if_noproto);
+	return;
+error:
+	m_freem(m);
+	if_statinc(ifp, if_ierrors);
 	return;
 }
 #endif /* defined (LLC) || defined (NETATALK) */
@@ -699,7 +703,7 @@ ether_input(struct ifnet *ifp, struct mb
 		}
 		mutex_exit(&bigpktpps_lock);
 #endif
-		goto drop;
+		goto error;
 	}
 
 	if (ETHER_IS_MULTICAST(eh->ether_dhost)) {
@@ -795,7 +799,7 @@ ether_input(struct ifnet *ifp, struct mb
 		vlan_input(ifp, m);
 		return;
 #else
-		goto drop;
+		goto noproto;
 #endif
 	}
 
@@ -832,7 +836,7 @@ ether_input(struct ifnet *ifp, struct mb
 			return;
 		} else
 #endif
-			goto drop;
+			goto noproto;
 	}
 
 #if NPPPOE > 0
@@ -849,7 +853,7 @@ ether_input(struct ifnet *ifp, struct mb
 		uint8_t subtype;
 
 		if (m->m_pkthdr.len < sizeof(*eh) + sizeof(subtype))
-			goto drop;
+			goto error;
 
 		m_copydata(m, sizeof(*eh), sizeof(subtype), &subtype);
 		switch (subtype) {
@@ -897,7 +901,7 @@ ether_input(struct ifnet *ifp, struct mb
 		ether_input_llc(ifp, m, eh);
 		return;
 #else
-		goto error;
+		goto noproto;
 #endif
 	}
 
@@ -927,7 +931,7 @@ ether_input(struct ifnet *ifp, struct mb
 #ifdef INET6
 	case ETHERTYPE_IPV6:
 		if (__predict_false(!in6_present))
-			goto drop;
+			goto noproto;
 #ifdef GATEWAY
 		if (ip6flow_fastforward(&m))
 			return;
@@ -955,7 +959,7 @@ ether_input(struct ifnet *ifp, struct mb
 #endif
 
 	default:
-		goto drop;
+		goto noproto;
 	}
 
 	if (__predict_true(pktq)) {
@@ -976,11 +980,15 @@ ether_input(struct ifnet *ifp, struct mb
 
 drop:
 	m_freem(m);
-	if_statinc(ifp, if_iqdrops); /* XXX should have a dedicated counter? */
+	if_statinc(ifp, if_iqdrops);
+	return;
+noproto:
+	m_freem(m);
+	if_statinc(ifp, if_noproto);
 	return;
 error:
 	m_freem(m);
-	if_statinc(ifp, if_ierrors); /* XXX should have a dedicated counter? */
+	if_statinc(ifp, if_ierrors);
 	return;
 }
 



CVS commit: src/sys/compat/linux/common

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Nov 25 02:08:55 UTC 2021

Modified Files:
src/sys/compat/linux/common: linux_file64.c

Log Message:
rename bsd_to_linux_stat() to bsd_to_linux_stat64() to avoid confusion.
There is a static function with the same name in linux/common/linux_file.c.

NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/compat/linux/common/linux_file64.c

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



CVS commit: src/sys/compat/linux/common

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Nov 25 02:08:55 UTC 2021

Modified Files:
src/sys/compat/linux/common: linux_file64.c

Log Message:
rename bsd_to_linux_stat() to bsd_to_linux_stat64() to avoid confusion.
There is a static function with the same name in linux/common/linux_file.c.

NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/compat/linux/common/linux_file64.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/compat/linux/common/linux_file64.c
diff -u src/sys/compat/linux/common/linux_file64.c:1.64 src/sys/compat/linux/common/linux_file64.c:1.65
--- src/sys/compat/linux/common/linux_file64.c:1.64	Thu Sep 23 06:56:27 2021
+++ src/sys/compat/linux/common/linux_file64.c	Thu Nov 25 02:08:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_file64.c,v 1.64 2021/09/23 06:56:27 ryo Exp $	*/
+/*	$NetBSD: linux_file64.c,v 1.65 2021/11/25 02:08:55 ryo Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_file64.c,v 1.64 2021/09/23 06:56:27 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_file64.c,v 1.65 2021/11/25 02:08:55 ryo Exp $");
 
 #include 
 #include 
@@ -67,7 +67,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_file64
 
 #include 
 
-static void bsd_to_linux_stat(struct stat *, struct linux_stat64 *);
+static void bsd_to_linux_stat64(struct stat *, struct linux_stat64 *);
 
 /*
  * Convert a NetBSD stat structure to a Linux stat structure.
@@ -78,7 +78,7 @@ static void bsd_to_linux_stat(struct sta
  * things against constant major device numbers? sigh)
  */
 static void
-bsd_to_linux_stat(struct stat *bsp, struct linux_stat64 *lsp)
+bsd_to_linux_stat64(struct stat *bsp, struct linux_stat64 *lsp)
 {
 	memset(lsp, 0, sizeof(*lsp));
 	lsp->lst_dev = linux_fakedev(bsp->st_dev, 0);
@@ -126,7 +126,7 @@ linux_sys_fstat64(struct lwp *l, const s
 	if (error != 0)
 		return error;
 
-	bsd_to_linux_stat(&tmpst, &tmplst);
+	bsd_to_linux_stat64(&tmpst, &tmplst);
 
 	return copyout(&tmplst, SCARG(uap, sp), sizeof tmplst);
 }
@@ -143,7 +143,7 @@ linux_do_stat64(struct lwp *l, const str
 	if (error != 0)
 		return error;
 
-	bsd_to_linux_stat(&tmpst, &tmplst);
+	bsd_to_linux_stat64(&tmpst, &tmplst);
 
 	return copyout(&tmplst, SCARG(uap, sp), sizeof tmplst);
 }
@@ -225,7 +225,7 @@ linux_sys_fstatat64(struct lwp *l, const
 		return error;
 
 done:
-	bsd_to_linux_stat(&tmpst, &tmplst);
+	bsd_to_linux_stat64(&tmpst, &tmplst);
 
 	return copyout(&tmplst, SCARG(uap, sp), sizeof tmplst);
 }



CVS commit: src/sys/compat/linux/common

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Nov 25 02:09:23 UTC 2021

Modified Files:
src/sys/compat/linux/common: linux_file64.c

Log Message:
rename bsd_to_linux_stat() to bsd_to_linux_stat64() to avoid confusion.
There is a static function with the same name in linux/common/linux_file.c.

NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.66 src/sys/compat/linux/common/linux_file64.c

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



CVS commit: src/sys/compat/linux/common

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Nov 25 02:09:23 UTC 2021

Modified Files:
src/sys/compat/linux/common: linux_file64.c

Log Message:
rename bsd_to_linux_stat() to bsd_to_linux_stat64() to avoid confusion.
There is a static function with the same name in linux/common/linux_file.c.

NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.66 src/sys/compat/linux/common/linux_file64.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/compat/linux/common/linux_file64.c
diff -u src/sys/compat/linux/common/linux_file64.c:1.64 src/sys/compat/linux/common/linux_file64.c:1.66
--- src/sys/compat/linux/common/linux_file64.c:1.64	Thu Sep 23 06:56:27 2021
+++ src/sys/compat/linux/common/linux_file64.c	Thu Nov 25 02:09:23 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_file64.c,v 1.64 2021/09/23 06:56:27 ryo Exp $	*/
+/*	$NetBSD: linux_file64.c,v 1.66 2021/11/25 02:09:23 ryo Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_file64.c,v 1.64 2021/09/23 06:56:27 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_file64.c,v 1.66 2021/11/25 02:09:23 ryo Exp $");
 
 #include 
 #include 
@@ -67,7 +67,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_file64
 
 #include 
 
-static void bsd_to_linux_stat(struct stat *, struct linux_stat64 *);
+static void bsd_to_linux_stat64(struct stat *, struct linux_stat64 *);
 
 /*
  * Convert a NetBSD stat structure to a Linux stat structure.
@@ -78,7 +78,7 @@ static void bsd_to_linux_stat(struct sta
  * things against constant major device numbers? sigh)
  */
 static void
-bsd_to_linux_stat(struct stat *bsp, struct linux_stat64 *lsp)
+bsd_to_linux_stat64(struct stat *bsp, struct linux_stat64 *lsp)
 {
 	memset(lsp, 0, sizeof(*lsp));
 	lsp->lst_dev = linux_fakedev(bsp->st_dev, 0);
@@ -126,7 +126,7 @@ linux_sys_fstat64(struct lwp *l, const s
 	if (error != 0)
 		return error;
 
-	bsd_to_linux_stat(&tmpst, &tmplst);
+	bsd_to_linux_stat64(&tmpst, &tmplst);
 
 	return copyout(&tmplst, SCARG(uap, sp), sizeof tmplst);
 }
@@ -143,7 +143,7 @@ linux_do_stat64(struct lwp *l, const str
 	if (error != 0)
 		return error;
 
-	bsd_to_linux_stat(&tmpst, &tmplst);
+	bsd_to_linux_stat64(&tmpst, &tmplst);
 
 	return copyout(&tmplst, SCARG(uap, sp), sizeof tmplst);
 }
@@ -225,7 +225,7 @@ linux_sys_fstatat64(struct lwp *l, const
 		return error;
 
 done:
-	bsd_to_linux_stat(&tmpst, &tmplst);
+	bsd_to_linux_stat64(&tmpst, &tmplst);
 
 	return copyout(&tmplst, SCARG(uap, sp), sizeof tmplst);
 }



CVS commit: src/sys/compat

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Nov 25 02:27:09 UTC 2021

Modified Files:
src/sys/compat/linux/common: linux_fcntl.h linux_file64.c linux_types.h
src/sys/compat/linux32/common: linux32_stat.c linux32_types.h

Log Message:
- Add compat_linux statx(2) syscall.
- The AT_EMPTY_PATH processing from the modification of
  sys/compat/linux/common/linux_file64.c r1.63 has been separated, and made
  common to linux_statat(), so that it can be used not only by
  linux32_sys_fstatat64() but also by other *statat() variants.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/compat/linux/common/linux_fcntl.h
cvs rdiff -u -r1.66 -r1.67 src/sys/compat/linux/common/linux_file64.c
cvs rdiff -u -r1.32 -r1.33 src/sys/compat/linux/common/linux_types.h
cvs rdiff -u -r1.17 -r1.18 src/sys/compat/linux32/common/linux32_stat.c
cvs rdiff -u -r1.15 -r1.16 src/sys/compat/linux32/common/linux32_types.h

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



CVS commit: src/sys/compat

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Nov 25 02:27:09 UTC 2021

Modified Files:
src/sys/compat/linux/common: linux_fcntl.h linux_file64.c linux_types.h
src/sys/compat/linux32/common: linux32_stat.c linux32_types.h

Log Message:
- Add compat_linux statx(2) syscall.
- The AT_EMPTY_PATH processing from the modification of
  sys/compat/linux/common/linux_file64.c r1.63 has been separated, and made
  common to linux_statat(), so that it can be used not only by
  linux32_sys_fstatat64() but also by other *statat() variants.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/compat/linux/common/linux_fcntl.h
cvs rdiff -u -r1.66 -r1.67 src/sys/compat/linux/common/linux_file64.c
cvs rdiff -u -r1.32 -r1.33 src/sys/compat/linux/common/linux_types.h
cvs rdiff -u -r1.17 -r1.18 src/sys/compat/linux32/common/linux32_stat.c
cvs rdiff -u -r1.15 -r1.16 src/sys/compat/linux32/common/linux32_types.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/compat/linux/common/linux_fcntl.h
diff -u src/sys/compat/linux/common/linux_fcntl.h:1.19 src/sys/compat/linux/common/linux_fcntl.h:1.20
--- src/sys/compat/linux/common/linux_fcntl.h:1.19	Thu Sep 23 06:56:27 2021
+++ src/sys/compat/linux/common/linux_fcntl.h	Thu Nov 25 02:27:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_fcntl.h,v 1.19 2021/09/23 06:56:27 ryo Exp $	*/
+/*	$NetBSD: linux_fcntl.h,v 1.20 2021/11/25 02:27:08 ryo Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -52,6 +52,8 @@
 
 int linux_to_bsd_ioflags(int);
 int linux_to_bsd_atflags(int);
+int bsd_to_linux_statx(struct stat *, struct linux_statx *, unsigned int);
+int linux_statat(struct lwp *, int, const char *, int, struct stat *);
 
 struct linux_flock {
 	short   l_type;

Index: src/sys/compat/linux/common/linux_file64.c
diff -u src/sys/compat/linux/common/linux_file64.c:1.66 src/sys/compat/linux/common/linux_file64.c:1.67
--- src/sys/compat/linux/common/linux_file64.c:1.66	Thu Nov 25 02:09:23 2021
+++ src/sys/compat/linux/common/linux_file64.c	Thu Nov 25 02:27:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_file64.c,v 1.66 2021/11/25 02:09:23 ryo Exp $	*/
+/*	$NetBSD: linux_file64.c,v 1.67 2021/11/25 02:27:08 ryo Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_file64.c,v 1.66 2021/11/25 02:09:23 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_file64.c,v 1.67 2021/11/25 02:27:08 ryo Exp $");
 
 #include 
 #include 
@@ -65,6 +65,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_file64
 #include 
 #include 
 
+#include 
 #include 
 
 static void bsd_to_linux_stat64(struct stat *, struct linux_stat64 *);
@@ -107,6 +108,73 @@ bsd_to_linux_stat64(struct stat *bsp, st
 #  endif
 }
 
+int
+bsd_to_linux_statx(struct stat *st, struct linux_statx *stx,
+unsigned int mask)
+{
+	if (mask & STATX__RESERVED)
+		return EINVAL;
+
+	/* XXX: STATX_MNT_ID is not supported */
+	unsigned int rmask = STATX_TYPE | STATX_MODE | STATX_NLINK |
+	STATX_UID | STATX_GID | STATX_ATIME | STATX_MTIME | STATX_CTIME |
+	STATX_INO | STATX_SIZE | STATX_BLOCKS | STATX_BTIME;
+
+	memset(stx, 0, sizeof(*stx));
+
+	if ((st->st_flags & UF_NODUMP) != 0)
+		stx->stx_attributes |= STATX_ATTR_NODUMP;
+	if ((st->st_flags & (UF_IMMUTABLE|SF_IMMUTABLE)) != 0)
+		stx->stx_attributes |= STATX_ATTR_IMMUTABLE;
+	if ((st->st_flags & (UF_APPEND|SF_APPEND)) != 0)
+		stx->stx_attributes |= STATX_ATTR_APPEND;
+
+	stx->stx_attributes_mask =
+	STATX_ATTR_NODUMP | STATX_ATTR_IMMUTABLE | STATX_ATTR_APPEND;
+
+	stx->stx_blksize = st->st_blksize;
+
+	stx->stx_nlink = st->st_nlink;
+	stx->stx_uid = st->st_uid;
+	stx->stx_gid = st->st_gid;
+	stx->stx_mode |= st->st_mode & S_IFMT;
+	stx->stx_mode |= st->st_mode & ~S_IFMT;
+	stx->stx_ino = st->st_ino;
+	stx->stx_size = st->st_size;
+	stx->stx_blocks = st->st_blocks;
+
+	stx->stx_atime.tv_sec = st->st_atime;
+	stx->stx_atime.tv_nsec = st->st_atimensec;
+
+	/* some filesystem has no birthtime returns 0 or -1 */
+	if ((st->st_birthtime == 0 && st->st_birthtimensec == 0) ||
+	(st->st_birthtime == (time_t)-1 &&
+	st->st_birthtimensec == (long)-1)) {
+		rmask &= ~STATX_BTIME;
+	} else {
+		stx->stx_btime.tv_sec = st->st_birthtime;
+		stx->stx_btime.tv_nsec = st->st_birthtimensec;
+	}
+
+	stx->stx_ctime.tv_sec = st->st_ctime;
+	stx->stx_ctime.tv_nsec = st->st_ctimensec;
+
+	stx->stx_mtime.tv_sec = st->st_mtime;
+	stx->stx_mtime.tv_nsec = st->st_mtimensec;
+
+	if (S_ISCHR(st->st_mode) || S_ISBLK(st->st_mode)) {
+		stx->stx_rdev_major = major(st->st_rdev);
+		stx->stx_rdev_minor = minor(st->st_rdev);
+	} else {
+		stx->stx_dev_major = major(st->st_rdev);
+		stx->stx_dev_minor = minor(st->st_rdev);
+	}
+
+	stx->stx_mask = rmask;
+
+	return 0;
+}
+
 /*
  * The stat functions below are plain sailing. stat and lstat are handled
  * by one function to a

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

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Nov 25 02:29:33 UTC 2021

Modified Files:
src/sys/compat/linux/arch/aarch64: syscalls.master

Log Message:
add statx(2) syscall entry


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/linux/arch/aarch64/syscalls.master

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



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

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Nov 25 02:29:33 UTC 2021

Modified Files:
src/sys/compat/linux/arch/aarch64: syscalls.master

Log Message:
add statx(2) syscall entry


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/linux/arch/aarch64/syscalls.master

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

Modified files:

Index: src/sys/compat/linux/arch/aarch64/syscalls.master
diff -u src/sys/compat/linux/arch/aarch64/syscalls.master:1.2 src/sys/compat/linux/arch/aarch64/syscalls.master:1.3
--- src/sys/compat/linux/arch/aarch64/syscalls.master:1.2	Wed Nov 24 18:52:13 2021
+++ src/sys/compat/linux/arch/aarch64/syscalls.master	Thu Nov 25 02:29:33 2021
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.2 2021/11/24 18:52:13 ryo Exp $
+	$NetBSD: syscalls.master,v 1.3 2021/11/25 02:29:33 ryo Exp $
 
 ;	@(#)syscalls.master	8.1 (Berkeley) 7/19/93
 
@@ -523,7 +523,9 @@
 288	UNIMPL		pkey_mprotect
 289	UNIMPL		pkey_alloc
 290	UNIMPL		pkey_free
-291	UNIMPL		statx
+291	STD		{ int|linux_sys||statx(int fd, const char *path, \
+			int flag, unsigned int mask, \
+			struct linux_statx *sp); }
 292	UNIMPL		io_pgetevents
 293	UNIMPL		rseq
 294	UNIMPL		kexec_file_load



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

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Nov 25 02:32:24 UTC 2021

Modified Files:
src/sys/compat/linux/arch/aarch64: linux_syscall.h linux_syscallargs.h
linux_syscalls.c linux_sysent.c linux_systrace_args.c

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/linux/arch/aarch64/linux_syscall.h \
src/sys/compat/linux/arch/aarch64/linux_syscallargs.h \
src/sys/compat/linux/arch/aarch64/linux_syscalls.c \
src/sys/compat/linux/arch/aarch64/linux_sysent.c \
src/sys/compat/linux/arch/aarch64/linux_systrace_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/sys/compat/linux/arch/aarch64/linux_syscall.h
diff -u src/sys/compat/linux/arch/aarch64/linux_syscall.h:1.2 src/sys/compat/linux/arch/aarch64/linux_syscall.h:1.3
--- src/sys/compat/linux/arch/aarch64/linux_syscall.h:1.2	Wed Nov 24 18:57:24 2021
+++ src/sys/compat/linux/arch/aarch64/linux_syscall.h	Thu Nov 25 02:32:24 2021
@@ -1,10 +1,10 @@
-/* $NetBSD: linux_syscall.h,v 1.2 2021/11/24 18:57:24 ryo Exp $ */
+/* $NetBSD: linux_syscall.h,v 1.3 2021/11/25 02:32:24 ryo Exp $ */
 
 /*
  * System call numbers.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.1 2021/09/23 06:56:27 ryo Exp
+ * created from	NetBSD: syscalls.master,v 1.3 2021/11/25 02:29:33 ryo Exp
  */
 
 #ifndef _LINUX_SYS_SYSCALL_H_
@@ -585,6 +585,9 @@
 /* syscall: "getrandom" ret: "ssize_t" args: "void *" "size_t" "unsigned int" */
 #define	LINUX_SYS_getrandom	278
 
+/* syscall: "statx" ret: "int" args: "int" "const char *" "int" "unsigned int" "struct linux_statx *" */
+#define	LINUX_SYS_statx	291
+
 /* syscall: "nosys" ret: "int" args: */
 #define	LINUX_SYS_nosys	440
 
Index: src/sys/compat/linux/arch/aarch64/linux_syscallargs.h
diff -u src/sys/compat/linux/arch/aarch64/linux_syscallargs.h:1.2 src/sys/compat/linux/arch/aarch64/linux_syscallargs.h:1.3
--- src/sys/compat/linux/arch/aarch64/linux_syscallargs.h:1.2	Wed Nov 24 18:57:24 2021
+++ src/sys/compat/linux/arch/aarch64/linux_syscallargs.h	Thu Nov 25 02:32:24 2021
@@ -1,10 +1,10 @@
-/* $NetBSD: linux_syscallargs.h,v 1.2 2021/11/24 18:57:24 ryo Exp $ */
+/* $NetBSD: linux_syscallargs.h,v 1.3 2021/11/25 02:32:24 ryo Exp $ */
 
 /*
  * System call argument lists.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.1 2021/09/23 06:56:27 ryo Exp
+ * created from	NetBSD: syscalls.master,v 1.3 2021/11/25 02:29:33 ryo Exp
  */
 
 #ifndef _LINUX_SYS_SYSCALLARGS_H_
@@ -967,6 +967,15 @@ check_syscall_args(linux_sys_sendmmsg)
 
 struct sys_getrandom_args;
 
+struct linux_sys_statx_args {
+	syscallarg(int) fd;
+	syscallarg(const char *) path;
+	syscallarg(int) flag;
+	syscallarg(unsigned int) mask;
+	syscallarg(struct linux_statx *) sp;
+};
+check_syscall_args(linux_sys_statx)
+
 /*
  * System call prototypes.
  */
@@ -1356,6 +1365,8 @@ int	linux_sys_sendmmsg(struct lwp *, con
 
 int	sys_getrandom(struct lwp *, const struct sys_getrandom_args *, register_t *);
 
+int	linux_sys_statx(struct lwp *, const struct linux_sys_statx_args *, register_t *);
+
 int	linux_sys_nosys(struct lwp *, const void *, register_t *);
 
 #endif /* _LINUX_SYS_SYSCALLARGS_H_ */
Index: src/sys/compat/linux/arch/aarch64/linux_syscalls.c
diff -u src/sys/compat/linux/arch/aarch64/linux_syscalls.c:1.2 src/sys/compat/linux/arch/aarch64/linux_syscalls.c:1.3
--- src/sys/compat/linux/arch/aarch64/linux_syscalls.c:1.2	Wed Nov 24 18:57:24 2021
+++ src/sys/compat/linux/arch/aarch64/linux_syscalls.c	Thu Nov 25 02:32:24 2021
@@ -1,14 +1,14 @@
-/* $NetBSD: linux_syscalls.c,v 1.2 2021/11/24 18:57:24 ryo Exp $ */
+/* $NetBSD: linux_syscalls.c,v 1.3 2021/11/25 02:32:24 ryo Exp $ */
 
 /*
  * System call names.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.1 2021/09/23 06:56:27 ryo Exp
+ * created from	NetBSD: syscalls.master,v 1.3 2021/11/25 02:29:33 ryo Exp
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_syscalls.c,v 1.2 2021/11/24 18:57:24 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_syscalls.c,v 1.3 2021/11/25 02:32:24 ryo Exp $");
 
 #if defined(_KERNEL_OPT)
 #if defined(_KERNEL_OPT)
@@ -352,7 +352,7 @@ const char *const linux_syscallnames[] =
 	/* 288 */	"#288 (unimplemented pkey_mprotect)",
 	/* 289 */	"#289 (unimplemented pkey_alloc)",
 	/* 290 */	"#290 (unimplemented pkey_free)",
-	/* 291 */	"#291 (unimplemented statx)",
+	/* 291 */	"statx",
 	/* 292 */	"#292 (unimplemented io_pgetevents)",
 	/* 293 */	"#293 (unimplemented rseq)",
 	/* 294 */	"#294 (unimplemented kexec_file_load)",
@@ -890,7 +890,7 @@ const char *const altlinux_syscallnames[
 	/* 288 */	NULL, /* unimplemented pkey_mprotect */
 	/* 289 */	NULL, /* unimplemented pkey_alloc */
 	/* 290 */	NULL, /* unimplemented pkey_free */
-	/* 291 */	NULL, /* unimplemented stat

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

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Nov 25 02:32:24 UTC 2021

Modified Files:
src/sys/compat/linux/arch/aarch64: linux_syscall.h linux_syscallargs.h
linux_syscalls.c linux_sysent.c linux_systrace_args.c

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/linux/arch/aarch64/linux_syscall.h \
src/sys/compat/linux/arch/aarch64/linux_syscallargs.h \
src/sys/compat/linux/arch/aarch64/linux_syscalls.c \
src/sys/compat/linux/arch/aarch64/linux_sysent.c \
src/sys/compat/linux/arch/aarch64/linux_systrace_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/compat/linux32

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Nov 25 02:35:00 UTC 2021

Modified Files:
src/sys/compat/linux32/common: linux32_fcntl.c
Added Files:
src/sys/compat/linux32/arch/amd64: linux32_fcntl.h
src/sys/compat/linux32/common: linux32_fcntl.h

Log Message:
- Use LINUX32_F_xxx instead of LINUX_F_xxx for compat_linux32.
  aarch64 and arm have different values.
- Compile linux32_sys_fadvise64() only if the syscall is required.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/compat/linux32/arch/amd64/linux32_fcntl.h
cvs rdiff -u -r1.10 -r1.11 src/sys/compat/linux32/common/linux32_fcntl.c
cvs rdiff -u -r0 -r1.1 src/sys/compat/linux32/common/linux32_fcntl.h

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



CVS commit: src/sys/compat/linux32

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Nov 25 02:35:00 UTC 2021

Modified Files:
src/sys/compat/linux32/common: linux32_fcntl.c
Added Files:
src/sys/compat/linux32/arch/amd64: linux32_fcntl.h
src/sys/compat/linux32/common: linux32_fcntl.h

Log Message:
- Use LINUX32_F_xxx instead of LINUX_F_xxx for compat_linux32.
  aarch64 and arm have different values.
- Compile linux32_sys_fadvise64() only if the syscall is required.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/compat/linux32/arch/amd64/linux32_fcntl.h
cvs rdiff -u -r1.10 -r1.11 src/sys/compat/linux32/common/linux32_fcntl.c
cvs rdiff -u -r0 -r1.1 src/sys/compat/linux32/common/linux32_fcntl.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/compat/linux32/common/linux32_fcntl.c
diff -u src/sys/compat/linux32/common/linux32_fcntl.c:1.10 src/sys/compat/linux32/common/linux32_fcntl.c:1.11
--- src/sys/compat/linux32/common/linux32_fcntl.c:1.10	Sat May 17 09:30:07 2014
+++ src/sys/compat/linux32/common/linux32_fcntl.c	Thu Nov 25 02:35:00 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_fcntl.c,v 1.10 2014/05/17 09:30:07 njoly Exp $ */
+/*	$NetBSD: linux32_fcntl.c,v 1.11 2021/11/25 02:35:00 ryo Exp $ */
 
 /*-
  * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -33,7 +33,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: linux32_fcntl.c,v 1.10 2014/05/17 09:30:07 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_fcntl.c,v 1.11 2021/11/25 02:35:00 ryo Exp $");
 
 #include 
 #include 
@@ -57,8 +57,10 @@ __KERNEL_RCSID(0, "$NetBSD: linux32_fcnt
 #include 
 
 #include 
+#include 
 #include 
 #include 
+#include 
 #include 
 
 struct linux32_flock {
@@ -120,18 +122,18 @@ linux32_sys_fcntl(struct lwp *l, const s
 	int cmd =  SCARG(uap, cmd);
 
 	switch (cmd) {
-	case LINUX_F_GETLK64:
+	case LINUX32_F_GETLK64:
 		do_linux_getlk(SCARG(uap, fd), cmd, SCARG_P32(uap, arg),
 		linux32, flock64);
-	case LINUX_F_SETLK64:
-	case LINUX_F_SETLKW64:
+	case LINUX32_F_SETLK64:
+	case LINUX32_F_SETLKW64:
 		do_linux_setlk(SCARG(uap, fd), cmd, SCARG_P32(uap, arg),
 		linux32, flock64, LINUX_F_SETLK64);
-	case LINUX_F_GETLK:
+	case LINUX32_F_GETLK:
 		do_linux_getlk(SCARG(uap, fd), cmd, SCARG_P32(uap, arg),
 		linux32, flock);
-	case LINUX_F_SETLK:
-	case LINUX_F_SETLKW:
+	case LINUX32_F_SETLK:
+	case LINUX32_F_SETLKW:
 		do_linux_setlk(SCARG(uap, fd), cmd, SCARG_P32(uap, arg),
 		linux32, flock, LINUX_F_SETLK);
 	default:
@@ -145,6 +147,7 @@ linux32_sys_fcntl(struct lwp *l, const s
 	return linux_sys_fcntl(l, &ua, retval);
 }
 
+#ifdef LINUX32_SYS_fadvise64
 int
 linux32_sys_fadvise64(struct lwp *l,
 const struct linux32_sys_fadvise64_args *uap, register_t *retval)
@@ -161,6 +164,7 @@ linux32_sys_fadvise64(struct lwp *l,
 	return do_posix_fadvise(SCARG(uap, fd), off,
 	SCARG(uap, len), linux_to_bsd_posix_fadv(SCARG(uap, advice)));
 }
+#endif
 
 int
 linux32_sys_fadvise64_64(struct lwp *l,

Added files:

Index: src/sys/compat/linux32/arch/amd64/linux32_fcntl.h
diff -u /dev/null src/sys/compat/linux32/arch/amd64/linux32_fcntl.h:1.1
--- /dev/null	Thu Nov 25 02:35:01 2021
+++ src/sys/compat/linux32/arch/amd64/linux32_fcntl.h	Thu Nov 25 02:35:00 2021
@@ -0,0 +1,42 @@
+/*-
+ * Copyright (c) 2021 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Ryo Shimizu.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _AMD64_LINUX32_FCNTL_H_
+#define _AMD64_LINUX32_FCNTL_H_
+
+#include 
+
+#define LINUX32_F_GETLK		LINUX_F_GETLK
+#define LINUX32_F_SETL

CVS commit: src/sys/arch/amd64/conf

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Nov 25 02:36:35 UTC 2021

Modified Files:
src/sys/arch/amd64/conf: ALL

Log Message:
add missing options EXEC_ELF32


To generate a diff of this commit:
cvs rdiff -u -r1.167 -r1.168 src/sys/arch/amd64/conf/ALL

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



CVS commit: src/sys/arch/amd64/conf

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Nov 25 02:36:35 UTC 2021

Modified Files:
src/sys/arch/amd64/conf: ALL

Log Message:
add missing options EXEC_ELF32


To generate a diff of this commit:
cvs rdiff -u -r1.167 -r1.168 src/sys/arch/amd64/conf/ALL

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/amd64/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.167 src/sys/arch/amd64/conf/ALL:1.168
--- src/sys/arch/amd64/conf/ALL:1.167	Tue Jun 29 10:22:34 2021
+++ src/sys/arch/amd64/conf/ALL	Thu Nov 25 02:36:35 2021
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.167 2021/06/29 10:22:34 nia Exp $
+# $NetBSD: ALL,v 1.168 2021/11/25 02:36:35 ryo Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.167 $"
+#ident		"ALL-$Revision: 1.168 $"
 
 maxusers	64		# estimated number of users
 
@@ -150,6 +150,7 @@ options 	COMPAT_OSSAUDIO	# OSS (Voxware)
 options 	COMPAT_NETBSD32 # NetBSD 32-bit
 options 	COMPAT_LINUX	# binary compatibility with Linux
 options 	COMPAT_LINUX32	# binary compatibility with Linux 32-bit
+options 	EXEC_ELF32
 
 # Wedge support
 options 	DKWEDGE_AUTODISCOVER	# Automatically add dk(4) instances



CVS commit: src/sys/kern

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Nov 25 02:37:38 UTC 2021

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

Log Message:
Fix anonymous memory object leak for sigcode.

- Repeating "modload compat_linux && /emul/linux/bin/ls && modunload 
compat_linux"
  will reproduce this problem.
- It cause in exec_sigcode_map(), anon-object for sigcode was created at
  first exec, but it remained even after exec_remove.
- Fixed that the anon-object for sigcode is created at exec_add(), and the
  anon-object reference is removed at exec_remove().
- sigobject_lock is no longer needed since it is locked by exec_lock.


To generate a diff of this commit:
cvs rdiff -u -r1.511 -r1.512 src/sys/kern/kern_exec.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-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Nov 25 02:37:38 UTC 2021

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

Log Message:
Fix anonymous memory object leak for sigcode.

- Repeating "modload compat_linux && /emul/linux/bin/ls && modunload 
compat_linux"
  will reproduce this problem.
- It cause in exec_sigcode_map(), anon-object for sigcode was created at
  first exec, but it remained even after exec_remove.
- Fixed that the anon-object for sigcode is created at exec_add(), and the
  anon-object reference is removed at exec_remove().
- sigobject_lock is no longer needed since it is locked by exec_lock.


To generate a diff of this commit:
cvs rdiff -u -r1.511 -r1.512 src/sys/kern/kern_exec.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_exec.c
diff -u src/sys/kern/kern_exec.c:1.511 src/sys/kern/kern_exec.c:1.512
--- src/sys/kern/kern_exec.c:1.511	Sun Nov  7 13:47:49 2021
+++ src/sys/kern/kern_exec.c	Thu Nov 25 02:37:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.511 2021/11/07 13:47:49 christos Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.512 2021/11/25 02:37:38 ryo Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.511 2021/11/07 13:47:49 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.512 2021/11/25 02:37:38 ryo Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -139,6 +139,8 @@ static int copyinargs(struct execve_data
 char * const *, execve_fetch_element_t, char **);
 static int copyinargstrs(struct execve_data * restrict, char * const *,
 execve_fetch_element_t, char **, size_t *, void (*)(const void *, size_t));
+static int exec_sigcode_alloc(const struct emul *);
+static void exec_sigcode_free(const struct emul *);
 static int exec_sigcode_map(struct proc *, const struct emul *);
 
 #if defined(DEBUG) && !defined(DEBUG_EXEC)
@@ -250,8 +252,6 @@ struct emul emul_netbsd = {
  */
 krwlock_t exec_lock __cacheline_aligned;
 
-static kmutex_t sigobject_lock __cacheline_aligned;
-
 /*
  * Data used between a loadvm and execve part of an "exec" operation
  */
@@ -1815,7 +1815,7 @@ int
 exec_add(struct execsw *esp, int count)
 {
 	struct exec_entry	*it;
-	int			i;
+	int			i, error = 0;
 
 	if (count == 0) {
 		return 0;
@@ -1840,8 +1840,23 @@ exec_add(struct execsw *esp, int count)
 	for (i = 0; i < count; i++) {
 		it = kmem_alloc(sizeof(*it), KM_SLEEP);
 		it->ex_sw = &esp[i];
+		error = exec_sigcode_alloc(it->ex_sw->es_emul);
+		if (error != 0) {
+			kmem_free(it, sizeof(*it));
+			break;
+		}
 		LIST_INSERT_HEAD(&ex_head, it, ex_list);
 	}
+	/* If even one fails, remove them all back. */
+	if (error != 0) {
+		for (i--; i >= 0; i--) {
+			it = LIST_FIRST(&ex_head);
+			LIST_REMOVE(it, ex_list);
+			exec_sigcode_free(it->ex_sw->es_emul);
+			kmem_free(it, sizeof(*it));
+		}
+		return error;
+	}
 
 	/* update execsw[] */
 	exec_init(0);
@@ -1886,6 +1901,7 @@ exec_remove(struct execsw *esp, int coun
 			next = LIST_NEXT(it, ex_list);
 			if (it->ex_sw == &esp[i]) {
 LIST_REMOVE(it, ex_list);
+exec_sigcode_free(it->ex_sw->es_emul);
 kmem_free(it, sizeof(*it));
 break;
 			}
@@ -1919,7 +1935,6 @@ exec_init(int init_boot)
 		vaddr_t vmin = 0, vmax;
 
 		rw_init(&exec_lock);
-		mutex_init(&sigobject_lock, MUTEX_DEFAULT, IPL_NONE);
 		exec_map = uvm_km_suballoc(kernel_map, &vmin, &vmax,
 		maxexec*NCARGS, VM_MAP_PAGEABLE, false, NULL);
 		pool_init(&exec_pool, NCARGS, 0, 0, PR_NOALIGN|PR_NOTOUCH,
@@ -1987,21 +2002,24 @@ exec_init(int init_boot)
 }
 
 static int
-exec_sigcode_map(struct proc *p, const struct emul *e)
+exec_sigcode_alloc(const struct emul *e)
 {
 	vaddr_t va;
 	vsize_t sz;
 	int error;
 	struct uvm_object *uobj;
 
-	sz = (vaddr_t)e->e_esigcode - (vaddr_t)e->e_sigcode;
+	KASSERT(rw_lock_held(&exec_lock));
 
-	if (e->e_sigobject == NULL || sz == 0) {
+	if (e == NULL || e->e_sigobject == NULL)
+		return 0;
+
+	sz = (vaddr_t)e->e_esigcode - (vaddr_t)e->e_sigcode;
+	if (sz == 0)
 		return 0;
-	}
 
 	/*
-	 * If we don't have a sigobject for this emulation, create one.
+	 * Create a sigobject for this emulation.
 	 *
 	 * sigobject is an anonymous memory object (just like SYSV shared
 	 * memory) that we keep a permanent reference to and that we map
@@ -2011,32 +2029,61 @@ exec_sigcode_map(struct proc *p, const s
 	 * We map it with PROT_READ|PROT_EXEC into the process just
 	 * the way sys_mmap() would map it.
 	 */
-
-	uobj = *e->e_sigobject;
-	if (uobj == NULL) {
-		mutex_enter(&sigobject_lock);
-		if ((uobj = *e->e_sigobject) == NULL) {
-			uobj = uao_create(sz, 0);
-			(*uobj->pgops->pgo_reference)(uobj);
-			va = vm_map_min(kernel_map);
-			if ((error = uvm_map(kernel_map, &va, round_page(sz),
-			uobj, 0, 0,
-			UVM_MAPFLAG(UVM_PROT_RW, UVM_PROT_RW,
-			UVM_INH_SHARE, UVM_ADV_RANDOM, 0 {

CVS commit: src/sys/compat/linux32

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Nov 25 02:38:56 UTC 2021

Modified Files:
src/sys/compat/linux32/arch/amd64: linux32_exec.h
src/sys/compat/linux32/common: linux32_mod.c

Log Message:
The default name of the `exec_setup_stack' function for linux32 should be 
`linux32_exec_setup_stack',
and it should be defined in each arch.
declaration of linux32_exec_setup_stack() in linux32/amd64 has been removed 
because it does not exist.

NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/compat/linux32/arch/amd64/linux32_exec.h
cvs rdiff -u -r1.14 -r1.15 src/sys/compat/linux32/common/linux32_mod.c

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



CVS commit: src/sys/compat/linux32

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Nov 25 02:38:56 UTC 2021

Modified Files:
src/sys/compat/linux32/arch/amd64: linux32_exec.h
src/sys/compat/linux32/common: linux32_mod.c

Log Message:
The default name of the `exec_setup_stack' function for linux32 should be 
`linux32_exec_setup_stack',
and it should be defined in each arch.
declaration of linux32_exec_setup_stack() in linux32/amd64 has been removed 
because it does not exist.

NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/compat/linux32/arch/amd64/linux32_exec.h
cvs rdiff -u -r1.14 -r1.15 src/sys/compat/linux32/common/linux32_mod.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/compat/linux32/arch/amd64/linux32_exec.h
diff -u src/sys/compat/linux32/arch/amd64/linux32_exec.h:1.7 src/sys/compat/linux32/arch/amd64/linux32_exec.h:1.8
--- src/sys/compat/linux32/arch/amd64/linux32_exec.h:1.7	Wed Apr 26 22:41:59 2017
+++ src/sys/compat/linux32/arch/amd64/linux32_exec.h	Thu Nov 25 02:38:56 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_exec.h,v 1.7 2017/04/26 22:41:59 christos Exp $ */
+/*	$NetBSD: linux32_exec.h,v 1.8 2021/11/25 02:38:56 ryo Exp $ */
 
 /*-
  * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -82,8 +82,6 @@ struct linux32_extra_stack_data {
 
 #endif
 
-#ifdef _KERNEL
-int linux32_exec_setup_stack(struct lwp *, struct exec_package *);
-#endif
+#define linux32_exec_setup_stack	linux_exec_setup_stack
 
 #endif /* !_AMD64_LINUX32_EXEC_H */

Index: src/sys/compat/linux32/common/linux32_mod.c
diff -u src/sys/compat/linux32/common/linux32_mod.c:1.14 src/sys/compat/linux32/common/linux32_mod.c:1.15
--- src/sys/compat/linux32/common/linux32_mod.c:1.14	Sat Mar 21 16:28:56 2020
+++ src/sys/compat/linux32/common/linux32_mod.c	Thu Nov 25 02:38:56 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_mod.c,v 1.14 2020/03/21 16:28:56 pgoyette Exp $	*/
+/*	$NetBSD: linux32_mod.c,v 1.15 2021/11/25 02:38:56 ryo Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux32_mod.c,v 1.14 2020/03/21 16:28:56 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_mod.c,v 1.15 2021/11/25 02:38:56 ryo Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_execfmt.h"
@@ -76,7 +76,7 @@ static struct execsw linux32_execsw[] = 
 		.es_copyargs = linux32_elf32_copyargs,
 		.es_setregs = NULL,
 		.es_coredump = coredump_elf32,
-		.es_setup_stack = linux_exec_setup_stack,
+		.es_setup_stack = linux32_exec_setup_stack,
 	},
 #endif
 };



CVS commit: src/sys/compat/linux32

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Nov 25 02:48:00 UTC 2021

Modified Files:
src/sys/compat/linux32/arch/amd64: linux32_exec.h
src/sys/compat/linux32/common: linux32_exec_elf32.c

Log Message:
Extra arguments for AT_HWCAP and AT_PLATFORM are now passed when executing 
linux32 binaries.

AT_SYSINFO (vsyscall) feature seems to be broken, so leave it commented out.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/compat/linux32/arch/amd64/linux32_exec.h
cvs rdiff -u -r1.20 -r1.21 src/sys/compat/linux32/common/linux32_exec_elf32.c

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



CVS commit: src/sys/compat/linux32

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Nov 25 02:48:00 UTC 2021

Modified Files:
src/sys/compat/linux32/arch/amd64: linux32_exec.h
src/sys/compat/linux32/common: linux32_exec_elf32.c

Log Message:
Extra arguments for AT_HWCAP and AT_PLATFORM are now passed when executing 
linux32 binaries.

AT_SYSINFO (vsyscall) feature seems to be broken, so leave it commented out.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/compat/linux32/arch/amd64/linux32_exec.h
cvs rdiff -u -r1.20 -r1.21 src/sys/compat/linux32/common/linux32_exec_elf32.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/compat/linux32/arch/amd64/linux32_exec.h
diff -u src/sys/compat/linux32/arch/amd64/linux32_exec.h:1.8 src/sys/compat/linux32/arch/amd64/linux32_exec.h:1.9
--- src/sys/compat/linux32/arch/amd64/linux32_exec.h:1.8	Thu Nov 25 02:38:56 2021
+++ src/sys/compat/linux32/arch/amd64/linux32_exec.h	Thu Nov 25 02:48:00 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_exec.h,v 1.8 2021/11/25 02:38:56 ryo Exp $ */
+/*	$NetBSD: linux32_exec.h,v 1.9 2021/11/25 02:48:00 ryo Exp $ */
 
 /*-
  * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -42,17 +42,14 @@
 #define LINUX32_DEBUGLINK_SIGNATURE	1
 
 /* Counted from common/linux32_exec_elf32.c */
-#define LINUX32_ELF_AUX_ENTRIES 15
-
-#define LINUX32_RANDOM_BYTES 16		/* 16 bytes for AT_RANDOM */
-
-#if 0
+#define LINUX32_ELF_AUX_ENTRIES	20
 
 /* Hardware platform identifier string */
-#define LINUX32_PLATFORM "i686" 
+#define LINUX32_PLATFORM "i686"
 
 #define LINUX32_CPUCAP (cpu_feature[0])
 
+#if 0
 /* vsyscall assembly */
 static char linux32_kernel_vsyscall[] = {
 	0x55,/* push   %ebp */		\
@@ -64,23 +61,20 @@ static char linux32_kernel_vsyscall[] = 
 	0x5d,/* pop%ebp */		\
 	0xc3,/* ret */			\
 };
+#endif
  
 /* The extra data (ELF auxiliary table and platform name) on stack */  
 struct linux32_extra_stack_data {
-Aux32Info ai[LINUX32_ELF_AUX_ENTRIES];
-char hw_platform[sizeof(LINUX32_PLATFORM)];
-	int pad;
+	Aux32Info ai[LINUX32_ELF_AUX_ENTRIES];
+	uint32_t randbytes[4];
+	char hw_platform[8];	/* sizeof(LINUX32_PLATFORM) + align */
+#if 0 /* notyet */
 	Elf32_Ehdr elfhdr;
 	char kernel_vsyscall[sizeof(linux32_kernel_vsyscall)];
-};  
-#define LINUX32_ELF_AUX_ARGSIZ sizeof(struct linux32_extra_stack_data)
-
-#else
-
-#define LINUX32_ELF_AUX_ARGSIZ \
-(LINUX32_ELF_AUX_ENTRIES * sizeof(Aux32Info) + LINUX32_RANDOM_BYTES)
-
 #endif
+};
+
+#define LINUX32_ELF_AUX_ARGSIZ sizeof(struct linux32_extra_stack_data)
 
 #define linux32_exec_setup_stack	linux_exec_setup_stack
 

Index: src/sys/compat/linux32/common/linux32_exec_elf32.c
diff -u src/sys/compat/linux32/common/linux32_exec_elf32.c:1.20 src/sys/compat/linux32/common/linux32_exec_elf32.c:1.21
--- src/sys/compat/linux32/common/linux32_exec_elf32.c:1.20	Tue Sep  7 11:43:04 2021
+++ src/sys/compat/linux32/common/linux32_exec_elf32.c	Thu Nov 25 02:48:00 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_exec_elf32.c,v 1.20 2021/09/07 11:43:04 riastradh Exp $ */
+/*	$NetBSD: linux32_exec_elf32.c,v 1.21 2021/11/25 02:48:00 ryo Exp $ */
 
 /*- 
  * Copyright (c) 1995, 1998, 2000, 2001,2006 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux32_exec_elf32.c,v 1.20 2021/09/07 11:43:04 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_exec_elf32.c,v 1.21 2021/11/25 02:48:00 ryo Exp $");
 
 #define	ELFSIZE		32
 
@@ -107,19 +107,19 @@ int
 linux32_elf32_copyargs(struct lwp *l, struct exec_package *pack,
 struct ps_strings *arginfo, char **stackp, void *argp)
 {
-	Aux32Info ai[LINUX32_ELF_AUX_ENTRIES], *a;
-	uint32_t randbytes[4];
+	struct linux32_extra_stack_data esd, *esdp;
+	Aux32Info *a, *ai __diagused;
 	struct elf_args *ap;
 	struct vattr *vap;
-	size_t len;
 	int error;
 
 	if ((error = netbsd32_copyargs(l, pack, arginfo, stackp, argp)) != 0)
 		return error;
 
-	a = ai;
+	esdp = (struct linux32_extra_stack_data *)(*stackp);	/* userspace */
 
-	memset(ai, 0, sizeof(ai));
+	memset(&esd, 0, sizeof(esd));
+	ai = a = esd.ai;
 
 	/*
 	 * Push extra arguments on the stack needed by dynamically
@@ -189,66 +189,55 @@ linux32_elf32_copyargs(struct lwp *l, st
 	a++;
 
 	a->a_type = LINUX_AT_RANDOM;
-	a->a_v = NETBSD32PTR32I(*stackp);
+	a->a_v = NETBSD32PTR32I(&esdp->randbytes[0]);
 	a++;
+	esd.randbytes[0] = cprng_strong32();
+	esd.randbytes[1] = cprng_strong32();
+	esd.randbytes[2] = cprng_strong32();
+	esd.randbytes[3] = cprng_strong32();
 
-#if 0
-	/* XXX: increase LINUX32_ELF_AUX_ENTRIES if we enable those things */
-
+#if 0 /* defined(__amd64__) */
+	/* XXX: broken. vsyscall must be placed in the executable page */
 	a->a_type = LINUX_AT_SYSINFO;
 	a->a_v = NETBSD32PTR32I(&esdp->kernel_vsyscall[0]);
 	a++;
+	memcpy(esd.kernel_vsyscall, linux32_kernel_vsyscall,
+	sizeof(linux32_kernel_vsyscal

CVS commit: src

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Nov 25 03:08:05 UTC 2021

Modified Files:
src/distrib/sets/lists/debug: module.ad.aarch64
src/distrib/sets/lists/modules: ad.aarch64
src/sys/arch/aarch64/aarch64: aarch32_syscall.c
src/sys/arch/aarch64/conf: files.aarch64
src/sys/compat/linux/arch/aarch64: linux_commons.c linux_machdep.h
src/sys/compat/linux/common: linux_file.c linux_misc.c
linux_misc_notalpha.c linux_oldmmap.c linux_sig_notalpha.c
src/sys/compat/linux32: linux32_syscall.h linux32_syscallargs.h
linux32_syscalls.c linux32_systrace_args.c
src/sys/compat/linux32/arch: Makefile
src/sys/compat/linux32/common: linux32_errno.h linux32_exec.h
linux32_exec_elf32.c linux32_ioctl.h linux32_machdep.h
linux32_misc.c linux32_siginfo.h linux32_signal.h linux32_sysinfo.c
linux32_termios.h linux32_types.h linux32_unistd.c
src/sys/modules: Makefile
src/sys/modules/compat_linux32: Makefile
Added Files:
src/sys/arch/aarch64/aarch64: linux32_syscall.c
src/sys/compat/linux32/arch/aarch64: Makefile files.linux32_aarch64
linux32_errno.h linux32_exec.h linux32_exec_machdep.c
linux32_fcntl.h linux32_ioctl.h linux32_machdep.c linux32_machdep.h
linux32_missing.c linux32_missing.h linux32_sigcode.S
linux32_siginfo.h linux32_signal.h linux32_syscall.h
linux32_syscallargs.h linux32_syscalls.c linux32_sysent.c
linux32_systrace_args.c linux32_termios.h linux32_types.h
syscalls.conf syscalls.master

Log Message:
add support COMPAT_LINUX32 for aarch64


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/distrib/sets/lists/debug/module.ad.aarch64
cvs rdiff -u -r1.9 -r1.10 src/distrib/sets/lists/modules/ad.aarch64
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/aarch64/aarch64/aarch32_syscall.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/aarch64/aarch64/linux32_syscall.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/aarch64/conf/files.aarch64
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/linux/arch/aarch64/linux_commons.c
cvs rdiff -u -r1.1 -r1.2 src/sys/compat/linux/arch/aarch64/linux_machdep.h
cvs rdiff -u -r1.121 -r1.122 src/sys/compat/linux/common/linux_file.c
cvs rdiff -u -r1.254 -r1.255 src/sys/compat/linux/common/linux_misc.c
cvs rdiff -u -r1.113 -r1.114 \
src/sys/compat/linux/common/linux_misc_notalpha.c
cvs rdiff -u -r1.73 -r1.74 src/sys/compat/linux/common/linux_oldmmap.c
cvs rdiff -u -r1.40 -r1.41 src/sys/compat/linux/common/linux_sig_notalpha.c
cvs rdiff -u -r1.1 -r1.2 src/sys/compat/linux32/linux32_syscall.h \
src/sys/compat/linux32/linux32_syscallargs.h \
src/sys/compat/linux32/linux32_syscalls.c \
src/sys/compat/linux32/linux32_systrace_args.c
cvs rdiff -u -r1.1 -r1.2 src/sys/compat/linux32/arch/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/compat/linux32/arch/aarch64/Makefile \
src/sys/compat/linux32/arch/aarch64/files.linux32_aarch64 \
src/sys/compat/linux32/arch/aarch64/linux32_errno.h \
src/sys/compat/linux32/arch/aarch64/linux32_exec.h \
src/sys/compat/linux32/arch/aarch64/linux32_exec_machdep.c \
src/sys/compat/linux32/arch/aarch64/linux32_fcntl.h \
src/sys/compat/linux32/arch/aarch64/linux32_ioctl.h \
src/sys/compat/linux32/arch/aarch64/linux32_machdep.c \
src/sys/compat/linux32/arch/aarch64/linux32_machdep.h \
src/sys/compat/linux32/arch/aarch64/linux32_missing.c \
src/sys/compat/linux32/arch/aarch64/linux32_missing.h \
src/sys/compat/linux32/arch/aarch64/linux32_sigcode.S \
src/sys/compat/linux32/arch/aarch64/linux32_siginfo.h \
src/sys/compat/linux32/arch/aarch64/linux32_signal.h \
src/sys/compat/linux32/arch/aarch64/linux32_syscall.h \
src/sys/compat/linux32/arch/aarch64/linux32_syscallargs.h \
src/sys/compat/linux32/arch/aarch64/linux32_syscalls.c \
src/sys/compat/linux32/arch/aarch64/linux32_sysent.c \
src/sys/compat/linux32/arch/aarch64/linux32_systrace_args.c \
src/sys/compat/linux32/arch/aarch64/linux32_termios.h \
src/sys/compat/linux32/arch/aarch64/linux32_types.h \
src/sys/compat/linux32/arch/aarch64/syscalls.conf \
src/sys/compat/linux32/arch/aarch64/syscalls.master
cvs rdiff -u -r1.1 -r1.2 src/sys/compat/linux32/common/linux32_errno.h \
src/sys/compat/linux32/common/linux32_siginfo.h \
src/sys/compat/linux32/common/linux32_termios.h
cvs rdiff -u -r1.7 -r1.8 src/sys/compat/linux32/common/linux32_exec.h
cvs rdiff -u -r1.21 -r1.22 src/sys/compat/linux32/common/linux32_exec_elf32.c
cvs rdiff -u -r1.5 -r1.6 src/sys/compat/linux32/common/linux32_ioctl.h
cvs rdiff -u -r1.3 -r1.4 src/sys/compat/linux32/common/linux32_machdep.h
cvs rdiff -u -r1.33 -r1.34 src/sys/compat/linux32/common/linux32_misc.c
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/linux32/common/linux32_signal.h
cvs rdiff -u -r1.13 -r1.14 src/sys/compat/linux32/common/linux32_sysinfo.c
cvs rdiff -u -r1

CVS commit: src/doc

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Nov 25 06:19:06 UTC 2021

Modified Files:
src/doc: CHANGES

Log Message:
Add support COMPAT_LINUX32 for aarch64


To generate a diff of this commit:
cvs rdiff -u -r1.2851 -r1.2852 src/doc/CHANGES

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



CVS commit: src/doc

2021-11-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Nov 25 06:19:06 UTC 2021

Modified Files:
src/doc: CHANGES

Log Message:
Add support COMPAT_LINUX32 for aarch64


To generate a diff of this commit:
cvs rdiff -u -r1.2851 -r1.2852 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2851 src/doc/CHANGES:1.2852
--- src/doc/CHANGES:1.2851	Mon Nov 22 16:06:19 2021
+++ src/doc/CHANGES	Thu Nov 25 06:19:06 2021
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2851 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2852 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -456,3 +456,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	evbarm: Add support for Rockchip RK3288 SoCs. [jmcneill 2022]
 	cgdconfig(8): Added 'argon2id' password-based key generation method.
 		[nia 20211122]
+	aarch64: Add initial COMPAT_LINUX32 support. [ryo 20211125]



CVS commit: src/usr.bin/indent

2021-11-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Nov 25 07:30:54 UTC 2021

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

Log Message:
indent: clean up style

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.228 -r1.229 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/usr.bin/indent

2021-11-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Nov 25 07:30:54 UTC 2021

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

Log Message:
indent: clean up style

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.228 -r1.229 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/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.228 src/usr.bin/indent/indent.c:1.229
--- src/usr.bin/indent/indent.c:1.228	Fri Nov 19 20:23:17 2021
+++ src/usr.bin/indent/indent.c	Thu Nov 25 07:30:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.228 2021/11/19 20:23:17 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.229 2021/11/25 07:30:54 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.228 2021/11/19 20:23:17 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.229 2021/11/25 07:30:54 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -599,7 +599,7 @@ maybe_break_line(lexer_symbol lsym, bool
 	return;
 if (lsym == lsym_semicolon)
 	return;
-else if (lsym == lsym_lbrace && opt.brace_same_line)
+if (lsym == lsym_lbrace && opt.brace_same_line)
 	return;
 
 if (opt.verbose)
@@ -969,7 +969,8 @@ process_rbrace(bool *spaced_expr, int *d
 
 *code.e++ = '}';
 ps.want_blank = true;
-ps.in_stmt = ps.ind_stmt = false;
+ps.in_stmt = false;
+ps.ind_stmt = false;
 
 if (ps.decl_level > 0) { /* we are in multi-level structure declaration */
 	*decl_ind = di_stack[--ps.decl_level];



CVS commit: src/usr.bin/indent

2021-11-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Nov 25 07:41:13 UTC 2021

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

Log Message:
indent: rename ps.ind_stmt to in_stmt_cont

This makes a comment redundant.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.229 -r1.230 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.98 -r1.99 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.129 -r1.130 src/usr.bin/indent/io.c
cvs rdiff -u -r1.150 -r1.151 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-11-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Nov 25 07:41:13 UTC 2021

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

Log Message:
indent: rename ps.ind_stmt to in_stmt_cont

This makes a comment redundant.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.229 -r1.230 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.98 -r1.99 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.129 -r1.130 src/usr.bin/indent/io.c
cvs rdiff -u -r1.150 -r1.151 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.229 src/usr.bin/indent/indent.c:1.230
--- src/usr.bin/indent/indent.c:1.229	Thu Nov 25 07:30:54 2021
+++ src/usr.bin/indent/indent.c	Thu Nov 25 07:41:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.229 2021/11/25 07:30:54 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.230 2021/11/25 07:41:13 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.229 2021/11/25 07:30:54 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.230 2021/11/25 07:41:13 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -917,7 +917,7 @@ process_lbrace(bool *force_nl, bool *spa
 }
 
 if (code.s == code.e)
-	ps.ind_stmt = false;	/* don't indent the '{' itself */
+	ps.in_stmt_cont = false;	/* don't indent the '{' itself */
 if (ps.in_decl && ps.init_or_struct) {
 	di_stack[ps.decl_level] = *decl_ind;
 	if (++ps.decl_level == di_stack_cap) {
@@ -970,7 +970,7 @@ process_rbrace(bool *spaced_expr, int *d
 *code.e++ = '}';
 ps.want_blank = true;
 ps.in_stmt = false;
-ps.ind_stmt = false;
+ps.in_stmt_cont = false;
 
 if (ps.decl_level > 0) { /* we are in multi-level structure declaration */
 	*decl_ind = di_stack[--ps.decl_level];
@@ -1041,7 +1041,7 @@ process_type(int *decl_ind, bool *tabs_t
 if (ps.in_parameter_declaration && opt.indent_parameters &&
 	ps.decl_level == 0) {
 	ps.ind_level = ps.ind_level_follow = 1;
-	ps.ind_stmt = false;
+	ps.in_stmt_cont = false;
 }
 
 ps.init_or_struct = /* maybe */ true;

Index: src/usr.bin/indent/indent.h
diff -u src/usr.bin/indent/indent.h:1.98 src/usr.bin/indent/indent.h:1.99
--- src/usr.bin/indent/indent.h:1.98	Fri Nov 19 20:23:17 2021
+++ src/usr.bin/indent/indent.h	Thu Nov 25 07:41:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.h,v 1.98 2021/11/19 20:23:17 rillig Exp $	*/
+/*	$NetBSD: indent.h,v 1.99 2021/11/25 07:41:13 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -316,7 +316,7 @@ extern struct parser_state {
 bool in_stmt;		/* TODO: rename to something appropriate; this
  * is set to true in struct declarations as
  * well, so 'stmt' isn't accurate */
-bool ind_stmt;		/* whether the next line should have an extra
+bool in_stmt_cont;		/* whether the next line should have an extra
  * indentation level because we are in the
  * middle of a statement */
 bool is_case_label;		/* 'case' and 'default' labels are indented

Index: src/usr.bin/indent/io.c
diff -u src/usr.bin/indent/io.c:1.129 src/usr.bin/indent/io.c:1.130
--- src/usr.bin/indent/io.c:1.129	Fri Nov 19 20:23:17 2021
+++ src/usr.bin/indent/io.c	Thu Nov 25 07:41:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.c,v 1.129 2021/11/19 20:23:17 rillig Exp $	*/
+/*	$NetBSD: io.c,v 1.130 2021/11/25 07:41:13 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)io.c	8.1 (Be
 
 #include 
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: io.c,v 1.129 2021/11/19 20:23:17 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.130 2021/11/25 07:41:13 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -471,9 +471,7 @@ output_line(char line_terminator)
 	output_char('\n');
 
 	if (ps.ind_level == 0)
-	ps.ind_stmt = false;	/* this is a class A kludge. don't do
-	 * additional statement indentation if
-	 * we are at bracket level 0 */
+	ps.in_stmt_cont = false;	/* this is a class A kludge */
 
 	if (lab.e != lab.s || code.e != code.s)
 	ps.stats.code_lines++;
@@ -498,7 +496,7 @@ output_line(char line_terminator)
 }
 
 ps.decl_on_line = ps.in_decl;	/* for proper comment indentation */
-ps.ind_stmt = ps.in_stmt && !ps.in_decl;
+ps.in_stmt_cont = ps.in_stmt && !ps.in_decl;
 ps.decl_indent_done = false;
 
 *(lab.e = lab.s) = '\0';	/* reset buffers */
@@ -553,7 +551,7 @@ compute_code_indent(void)
 int base_ind = ps.ind_level * opt.indent_size;
 
 if (ps.paren_level == 0) {
-	if (ps.ind_stmt)
+	if (ps.in_stmt_cont)
 	return base_ind + 

CVS commit: src/usr.bin/indent

2021-11-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Nov 25 07:45:32 UTC 2021

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

Log Message:
indent: rename ps.in_stmt to in_stmt_or_decl

The previous name didn't match reality.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.230 -r1.231 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.99 -r1.100 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.130 -r1.131 src/usr.bin/indent/io.c
cvs rdiff -u -r1.151 -r1.152 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-11-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Nov 25 07:45:32 UTC 2021

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

Log Message:
indent: rename ps.in_stmt to in_stmt_or_decl

The previous name didn't match reality.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.230 -r1.231 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.99 -r1.100 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.130 -r1.131 src/usr.bin/indent/io.c
cvs rdiff -u -r1.151 -r1.152 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.230 src/usr.bin/indent/indent.c:1.231
--- src/usr.bin/indent/indent.c:1.230	Thu Nov 25 07:41:13 2021
+++ src/usr.bin/indent/indent.c	Thu Nov 25 07:45:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.230 2021/11/25 07:41:13 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.231 2021/11/25 07:45:32 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.230 2021/11/25 07:41:13 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.231 2021/11/25 07:45:32 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -730,7 +730,8 @@ process_rparen_or_rbracket(bool *spaced_
 	*spaced_expr = false;
 	*force_nl = true;	/* must force newline after if */
 	ps.next_unary = true;
-	ps.in_stmt = false;	/* don't use stmt continuation indentation */
+	ps.in_stmt_or_decl = false;	/* don't use stmt continuation
+	 * indentation */
 
 	parse_stmt_head(hd);
 }
@@ -817,7 +818,7 @@ process_colon(int *quest_level, bool *fo
 buf_terminate(&lab);
 buf_reset(&code);
 
-ps.in_stmt = false;
+ps.in_stmt_or_decl = false;
 ps.is_case_label = *seen_case;
 *force_nl = *seen_case;
 *seen_case = false;
@@ -866,7 +867,7 @@ process_semicolon(bool *seen_case, int *
 }
 *code.e++ = ';';
 ps.want_blank = true;
-ps.in_stmt = ps.p_l_follow > 0;
+ps.in_stmt_or_decl = ps.p_l_follow > 0;
 
 if (!*spaced_expr) {	/* if not if for (;;) */
 	parse(psym_semicolon);	/* let parser know about end of stmt */
@@ -878,7 +879,7 @@ static void
 process_lbrace(bool *force_nl, bool *spaced_expr, stmt_head hd,
 int *di_stack, int di_stack_cap, int *decl_ind)
 {
-ps.in_stmt = false;		/* don't indent the {} */
+ps.in_stmt_or_decl = false;		/* don't indent the {} */
 
 if (!ps.block_init)
 	*force_nl = true;	/* force other stuff on same line as '{' onto
@@ -969,7 +970,7 @@ process_rbrace(bool *spaced_expr, int *d
 
 *code.e++ = '}';
 ps.want_blank = true;
-ps.in_stmt = false;
+ps.in_stmt_or_decl = false;
 ps.in_stmt_cont = false;
 
 if (ps.decl_level > 0) { /* we are in multi-level structure declaration */
@@ -995,7 +996,7 @@ process_rbrace(bool *spaced_expr, int *d
 static void
 process_do(bool *force_nl, bool *last_else)
 {
-ps.in_stmt = false;
+ps.in_stmt_or_decl = false;
 
 if (code.e != code.s) {	/* make sure this starts a line */
 	if (opt.verbose)
@@ -1012,7 +1013,7 @@ process_do(bool *force_nl, bool *last_el
 static void
 process_else(bool *force_nl, bool *last_else)
 {
-ps.in_stmt = false;
+ps.in_stmt_or_decl = false;
 
 if (code.e > code.s && !(opt.cuddle_else && code.e[-1] == '}')) {
 	if (opt.verbose)
@@ -1085,7 +1086,7 @@ process_ident(lexer_symbol lsym, int dec
 	*spaced_expr = false;
 	*force_nl = true;
 	ps.next_unary = true;
-	ps.in_stmt = false;
+	ps.in_stmt_or_decl = false;
 	parse_stmt_head(hd);
 }
 }
@@ -1298,8 +1299,8 @@ main_loop(void)
 	force_nl = false;
 	else if (lsym != lsym_comment) {
 	maybe_break_line(lsym, &force_nl);
-	ps.in_stmt = true;	/* add an extra level of indentation; turned
- * off again by a ';' or '}' */
+	ps.in_stmt_or_decl = true;	/* add an extra level of indentation;
+	 * turned off again by a ';' or '}' */
 	if (com.s != com.e)
 		move_com_to_code();
 	}

Index: src/usr.bin/indent/indent.h
diff -u src/usr.bin/indent/indent.h:1.99 src/usr.bin/indent/indent.h:1.100
--- src/usr.bin/indent/indent.h:1.99	Thu Nov 25 07:41:13 2021
+++ src/usr.bin/indent/indent.h	Thu Nov 25 07:45:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.h,v 1.99 2021/11/25 07:41:13 rillig Exp $	*/
+/*	$NetBSD: indent.h,v 1.100 2021/11/25 07:45:32 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -313,9 +313,8 @@ extern struct parser_state {
 bool decl_indent_done;	/* whether the indentation for a declaration
  * has been added to the code buffer. */
 
-bool in_stmt;		/* TODO: rename to something appropriate; this
- * is set to true in struct declarations as
- * well, so 'stmt' isn't accurate */
+bool in_stmt_or_decl;	/* w

CVS commit: src/usr.bin/indent

2021-11-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Nov 25 07:47:55 UTC 2021

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

Log Message:
indent: fix comment for ps.in_decl

In C, there are no declaration statements. There are declarations and
statements, but no combination thereof.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/usr.bin/indent/indent.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-11-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Nov 25 07:47:55 UTC 2021

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

Log Message:
indent: fix comment for ps.in_decl

In C, there are no declaration statements. There are declarations and
statements, but no combination thereof.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/usr.bin/indent/indent.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.h
diff -u src/usr.bin/indent/indent.h:1.100 src/usr.bin/indent/indent.h:1.101
--- src/usr.bin/indent/indent.h:1.100	Thu Nov 25 07:45:32 2021
+++ src/usr.bin/indent/indent.h	Thu Nov 25 07:47:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.h,v 1.100 2021/11/25 07:45:32 rillig Exp $	*/
+/*	$NetBSD: indent.h,v 1.101 2021/11/25 07:47:55 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -305,7 +305,7 @@ extern struct parser_state {
  * declaration or an initializer */
 bool decl_on_line;		/* whether this line of code has part of a
  * declaration on it */
-bool in_decl;		/* whether we are in a declaration stmt. The
+bool in_decl;		/* whether we are in a declaration. The
  * processing of braces is then slightly
  * different */
 int just_saw_decl;