CVS commit: src/lib/libc/gen

2021-02-25 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Feb 26 06:39:14 UTC 2021

Modified Files:
src/lib/libc/gen: endutent.3

Log Message:
Fix xref, add missing word.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/gen/endutent.3

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/gen/endutent.3
diff -u src/lib/libc/gen/endutent.3:1.1 src/lib/libc/gen/endutent.3:1.2
--- src/lib/libc/gen/endutent.3:1.1	Fri Feb 26 03:05:01 2021
+++ src/lib/libc/gen/endutent.3	Fri Feb 26 06:39:14 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: endutent.3,v 1.1 2021/02/26 03:05:01 christos Exp $
+.\"	$NetBSD: endutent.3,v 1.2 2021/02/26 06:39:14 wiz Exp $
 .\"
 .\" Copyright (c) 2002 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -58,7 +58,7 @@ user accounting database.
 .Pp
 These interfaces are only provided for compatibility purpuses and
 have been superseeded by
-.Xr endutent 3 ,
+.Xr endutxent 3 ,
 .Xr utmpx 5 .
 .Pp
 .Fn getutent
@@ -88,7 +88,6 @@ the same user if it exists.
 The
 .Nm utmp
 structure has the following definition:
-.Pp
 .Bd -literal
 struct utmp {
 char ut_line[UT_LINESIZE];/* tty name */
@@ -119,5 +118,5 @@ The
 .Fn getutline ,
 .Fn pututline ,
 .Fn setutent
-all conform to
+functions all conform to
 .St -xpg4.2 .



CVS commit: src/lib/libc/gen

2021-02-25 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Feb 26 04:28:15 UTC 2021

Modified Files:
src/lib/libc/gen: Makefile.inc

Log Message:
Add missing endutent.3 to MAN.


To generate a diff of this commit:
cvs rdiff -u -r1.208 -r1.209 src/lib/libc/gen/Makefile.inc

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/gen/Makefile.inc
diff -u src/lib/libc/gen/Makefile.inc:1.208 src/lib/libc/gen/Makefile.inc:1.209
--- src/lib/libc/gen/Makefile.inc:1.208	Fri Feb 26 03:19:34 2021
+++ src/lib/libc/gen/Makefile.inc	Fri Feb 26 04:28:14 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.208 2021/02/26 03:19:34 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.209 2021/02/26 04:28:14 rin Exp $
 #	from: @(#)Makefile.inc	8.6 (Berkeley) 5/4/95
 
 # gen sources
@@ -56,7 +56,8 @@ COPTS.syslog.c = -Wno-format-nonliteral
 MAN+=	alarm.3 arc4random.3 basename.3 bsd_signal.3 bswap.3 \
 	clock.3 closefrom.3 confstr.3 \
 	cpuset.3 ctermid.3 ctype.3 daemon.3 devname.3 directory.3 dirname.3 \
-	endutxent.3 err.3 exec.3 extattr_copy_file.3 extattr_namespace_to_string.3 \
+	endutent.3 endutxent.3 err.3 exec.3 extattr_copy_file.3 \
+	extattr_namespace_to_string.3 \
 	fmtcheck.3 fmtmsg.3 fnmatch.3 fpclassify.3 fpgetmask.3 \
 	ftok.3 fts.3 ftw.3 \
 	getbsize.3 cgetcap.3 getcwd.3 getdevmajor.3 \



CVS commit: src/lib/libc/gen

2021-02-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 26 03:19:34 UTC 2021

Modified Files:
src/lib/libc/gen: Makefile.inc

Log Message:
put back line accidentally removed.


To generate a diff of this commit:
cvs rdiff -u -r1.207 -r1.208 src/lib/libc/gen/Makefile.inc

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/gen/Makefile.inc
diff -u src/lib/libc/gen/Makefile.inc:1.207 src/lib/libc/gen/Makefile.inc:1.208
--- src/lib/libc/gen/Makefile.inc:1.207	Thu Feb 25 22:05:01 2021
+++ src/lib/libc/gen/Makefile.inc	Thu Feb 25 22:19:34 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.207 2021/02/26 03:05:01 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.208 2021/02/26 03:19:34 christos Exp $
 #	from: @(#)Makefile.inc	8.6 (Berkeley) 5/4/95
 
 # gen sources
@@ -145,6 +145,7 @@ MLINKS+=getpwent.3 endpwent.3 getpwent.3
 MLINKS+=getpwent.3 getpwnam_r.3 getpwent.3 getpwuid_r.3 getpwent.3 getpwent_r.3
 # getpwent.3 setpwfile.3 - deprecated
 MLINKS+=getttyent.3 endttyent.3 getttyent.3 getttynam.3 \
+	getttyent.3 setttyent.3 getttyent.3 setttyentpath.3
 MLINKS+=getusershell.3 endusershell.3 getusershell.3 setusershell.3
 MLINKS+=glob.3 globfree.3
 MLINKS+=glob.3 glob_pattern_p.3



CVS commit: src/distrib/sets/lists/comp

2021-02-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 26 03:08:25 UTC 2021

Modified Files:
src/distrib/sets/lists/comp: mi

Log Message:
Add utmp man pages


To generate a diff of this commit:
cvs rdiff -u -r1.2374 -r1.2375 src/distrib/sets/lists/comp/mi

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2374 src/distrib/sets/lists/comp/mi:1.2375
--- src/distrib/sets/lists/comp/mi:1.2374	Mon Feb 15 09:38:06 2021
+++ src/distrib/sets/lists/comp/mi	Thu Feb 25 22:08:25 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2374 2021/02/15 14:38:06 christos Exp $
+#	$NetBSD: mi,v 1.2375 2021/02/26 03:08:25 christos Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -6992,6 +6992,7 @@
 ./usr/share/man/cat3/endservent.0		comp-c-catman		.cat
 ./usr/share/man/cat3/endttyent.0		comp-c-catman		.cat
 ./usr/share/man/cat3/endusershell.0		comp-c-catman		.cat
+./usr/share/man/cat3/endutent.0			comp-c-catman		.cat
 ./usr/share/man/cat3/endutxent.0		comp-c-catman		.cat
 ./usr/share/man/cat3/endwin.0			comp-c-catman		.cat
 ./usr/share/man/cat3/erand48.0			comp-c-catman		.cat
@@ -7512,6 +7513,8 @@
 ./usr/share/man/cat3/getusershell.0		comp-c-catman		.cat
 ./usr/share/man/cat3/getutmp.0			comp-c-catman		.cat
 ./usr/share/man/cat3/getutmpx.0			comp-c-catman		.cat
+./usr/share/man/cat3/getutent.0			comp-c-catman		.cat
+./usr/share/man/cat3/getutline.0		comp-c-catman		.cat
 ./usr/share/man/cat3/getutxent.0		comp-c-catman		.cat
 ./usr/share/man/cat3/getutxid.0			comp-c-catman		.cat
 ./usr/share/man/cat3/getutxline.0		comp-c-catman		.cat
@@ -9532,6 +9535,7 @@
 ./usr/share/man/cat3/putenv.0			comp-c-catman		.cat
 ./usr/share/man/cat3/putp.0			comp-c-catman		.cat
 ./usr/share/man/cat3/puts.0			comp-c-catman		.cat
+./usr/share/man/cat3/pututline.0		comp-c-catman		.cat
 ./usr/share/man/cat3/pututxline.0		comp-c-catman		.cat
 ./usr/share/man/cat3/putw.0			comp-c-catman		.cat
 ./usr/share/man/cat3/putwc.0			comp-c-catman		.cat
@@ -9941,6 +9945,7 @@
 ./usr/share/man/cat3/setupterm.0		comp-c-catman		.cat
 ./usr/share/man/cat3/setusercontext.0		comp-c-catman		.cat
 ./usr/share/man/cat3/setusershell.0		comp-c-catman		.cat
+./usr/share/man/cat3/setutent.0			comp-c-catman		.cat
 ./usr/share/man/cat3/setutxent.0		comp-c-catman		.cat
 ./usr/share/man/cat3/setvbuf.0			comp-c-catman		.cat
 ./usr/share/man/cat3/sha.0			comp-obsolete		obsolete
@@ -15261,6 +15266,7 @@
 ./usr/share/man/html3/endservent.html		comp-c-htmlman		html
 ./usr/share/man/html3/endttyent.html		comp-c-htmlman		html
 ./usr/share/man/html3/endusershell.html		comp-c-htmlman		html
+./usr/share/man/html3/endutent.html		comp-c-htmlman		html
 ./usr/share/man/html3/endutxent.html		comp-c-htmlman		html
 ./usr/share/man/html3/endwin.html		comp-c-htmlman		html
 ./usr/share/man/html3/erand48.html		comp-c-htmlman		html
@@ -15778,6 +15784,8 @@
 ./usr/share/man/html3/getusershell.html		comp-c-htmlman		html
 ./usr/share/man/html3/getutmp.html		comp-c-htmlman		html
 ./usr/share/man/html3/getutmpx.html		comp-c-htmlman		html
+./usr/share/man/html3/getutent.html		comp-c-htmlman		html
+./usr/share/man/html3/getutline.html		comp-c-htmlman		html
 ./usr/share/man/html3/getutxent.html		comp-c-htmlman		html
 ./usr/share/man/html3/getutxid.html		comp-c-htmlman		html
 ./usr/share/man/html3/getutxline.html		comp-c-htmlman		html
@@ -17783,6 +17791,7 @@
 ./usr/share/man/html3/putenv.html		comp-c-htmlman		html
 ./usr/share/man/html3/putp.html			comp-c-htmlman		html
 ./usr/share/man/html3/puts.html			comp-c-htmlman		html
+./usr/share/man/html3/pututline.html		comp-c-htmlman		html
 ./usr/share/man/html3/pututxline.html		comp-c-htmlman		html
 ./usr/share/man/html3/putw.html			comp-c-htmlman		html
 ./usr/share/man/html3/putwc.html		comp-c-htmlman		html
@@ -18183,6 +18192,7 @@
 ./usr/share/man/html3/setupterm.html		comp-c-htmlman		html
 ./usr/share/man/html3/setusercontext.html	comp-c-htmlman		html
 ./usr/share/man/html3/setusershell.html		comp-c-htmlman		html
+./usr/share/man/html3/setutent.html		comp-c-htmlman		html
 ./usr/share/man/html3/setutxent.html		comp-c-htmlman		html
 ./usr/share/man/html3/setvbuf.html		comp-c-htmlman		html
 ./usr/share/man/html3/sha1.html			comp-c-htmlman		html
@@ -23465,6 +23475,7 @@
 ./usr/share/man/man3/endservent.3		comp-c-man		.man
 ./usr/share/man/man3/endttyent.3		comp-c-man		.man
 ./usr/share/man/man3/endusershell.3		comp-c-man		.man
+./usr/share/man/man3/endutent.3			comp-c-man		.man
 ./usr/share/man/man3/endutxent.3		comp-c-man		.man
 ./usr/share/man/man3/endwin.3			comp-c-man		.man
 ./usr/share/man/man3/erand48.3			comp-c-man		.man
@@ -23985,6 +23996,8 @@
 ./usr/share/man/man3/getusershell.3		comp-c-man		.man
 ./usr/share/man/man3/getutmp.3			comp-c-man		.man
 ./usr/share/man/man3/getutmpx.3			comp-c-man		.man

CVS commit: src/lib/libc/gen

2021-02-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 26 03:05:01 UTC 2021

Modified Files:
src/lib/libc/gen: Makefile.inc
Added Files:
src/lib/libc/gen: endutent.3

Log Message:
PR/56012: Kouichi Hashikawa: getutent(3) man page is missing


To generate a diff of this commit:
cvs rdiff -u -r1.206 -r1.207 src/lib/libc/gen/Makefile.inc
cvs rdiff -u -r0 -r1.1 src/lib/libc/gen/endutent.3

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/gen/Makefile.inc
diff -u src/lib/libc/gen/Makefile.inc:1.206 src/lib/libc/gen/Makefile.inc:1.207
--- src/lib/libc/gen/Makefile.inc:1.206	Tue Sep 22 17:37:47 2020
+++ src/lib/libc/gen/Makefile.inc	Thu Feb 25 22:05:01 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.206 2020/09/22 21:37:47 nia Exp $
+#	$NetBSD: Makefile.inc,v 1.207 2021/02/26 03:05:01 christos Exp $
 #	from: @(#)Makefile.inc	8.6 (Berkeley) 5/4/95
 
 # gen sources
@@ -98,6 +98,8 @@ MLINKS+=directory.3 closedir.3 directory
 MLINKS+=endutxent.3 getutxent.3 endutxent.3 getutxid.3 \
 	endutxent.3 getutxline.3 endutxent.3 pututxline.3 \
 	endutxent.3 setutxent.3
+MLINKS+=endutent.3 getutent.3 endutent.3 getutline.3 endutent.3 pututline.3 \
+	endutent.3 setutent.3
 MLINKS+=err.3 verr.3 err.3 errx.3 err.3 verrx.3 err.3 warn.3 err.3 vwarn.3 \
 err.3 warnx.3 err.3 vwarnx.3 err.3 errc.3 err.3 verrc.3 err.3 warnc.3 \
 	err.3 vwarnc.3
@@ -143,7 +145,6 @@ MLINKS+=getpwent.3 endpwent.3 getpwent.3
 MLINKS+=getpwent.3 getpwnam_r.3 getpwent.3 getpwuid_r.3 getpwent.3 getpwent_r.3
 # getpwent.3 setpwfile.3 - deprecated
 MLINKS+=getttyent.3 endttyent.3 getttyent.3 getttynam.3 \
-	getttyent.3 setttyent.3 getttyent.3 setttyentpath.3
 MLINKS+=getusershell.3 endusershell.3 getusershell.3 setusershell.3
 MLINKS+=glob.3 globfree.3
 MLINKS+=glob.3 glob_pattern_p.3

Added files:

Index: src/lib/libc/gen/endutent.3
diff -u /dev/null src/lib/libc/gen/endutent.3:1.1
--- /dev/null	Thu Feb 25 22:05:01 2021
+++ src/lib/libc/gen/endutent.3	Thu Feb 25 22:05:01 2021
@@ -0,0 +1,123 @@
+.\"	$NetBSD: endutent.3,v 1.1 2021/02/26 03:05:01 christos Exp $
+.\"
+.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Thomas Klausner.
+.\"
+.\" 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.
+.\"
+.Dd February 25, 2021
+.Dt ENDUTENT 3
+.Os
+.Sh NAME
+.Nm endutent ,
+.Nm getutent ,
+.Nm getutline ,
+.Nm pututline ,
+.Nm setutent
+.Nd user accounting database functions
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In utmp.h
+.Ft void
+.Fn endutent void
+.Ft struct utmp *
+.Fn getutent void
+.Ft struct utmpx *
+.Fn getutline "const struct utmp *"
+.Ft struct utmp *
+.Fn pututline "const struct utmp *"
+.Ft void
+.Fn setutent void
+.Sh DESCRIPTION
+These functions provide access to the
+.Xr utmp 5
+user accounting database.
+.Pp
+These interfaces are only provided for compatibility purpuses and
+have been superseeded by
+.Xr endutent 3 ,
+.Xr utmpx 5 .
+.Pp
+.Fn getutent
+reads the next entry from the database;
+if the database was not yet open, it also opens it.
+.Fn setutent
+resets the database, so that the next
+.Fn getutent
+call will get the first entry.
+.Fn endutent
+closes the database.
+.Pp
+.Fn getutline
+returns the next
+entry which has the same name as specified in the
+.Va ut_line
+field, or
+.Dv NULL
+if no match is found.
+.Pp
+.Fn pututline
+adds the argument
+.Xr utmp 5
+entry line to the accounting database, replacing a previous entry for
+the same user if it exists.
+.Ss The utmp structure
+The
+.Nm utmp
+structure has the following 

CVS commit: src/external/bsd/nvi/usr.bin/nvi

2021-02-25 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Feb 26 02:54:21 UTC 2021

Modified Files:
src/external/bsd/nvi/usr.bin/nvi: Makefile

Log Message:
Misc cleanups:

- built-in regex is required only when ${USE_WIDECHAR} == "yes"

- -DUSE_WIDECHAR cpp flag should be determined by ${USE_WIDECHAR},
  not ${USE_BUILTIN_REGEX}

- reduce .if -- .endif block for clarity


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/external/bsd/nvi/usr.bin/nvi/Makefile

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

Modified files:

Index: src/external/bsd/nvi/usr.bin/nvi/Makefile
diff -u src/external/bsd/nvi/usr.bin/nvi/Makefile:1.24 src/external/bsd/nvi/usr.bin/nvi/Makefile:1.25
--- src/external/bsd/nvi/usr.bin/nvi/Makefile:1.24	Fri Feb 26 00:41:56 2021
+++ src/external/bsd/nvi/usr.bin/nvi/Makefile	Fri Feb 26 02:54:21 2021
@@ -1,10 +1,15 @@
-#	$NetBSD: Makefile,v 1.24 2021/02/26 00:41:56 christos Exp $
+#	$NetBSD: Makefile,v 1.25 2021/02/26 02:54:21 rin Exp $
 
 .include 
 
 USE_WIDECHAR?=yes
+
+.if ${USE_WIDECHAR} == "yes"
 USE_BUILTIN_REGEX?=yes	# Although our regex supports widechar nvi requires
 			# a non-standard API
+.else
+USE_BUILTIN_REGEX?=no
+.endif
 
 WARNS=	5
 
@@ -55,12 +60,13 @@ NOTUSED=ip_funcs.c ip_read.c ip_screen.c
 	ip_run.c ip_send.c ip_trans.c ipc_cmd.c ipc_method.c
 
 # For wide char support
-.if ${USE_BUILTIN_REGEX} == "yes"
-.if ${ACTIVE_CC} == "gcc"
-COPTS.regexec.c+=	-Wno-old-style-definition
+.if ${USE_WIDECHAR} == "yes"
+CPPFLAGS+=-DUSE_WIDECHAR
 .endif
+.if ${USE_BUILTIN_REGEX} == "yes"
 SRCS+=	regcomp.c regerror.c regexec.c regfree.c
-CPPFLAGS+=-I${DIST}/regex -D__REGEX_PRIVATE -DUSE_WIDECHAR
+CPPFLAGS+=-I${DIST}/regex -D__REGEX_PRIVATE
+COPTS.regexec.c+= ${${ACTIVE_CC} == "gcc":? -Wno-old-style-definition :}
 .endif
 
 # For db3 db1 emulation



CVS commit: src/usr.bin/who

2021-02-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 26 02:45:43 UTC 2021

Modified Files:
src/usr.bin/who: utmpentry.c

Log Message:
PR/56013: Kouichi Hashikawa: Move setutent/setutxent right before the loops.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/who/utmpentry.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/who/utmpentry.c
diff -u src/usr.bin/who/utmpentry.c:1.21 src/usr.bin/who/utmpentry.c:1.22
--- src/usr.bin/who/utmpentry.c:1.21	Sat Oct  5 19:35:57 2019
+++ src/usr.bin/who/utmpentry.c	Thu Feb 25 21:45:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: utmpentry.c,v 1.21 2019/10/05 23:35:57 mrg Exp $	*/
+/*	$NetBSD: utmpentry.c,v 1.22 2021/02/26 02:45:43 christos Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: utmpentry.c,v 1.21 2019/10/05 23:35:57 mrg Exp $");
+__RCSID("$NetBSD: utmpentry.c,v 1.22 2021/02/26 02:45:43 christos Exp $");
 #endif
 
 #include 
@@ -95,14 +95,7 @@ setup(const char *fname)
 	struct stat st;
 	const char *sfname;
 
-	if (fname == NULL) {
-#ifdef SUPPORT_UTMPX
-		setutxent();
-#endif
-#ifdef SUPPORT_UTMP
-		setutent();
-#endif
-	} else {
+	if (fname != NULL) {
 		size_t len = strlen(fname);
 		if (len == 0)
 			errx(1, "Filename cannot be 0 length.");
@@ -133,9 +126,9 @@ setup(const char *fname)
 			what &= ~1;
 		} else {
 			if (timespeccmp(_mtimespec, , >))
-			utmpxtime = st.st_mtimespec;
+utmpxtime = st.st_mtimespec;
 			else
-			what &= ~1;
+what &= ~1;
 		}
 	}
 #endif
@@ -204,10 +197,11 @@ getutentries(const char *fname, struct u
 #endif
 
 #ifdef SUPPORT_UTMPX
+	setutxent();
 	while ((what & 1) && (utx = getutxent()) != NULL) {
 		if (fname == NULL && ((1 << utx->ut_type) & etype) == 0)
 			continue;
-		if ((ep = calloc(1, sizeof(struct utmpentry))) == NULL) {
+		if ((ep = calloc(1, sizeof(*ep))) == NULL) {
 			warn(NULL);
 			return 0;
 		}
@@ -218,6 +212,7 @@ getutentries(const char *fname, struct u
 #endif
 
 #ifdef SUPPORT_UTMP
+	setutent();
 	if ((etype & (1 << USER_PROCESS)) != 0) {
 		while ((what & 2) && (ut = getutent()) != NULL) {
 			if (fname == NULL && (*ut->ut_name == '\0' ||



CVS commit: src/sys/arch

2021-02-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Feb 26 02:18:57 UTC 2021

Modified Files:
src/sys/arch/amigappc/amigappc: locore.S
src/sys/arch/bebox/bebox: locore.S
src/sys/arch/evbppc/ev64260: ev64260_locore.S
src/sys/arch/evbppc/pmppc: pmppc_locore.S
src/sys/arch/ibmnws/ibmnws: locore.S
src/sys/arch/macppc/macppc: locore.S
src/sys/arch/mvmeppc/mvmeppc: locore.S
src/sys/arch/ofppc/ofppc: locore.S
src/sys/arch/powerpc/oea: cpu_subr.c
src/sys/arch/prep/prep: locore.S
src/sys/arch/rs6000/rs6000: locore.S
src/sys/arch/sandpoint/sandpoint: locore.S

Log Message:
Declare oeacpufeat once, in powerpc/oea/cpu_subr.c, rather than in
N different locore.S files.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/amigappc/amigappc/locore.S
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/bebox/bebox/locore.S
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/evbppc/ev64260/ev64260_locore.S
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/evbppc/pmppc/pmppc_locore.S
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/ibmnws/ibmnws/locore.S
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/macppc/macppc/locore.S
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/mvmeppc/mvmeppc/locore.S
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/ofppc/ofppc/locore.S
cvs rdiff -u -r1.105 -r1.106 src/sys/arch/powerpc/oea/cpu_subr.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/prep/prep/locore.S
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/rs6000/rs6000/locore.S
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/sandpoint/sandpoint/locore.S

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/amigappc/amigappc/locore.S
diff -u src/sys/arch/amigappc/amigappc/locore.S:1.26 src/sys/arch/amigappc/amigappc/locore.S:1.27
--- src/sys/arch/amigappc/amigappc/locore.S:1.26	Sun Jul 15 05:16:41 2018
+++ src/sys/arch/amigappc/amigappc/locore.S	Fri Feb 26 02:18:55 2021
@@ -1,4 +1,4 @@
-/*  $NetBSD: locore.S,v 1.26 2018/07/15 05:16:41 maxv Exp $   */
+/*  $NetBSD: locore.S,v 1.27 2021/02/26 02:18:55 thorpej Exp $   */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -68,8 +68,6 @@ GLOBAL(startsym)
 	.long	0			/* start symbol table */
 GLOBAL(endsym)
 	.long	0			/* end symbol table */
-GLOBAL(oeacpufeat)
-	.long	0			/* cpu features */
 GLOBAL(eclockfreq)
 	.long	0			/* needed by the aucc driver only */
 

Index: src/sys/arch/bebox/bebox/locore.S
diff -u src/sys/arch/bebox/bebox/locore.S:1.29 src/sys/arch/bebox/bebox/locore.S:1.30
--- src/sys/arch/bebox/bebox/locore.S:1.29	Sun Jul 15 05:16:41 2018
+++ src/sys/arch/bebox/bebox/locore.S	Fri Feb 26 02:18:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.29 2018/07/15 05:16:41 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.30 2021/02/26 02:18:55 thorpej Exp $	*/
 /*	$OpenBSD: locore.S,v 1.4 1997/01/26 09:06:38 rahnds Exp $	*/
 
 /*
@@ -63,8 +63,6 @@ GLOBAL(startsym)
 	.long	0			/* start symbol table */
 GLOBAL(endsym)
 	.long	0			/* end symbol table */
-GLOBAL(oeacpufeat)
-	.long	0/* cpu features */
 
 /* XXX All of this should die */
 GLOBAL(intrnames)

Index: src/sys/arch/evbppc/ev64260/ev64260_locore.S
diff -u src/sys/arch/evbppc/ev64260/ev64260_locore.S:1.20 src/sys/arch/evbppc/ev64260/ev64260_locore.S:1.21
--- src/sys/arch/evbppc/ev64260/ev64260_locore.S:1.20	Sun Jul 15 05:16:42 2018
+++ src/sys/arch/evbppc/ev64260/ev64260_locore.S	Fri Feb 26 02:18:56 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ev64260_locore.S,v 1.20 2018/07/15 05:16:42 maxv Exp $	*/
+/*	$NetBSD: ev64260_locore.S,v 1.21 2021/02/26 02:18:56 thorpej Exp $	*/
 /*	$OpenBSD: locore.S,v 1.4 1997/01/26 09:06:38 rahnds Exp $	*/
 
 /*
@@ -63,8 +63,6 @@ GLOBAL(startsym)
 	.long	0			/* start symbol table */
 GLOBAL(endsym)
 	.long	0			/* end symbol table */
-GLOBAL(oeacpufeat)
-	.long	0			/* cpu features */
 /*
  * File-scope for locore.S
  */

Index: src/sys/arch/evbppc/pmppc/pmppc_locore.S
diff -u src/sys/arch/evbppc/pmppc/pmppc_locore.S:1.12 src/sys/arch/evbppc/pmppc/pmppc_locore.S:1.13
--- src/sys/arch/evbppc/pmppc/pmppc_locore.S:1.12	Sun Jul 15 05:16:42 2018
+++ src/sys/arch/evbppc/pmppc/pmppc_locore.S	Fri Feb 26 02:18:56 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmppc_locore.S,v 1.12 2018/07/15 05:16:42 maxv Exp $	*/
+/*	$NetBSD: pmppc_locore.S,v 1.13 2021/02/26 02:18:56 thorpej Exp $	*/
 /*	$OpenBSD: locore.S,v 1.4 1997/01/26 09:06:38 rahnds Exp $	*/
 
 /*
@@ -64,8 +64,6 @@ GLOBAL(startsym)
 	.long	0			/* start symbol table */
 GLOBAL(endsym)
 	.long	0			/* end symbol table */
-GLOBAL(oeacpufeat)
-	.long	0			/* cpu features */
 /*
  * This symbol is here for the benefit of kvm_mkdb, and is supposed to
  * mark the start of kernel text.

Index: src/sys/arch/ibmnws/ibmnws/locore.S
diff -u src/sys/arch/ibmnws/ibmnws/locore.S:1.12 src/sys/arch/ibmnws/ibmnws/locore.S:1.13
--- src/sys/arch/ibmnws/ibmnws/locore.S:1.12	Sun Jul 15 05:16:43 2018
+++ src/sys/arch/ibmnws/ibmnws/locore.S	Fri Feb 26 02:18:56 

CVS commit: src/sys/arch

2021-02-25 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri Feb 26 02:18:29 UTC 2021

Modified Files:
src/sys/arch/mips/include: vmparam.h
src/sys/arch/riscv/include: vmparam.h

Log Message:
Drop 64-bit default stack sizes back to 4MB.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/mips/include/vmparam.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/riscv/include/vmparam.h

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

Modified files:

Index: src/sys/arch/mips/include/vmparam.h
diff -u src/sys/arch/mips/include/vmparam.h:1.64 src/sys/arch/mips/include/vmparam.h:1.65
--- src/sys/arch/mips/include/vmparam.h:1.64	Tue Oct  6 13:42:03 2020
+++ src/sys/arch/mips/include/vmparam.h	Fri Feb 26 02:18:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.64 2020/10/06 13:42:03 christos Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.65 2021/02/26 02:18:29 simonb Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -116,7 +116,7 @@
 #define	MAXDSIZ		(1536*1024*1024)	/* max data size */
 #endif
 #ifndef	DFLSSIZ
-#define	DFLSSIZ		(16*1024*1024)		/* initial stack size limit */
+#define	DFLSSIZ		(4*1024*1024)		/* initial stack size limit */
 #endif
 #ifndef	MAXSSIZ
 #define	MAXSSIZ		(120*1024*1024)		/* max stack size */

Index: src/sys/arch/riscv/include/vmparam.h
diff -u src/sys/arch/riscv/include/vmparam.h:1.7 src/sys/arch/riscv/include/vmparam.h:1.8
--- src/sys/arch/riscv/include/vmparam.h:1.7	Sat Nov  7 14:48:45 2020
+++ src/sys/arch/riscv/include/vmparam.h	Fri Feb 26 02:18:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.7 2020/11/07 14:48:45 skrll Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.8 2021/02/26 02:18:29 simonb Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
 #define	MAXDSIZ		(1536*1024*1024)	/* max data size */
 #endif
 #ifndef	DFLSSIZ
-#define	DFLSSIZ		(16*1024*1024)		/* initial stack size limit */
+#define	DFLSSIZ		(4*1024*1024)		/* initial stack size limit */
 #endif
 #ifndef	MAXSSIZ
 #define	MAXSSIZ		(120*1024*1024)		/* max stack size */



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

2021-02-25 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri Feb 26 02:01:16 UTC 2021

Modified Files:
src/sys/arch/sparc64/include: vmparam.h

Log Message:
Say what 1UL<<39 (MAXDSIZ value) is in the comment.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/sparc64/include/vmparam.h

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

Modified files:

Index: src/sys/arch/sparc64/include/vmparam.h
diff -u src/sys/arch/sparc64/include/vmparam.h:1.41 src/sys/arch/sparc64/include/vmparam.h:1.42
--- src/sys/arch/sparc64/include/vmparam.h:1.41	Tue Oct  6 13:42:03 2020
+++ src/sys/arch/sparc64/include/vmparam.h	Fri Feb 26 02:01:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.41 2020/10/06 13:42:03 christos Exp $ */
+/*	$NetBSD: vmparam.h,v 1.42 2021/02/26 02:01:16 simonb Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -112,7 +112,7 @@
 #define	DFLDSIZ		(128UL*1024*1024)	/* initial data size limit */
 #endif
 #ifndef MAXDSIZ
-#define	MAXDSIZ		(1UL<<39)		/* max data size */
+#define	MAXDSIZ		(1UL<<39)		/* 512GB max data size */
 /*
  * For processes not using topdown VA, we need to limit the data size -
  * they probably have not been compiled with the proper compiler memory



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

2021-02-25 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri Feb 26 01:48:20 UTC 2021

Modified Files:
src/sys/arch/hppa/include: vmparam.h

Log Message:
Use a valuely human readable number for MAXTSIZ.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/hppa/include/vmparam.h

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

Modified files:

Index: src/sys/arch/hppa/include/vmparam.h
diff -u src/sys/arch/hppa/include/vmparam.h:1.21 src/sys/arch/hppa/include/vmparam.h:1.22
--- src/sys/arch/hppa/include/vmparam.h:1.21	Tue Apr 16 12:25:17 2019
+++ src/sys/arch/hppa/include/vmparam.h	Fri Feb 26 01:48:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.21 2019/04/16 12:25:17 skrll Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.22 2021/02/26 01:48:20 simonb Exp $	*/
 
 /*	$OpenBSD: vmparam.h,v 1.33 2006/06/04 17:21:24 miod Exp $	*/
 
@@ -52,7 +52,7 @@
  * Virtual memory related constants, all in bytes
  */
 #ifndef MAXTSIZ
-#define	MAXTSIZ		(0x4000)		/* max text size */
+#define	MAXTSIZ		(1024*1024*1024)		/* max text size */
 #endif
 #ifndef DFLDSIZ
 #define	DFLDSIZ		(16*1024*1024)		/* initial data size limit */



CVS commit: src/sys/dev/usb

2021-02-25 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Fri Feb 26 01:38:44 UTC 2021

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

Log Message:
Also free assocated mbufs.


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

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

Modified files:

Index: src/sys/dev/usb/if_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.94 src/sys/dev/usb/if_urtwn.c:1.95
--- src/sys/dev/usb/if_urtwn.c:1.94	Sun Feb 21 23:06:13 2021
+++ src/sys/dev/usb/if_urtwn.c	Fri Feb 26 01:38:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn.c,v 1.94 2021/02/21 23:06:13 mrg Exp $	*/
+/*	$NetBSD: if_urtwn.c,v 1.95 2021/02/26 01:38:44 nat Exp $	*/
 /*	$OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $	*/
 
 /*-
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.94 2021/02/21 23:06:13 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.95 2021/02/26 01:38:44 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1470,6 +1470,10 @@ urtwn_read_rom(struct urtwn_softc *sc)
 	sc->pa_setting, sc->board_type, sc->regulatory, 0);
 
 	IEEE80211_ADDR_COPY(ic->ic_myaddr, rom->macaddr);
+#if 0
+	uint8_t new_myaddr[6] = {0x90,0x0a,0x1a,0xe7,0x1e,0xf0}; //Camera
+	IEEE80211_ADDR_COPY(ic->ic_myaddr, new_myaddr);
+#endif
 
 	sc->sc_rf_write = urtwn_r92c_rf_write;
 	sc->sc_power_on = urtwn_r92c_power_on;
@@ -2660,6 +2664,7 @@ urtwn_tx(struct urtwn_softc *sc, struct 
 		k = ieee80211_crypto_encap(ic, ni, m);
 		if (k == NULL) {
 			urtwn_put_tx_data(sc, data);
+			m_free(m);
 			return ENOBUFS;
 		}
 
@@ -2908,6 +2913,7 @@ urtwn_start(struct ifnet *ifp)
 		data = urtwn_get_tx_data(sc, sc->ac2idx[qid]);
 
 		if (data == NULL) {
+			m_freem(m);
 			ifp->if_flags |= IFF_OACTIVE;
 			DPRINTFN(DBG_TX, "empty tx_free_list", 0, 0, 0, 0);
 			return;
@@ -2919,16 +2925,17 @@ urtwn_start(struct ifnet *ifp)
 			device_printf(sc->sc_dev, "m_pullup failed\n");
 			if_statinc(ifp, if_oerrors);
 			urtwn_put_tx_data(sc, data);
+			m_freem(m);
 			continue;
 		}
 		eh = mtod(m, struct ether_header *);
 		ni = ieee80211_find_txnode(ic, eh->ether_dhost);
 		if (ni == NULL) {
-			m_freem(m);
 			device_printf(sc->sc_dev,
 			"unable to find transmit node\n");
 			if_statinc(ifp, if_oerrors);
 			urtwn_put_tx_data(sc, data);
+			m_freem(m);
 			continue;
 		}
 
@@ -2940,6 +2947,7 @@ urtwn_start(struct ifnet *ifp)
 			"unable to encapsulate packet\n");
 			if_statinc(ifp, if_oerrors);
 			urtwn_put_tx_data(sc, data);
+			m_freem(m);
 			continue;
 		}
  sendit:



CVS commit: src/external/bsd/nvi/usr.bin/nvi

2021-02-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 26 00:41:56 UTC 2021

Modified Files:
src/external/bsd/nvi/usr.bin/nvi: Makefile

Log Message:
Put back local regex (thanks Rin)


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/external/bsd/nvi/usr.bin/nvi/Makefile

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

Modified files:

Index: src/external/bsd/nvi/usr.bin/nvi/Makefile
diff -u src/external/bsd/nvi/usr.bin/nvi/Makefile:1.23 src/external/bsd/nvi/usr.bin/nvi/Makefile:1.24
--- src/external/bsd/nvi/usr.bin/nvi/Makefile:1.23	Thu Feb 25 16:56:35 2021
+++ src/external/bsd/nvi/usr.bin/nvi/Makefile	Thu Feb 25 19:41:56 2021
@@ -1,9 +1,10 @@
-#	$NetBSD: Makefile,v 1.23 2021/02/25 21:56:35 christos Exp $
+#	$NetBSD: Makefile,v 1.24 2021/02/26 00:41:56 christos Exp $
 
 .include 
 
 USE_WIDECHAR?=yes
-USE_BUILTIN_REGEX?=no	# Our regex supports widechar
+USE_BUILTIN_REGEX?=yes	# Although our regex supports widechar nvi requires
+			# a non-standard API
 
 WARNS=	5
 



CVS commit: src/tests/lib/libc/regex

2021-02-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 25 22:37:37 UTC 2021

Modified Files:
src/tests/lib/libc/regex: Makefile debug.c

Log Message:
Adjust for conditional NLS


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/lib/libc/regex/Makefile
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libc/regex/debug.c

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

Modified files:

Index: src/tests/lib/libc/regex/Makefile
diff -u src/tests/lib/libc/regex/Makefile:1.10 src/tests/lib/libc/regex/Makefile:1.11
--- src/tests/lib/libc/regex/Makefile:1.10	Thu Aug 25 21:31:43 2016
+++ src/tests/lib/libc/regex/Makefile	Thu Feb 25 17:37:36 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.10 2016/08/26 01:31:43 darcy Exp $
+# $NetBSD: Makefile,v 1.11 2021/02/25 22:37:36 christos Exp $
 
 NOMAN=
 
@@ -10,7 +10,7 @@ IMPLEMENTATION?=	-DREGEX_SPENCER -DSKIP_
 BINDIR=		${TESTSDIR}
 PROGS?=		h_regex
 SRCS.h_regex=	main.c split.c debug.c
-CPPFLAGS+=	-I${NETBSDSRCDIR}/lib/libc/regex ${IMPLEMENTATION}
+CPPFLAGS+=	-I${NETBSDSRCDIR}/lib/libc/regex ${IMPLEMENTATION} -DNLS
 
 TESTS_SH?=	t_regex
 TESTS_C=	t_regex_att

Index: src/tests/lib/libc/regex/debug.c
diff -u src/tests/lib/libc/regex/debug.c:1.6 src/tests/lib/libc/regex/debug.c:1.7
--- src/tests/lib/libc/regex/debug.c:1.6	Wed Feb 24 13:18:53 2021
+++ src/tests/lib/libc/regex/debug.c	Thu Feb 25 17:37:36 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: debug.c,v 1.6 2021/02/24 18:18:53 christos Exp $	*/
+/*	$NetBSD: debug.c,v 1.7 2021/02/25 22:37:36 christos Exp $	*/
 
 /*-
  * Copyright (c) 1993 The NetBSD Foundation, Inc.
@@ -33,8 +33,6 @@
 #include 
 #include 
 #include 
-#include 
-#include 
 
 #ifndef __linux__
 /* Don't sort these! */



CVS commit: src/lib/libc/regex

2021-02-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 25 21:59:27 UTC 2021

Modified Files:
src/lib/libc/regex: regcomp.c

Log Message:
add missing _


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/lib/libc/regex/regcomp.c

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

Modified files:

Index: src/lib/libc/regex/regcomp.c
diff -u src/lib/libc/regex/regcomp.c:1.43 src/lib/libc/regex/regcomp.c:1.44
--- src/lib/libc/regex/regcomp.c:1.43	Thu Feb 25 16:47:46 2021
+++ src/lib/libc/regex/regcomp.c	Thu Feb 25 16:59:27 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: regcomp.c,v 1.43 2021/02/25 21:47:46 christos Exp $	*/
+/*	$NetBSD: regcomp.c,v 1.44 2021/02/25 21:59:27 christos Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-3-Clause
@@ -47,7 +47,7 @@
 static char sccsid[] = "@(#)regcomp.c	8.5 (Berkeley) 3/20/94";
 __FBSDID("$FreeBSD: head/lib/libc/regex/regcomp.c 368359 2020-12-05 03:18:48Z kevans $");
 #endif
-__RCSID("$NetBSD: regcomp.c,v 1.43 2021/02/25 21:47:46 christos Exp $");
+__RCSID("$NetBSD: regcomp.c,v 1.44 2021/02/25 21:59:27 christos Exp $");
 
 #define _OPENBSD_SOURCE
 
@@ -65,7 +65,7 @@ __RCSID("$NetBSD: regcomp.c,v 1.43 2021/
 #include 
 #include 
 
-#if defined(_weak_alias) && !defined(LIBHACK)
+#if defined(__weak_alias) && !defined(LIBHACK)
 __weak_alias(regcomp,_regcomp)
 #endif
 



CVS commit: src/external/bsd/nvi/usr.bin/nvi

2021-02-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 25 21:56:35 UTC 2021

Modified Files:
src/external/bsd/nvi/usr.bin/nvi: Makefile

Log Message:
we don't need the extra copy wide-regex anymore.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/external/bsd/nvi/usr.bin/nvi/Makefile

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

Modified files:

Index: src/external/bsd/nvi/usr.bin/nvi/Makefile
diff -u src/external/bsd/nvi/usr.bin/nvi/Makefile:1.22 src/external/bsd/nvi/usr.bin/nvi/Makefile:1.23
--- src/external/bsd/nvi/usr.bin/nvi/Makefile:1.22	Mon Apr 20 09:04:10 2020
+++ src/external/bsd/nvi/usr.bin/nvi/Makefile	Thu Feb 25 16:56:35 2021
@@ -1,18 +1,15 @@
-#	$NetBSD: Makefile,v 1.22 2020/04/20 13:04:10 joerg Exp $
+#	$NetBSD: Makefile,v 1.23 2021/02/25 21:56:35 christos Exp $
 
 .include 
 
 USE_WIDECHAR?=yes
+USE_BUILTIN_REGEX?=no	# Our regex supports widechar
 
 WARNS=	5
 
 COPTS.exf.c+=		-Wno-format-nonliteral
 COPTS.msg.c+=		-Wno-format-nonliteral
-.if ${USE_WIDECHAR} == "yes"
-.if ${ACTIVE_CC} == "gcc"
-COPTS.regexec.c+=	-Wno-old-style-definition
-.endif
-.else
+.if ${USE_WIDECHAR} != "yes"
 COPTS.v_increment.c+=	-Wno-format-nonliteral
 CWARNFLAGS.gcc+=	-Wno-unused
 CWARNFLAGS.clang+=	-Wno-unsequenced
@@ -57,7 +54,10 @@ NOTUSED=ip_funcs.c ip_read.c ip_screen.c
 	ip_run.c ip_send.c ip_trans.c ipc_cmd.c ipc_method.c
 
 # For wide char support
-.if ${USE_WIDECHAR} == "yes"
+.if ${USE_BUILTIN_REGEX} == "yes"
+.if ${ACTIVE_CC} == "gcc"
+COPTS.regexec.c+=	-Wno-old-style-definition
+.endif
 SRCS+=	regcomp.c regerror.c regexec.c regfree.c
 CPPFLAGS+=-I${DIST}/regex -D__REGEX_PRIVATE -DUSE_WIDECHAR
 .endif



CVS commit: src/lib/libc/regex

2021-02-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 25 21:47:46 UTC 2021

Modified Files:
src/lib/libc/regex: engine.c regcomp.c

Log Message:
fix NLS compilation


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/lib/libc/regex/engine.c
cvs rdiff -u -r1.42 -r1.43 src/lib/libc/regex/regcomp.c

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

Modified files:

Index: src/lib/libc/regex/engine.c
diff -u src/lib/libc/regex/engine.c:1.28 src/lib/libc/regex/engine.c:1.29
--- src/lib/libc/regex/engine.c:1.28	Thu Feb 25 16:28:40 2021
+++ src/lib/libc/regex/engine.c	Thu Feb 25 16:47:46 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: engine.c,v 1.28 2021/02/25 21:28:40 christos Exp $ */
+/* $NetBSD: engine.c,v 1.29 2021/02/25 21:47:46 christos Exp $ */
 
 /*-
  * SPDX-License-Identifier: BSD-3-Clause
@@ -41,7 +41,7 @@
 #ifdef __FBSDID
 __FBSDID("$FreeBSD: head/lib/libc/regex/engine.c 368358 2020-12-05 03:16:05Z kevans $");
 #endif
-__RCSID("$NetBSD: engine.c,v 1.28 2021/02/25 21:28:40 christos Exp $");
+__RCSID("$NetBSD: engine.c,v 1.29 2021/02/25 21:47:46 christos Exp $");
 
 #include 
 
@@ -187,9 +187,8 @@ stepback(const char *start, const char *
 
 	return (ret);
 out:
-#else
-	return (cur - nchar) > start ? cur - nchar : NULL;
 #endif
+	return (cur - nchar) > start ? cur - nchar : NULL;
 }
 
 /*

Index: src/lib/libc/regex/regcomp.c
diff -u src/lib/libc/regex/regcomp.c:1.42 src/lib/libc/regex/regcomp.c:1.43
--- src/lib/libc/regex/regcomp.c:1.42	Thu Feb 25 16:28:40 2021
+++ src/lib/libc/regex/regcomp.c	Thu Feb 25 16:47:46 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: regcomp.c,v 1.42 2021/02/25 21:28:40 christos Exp $	*/
+/*	$NetBSD: regcomp.c,v 1.43 2021/02/25 21:47:46 christos Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-3-Clause
@@ -47,7 +47,7 @@
 static char sccsid[] = "@(#)regcomp.c	8.5 (Berkeley) 3/20/94";
 __FBSDID("$FreeBSD: head/lib/libc/regex/regcomp.c 368359 2020-12-05 03:18:48Z kevans $");
 #endif
-__RCSID("$NetBSD: regcomp.c,v 1.42 2021/02/25 21:28:40 christos Exp $");
+__RCSID("$NetBSD: regcomp.c,v 1.43 2021/02/25 21:47:46 christos Exp $");
 
 #define _OPENBSD_SOURCE
 
@@ -2130,7 +2130,7 @@ findmust(struct parse *p, struct re_guts
 		while (OP(s = *scan++) != OCHAR)
 			continue;
 #ifdef NLS
-		clen = wcrtomb(cp, (int)OPND(s), );
+		size_t clen = wcrtomb(cp, (int)OPND(s), );
 		assert(clen != (size_t)-1);
 		cp += clen;
 #else



CVS commit: src/distrib/amiga/miniroot

2021-02-25 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Feb 25 21:46:55 UTC 2021

Modified Files:
src/distrib/amiga/miniroot: Makefile.inc install.md

Log Message:
Oops, forgot to commit this. One more adjust for amiga/boot ver 3.1.

Shuold fix build.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/distrib/amiga/miniroot/Makefile.inc
cvs rdiff -u -r1.31 -r1.32 src/distrib/amiga/miniroot/install.md

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

Modified files:

Index: src/distrib/amiga/miniroot/Makefile.inc
diff -u src/distrib/amiga/miniroot/Makefile.inc:1.20 src/distrib/amiga/miniroot/Makefile.inc:1.21
--- src/distrib/amiga/miniroot/Makefile.inc:1.20	Tue Jan 24 18:04:01 2017
+++ src/distrib/amiga/miniroot/Makefile.inc	Thu Feb 25 21:46:55 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.20 2017/01/24 18:04:01 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.21 2021/02/25 21:46:55 rin Exp $
 
 IMAGESIZE=	7m
 MAKEFS_FLAGS+=   -o density=4k
@@ -9,4 +9,4 @@ IMAGEDEPENDS+=	${ARCHDIR}/dot.profile \
 		${DESTDIR}/usr/mdec/boot.amiga \
 		${KERNOBJDIR}/INSTALL/netbsd
 
-IMAGEPOSTBUILD=	dd if=${DESTDIR}/usr/mdec/bootxx_ffs of=${IMAGE} bs=8192 conv=notrunc
+IMAGEPOSTBUILD=	dd if=${DESTDIR}/usr/mdec/bootxx_ffsv1 of=${IMAGE} bs=8192 conv=notrunc

Index: src/distrib/amiga/miniroot/install.md
diff -u src/distrib/amiga/miniroot/install.md:1.31 src/distrib/amiga/miniroot/install.md:1.32
--- src/distrib/amiga/miniroot/install.md:1.31	Sat Dec  5 18:52:06 2020
+++ src/distrib/amiga/miniroot/install.md	Thu Feb 25 21:46:55 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: install.md,v 1.31 2020/12/05 18:52:06 tsutsui Exp $
+#	$NetBSD: install.md,v 1.32 2021/02/25 21:46:55 rin Exp $
 #
 #
 # Copyright (c) 1996,2006 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@ md_installboot() {
 echo -n "Boot command? [netbsd -ASn2] "
 getresp "netbsd -ASn2"
 echo "Installing boot block..."
-chroot /mnt /usr/sbin/installboot -o command="$resp" /dev/r${1}a /usr/mdec/bootxx_ffs
+chroot /mnt /usr/sbin/installboot -o command="$resp" /dev/r${1}a /usr/mdec/bootxx_ffsv1
 cp -p /mnt/usr/mdec/boot.amiga /mnt/
 ;;
 			*)



CVS commit: src/lib/libc/regex

2021-02-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 25 21:28:40 UTC 2021

Modified Files:
src/lib/libc/regex: engine.c regcomp.c regexec.c regfree.c utils.h

Log Message:
Add glue to disable locale code in order to be smaller.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/lib/libc/regex/engine.c
cvs rdiff -u -r1.41 -r1.42 src/lib/libc/regex/regcomp.c
cvs rdiff -u -r1.24 -r1.25 src/lib/libc/regex/regexec.c
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/regex/regfree.c
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/regex/utils.h

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

Modified files:

Index: src/lib/libc/regex/engine.c
diff -u src/lib/libc/regex/engine.c:1.27 src/lib/libc/regex/engine.c:1.28
--- src/lib/libc/regex/engine.c:1.27	Wed Feb 24 13:13:21 2021
+++ src/lib/libc/regex/engine.c	Thu Feb 25 16:28:40 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: engine.c,v 1.27 2021/02/24 18:13:21 christos Exp $ */
+/* $NetBSD: engine.c,v 1.28 2021/02/25 21:28:40 christos Exp $ */
 
 /*-
  * SPDX-License-Identifier: BSD-3-Clause
@@ -41,7 +41,7 @@
 #ifdef __FBSDID
 __FBSDID("$FreeBSD: head/lib/libc/regex/engine.c 368358 2020-12-05 03:16:05Z kevans $");
 #endif
-__RCSID("$NetBSD: engine.c,v 1.27 2021/02/24 18:13:21 christos Exp $");
+__RCSID("$NetBSD: engine.c,v 1.28 2021/02/25 21:28:40 christos Exp $");
 
 #include 
 
@@ -161,13 +161,14 @@ static const char *pchar(int ch);
 static const char *
 stepback(const char *start, const char *cur, int nchar)
 {
+#ifdef NLS
 	const char *ret;
 	size_t wc, mbc;
 	mbstate_t mbs;
 	size_t clen;
 
 	if (MB_CUR_MAX == 1)
-		return ((cur - nchar) > start ? cur - nchar : NULL);
+		goto out;
 
 	ret = cur;
 	for (wc = nchar; wc > 0; wc--) {
@@ -185,6 +186,10 @@ stepback(const char *start, const char *
 	}
 
 	return (ret);
+out:
+#else
+	return (cur - nchar) > start ? cur - nchar : NULL;
+#endif
 }
 
 /*

Index: src/lib/libc/regex/regcomp.c
diff -u src/lib/libc/regex/regcomp.c:1.41 src/lib/libc/regex/regcomp.c:1.42
--- src/lib/libc/regex/regcomp.c:1.41	Thu Feb 25 08:42:16 2021
+++ src/lib/libc/regex/regcomp.c	Thu Feb 25 16:28:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: regcomp.c,v 1.41 2021/02/25 13:42:16 christos Exp $	*/
+/*	$NetBSD: regcomp.c,v 1.42 2021/02/25 21:28:40 christos Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-3-Clause
@@ -47,12 +47,15 @@
 static char sccsid[] = "@(#)regcomp.c	8.5 (Berkeley) 3/20/94";
 __FBSDID("$FreeBSD: head/lib/libc/regex/regcomp.c 368359 2020-12-05 03:18:48Z kevans $");
 #endif
-__RCSID("$NetBSD: regcomp.c,v 1.41 2021/02/25 13:42:16 christos Exp $");
+__RCSID("$NetBSD: regcomp.c,v 1.42 2021/02/25 21:28:40 christos Exp $");
 
 #define _OPENBSD_SOURCE
+
+#ifndef LIBHACK
 #define REGEX_GNU_EXTENSIONS
 
 #include "namespace.h"
+#endif
 #include 
 #include 
 #include 
@@ -61,10 +64,8 @@ __RCSID("$NetBSD: regcomp.c,v 1.41 2021/
 #include 
 #include 
 #include 
-#include 
-#include 
 
-#ifdef __weak_alias
+#if defined(_weak_alias) && !defined(LIBHACK)
 __weak_alias(regcomp,_regcomp)
 #endif
 
@@ -222,6 +223,46 @@ static char nuls[10];		/* place to point
 #define MIN(a,b)	((a)<(b)?(a):(b))
 #endif
 
+#ifndef NLS
+static const struct {
+	const char *name;
+	int (*func)(int);
+} wctypes[] = {
+#define ADD(x) { .name = # x, .func = is ## x }
+	ADD(alnum),
+	ADD(alpha),
+	ADD(blank),
+	ADD(cntrl),
+	ADD(digit),
+	ADD(graph),
+	ADD(lower),
+	ADD(print),
+	ADD(punct),
+	ADD(space),
+	ADD(upper),
+	ADD(xdigit),
+#undef ADD
+};
+
+wctype_t
+__regex_wctype(const char *str)
+{
+	for (size_t i = 0; i < __arraycount(wctypes); i++) {
+		if (strcmp(wctypes[i].name, str) == 0)
+			return (wctype_t)(i + 1);
+	}
+	return (wctype_t)0;
+}
+
+int
+__regex_iswctype(wint_t c, wctype_t ct)
+{
+	if (ct == 0)
+		return 0;
+	return (*wctypes[ct - 1].func)(c);
+}
+#endif
+
 static int/* 0 success, otherwise REG_something */
 regcomp_internal(regex_t * __restrict preg,
 	const char * __restrict pattern,
@@ -1063,7 +1104,7 @@ p_range_cmp(wchar_t c1, wchar_t c2)
 {
 #ifdef REGEX_LIBC_COLLATE
 	return __wcollate_range_cmp(c1, c2);
-#else
+#elif defined(NLS)
 	/* Copied from libc/collate __wcollate_range_cmp */
 	wchar_t s1[2], s2[2];
 
@@ -1071,7 +1112,15 @@ p_range_cmp(wchar_t c1, wchar_t c2)
 	s1[1] = L'\0';
 	s2[0] = c2;
 	s2[1] = L'\0';
-	return (wcscoll(s1, s2));
+	return wcscoll(s1, s2);
+#else
+	char s1[2], s2[2];
+
+	s1[0] = (char)c1;
+	s1[1] = '\0';
+	s2[0] = (char)c2;
+	s2[1] = '\0';
+	return strcoll(s1, s2);
 #endif
 }
 
@@ -1219,6 +1268,7 @@ p_b_cclass(struct parse *p, cset *cs)
 
 	p_b_cclass_named(p, cs, clname);
 }
+
 /*
  - p_b_cclass_named - deal with a named character class
  == static void p_b_cclass_named(struct parse *p, cset *cs, const char []);
@@ -1283,9 +1333,7 @@ p_b_coll_elem(struct parse *p,
 {
 	const char *sp = p->next;
 	struct cname *cp;
-	mbstate_t mbs;
-	wchar_t wc;
-	size_t clen, len;
+	size_t len;
 
 	_DIAGASSERT(p != NULL);
 
@@ -1299,6 +1347,11 @@ 

CVS commit: src/distrib/utils/libhack

2021-02-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 25 21:24:00 UTC 2021

Modified Files:
src/distrib/utils/libhack: Makefile.inc

Log Message:
Add regcomp.c and regexec.c so that we get a version that does not use NLS
and brings in all the locale code.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/distrib/utils/libhack/Makefile.inc

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

Modified files:

Index: src/distrib/utils/libhack/Makefile.inc
diff -u src/distrib/utils/libhack/Makefile.inc:1.36 src/distrib/utils/libhack/Makefile.inc:1.37
--- src/distrib/utils/libhack/Makefile.inc:1.36	Fri Apr 17 10:55:24 2020
+++ src/distrib/utils/libhack/Makefile.inc	Thu Feb 25 16:24:00 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.36 2020/04/17 14:55:24 jdolecek Exp $
+# $NetBSD: Makefile.inc,v 1.37 2021/02/25 21:24:00 christos Exp $
 #
 # Include this fragment to build libhack.o
 # It is .o and not .a to make sure these are the
@@ -25,7 +25,7 @@ HACKOBJS+=	getcap.o getgrent.o getnet.o 
 		localeconv.o multibyte.o perror.o runetable.o setlocale.o \
 		nl_langinfo.o strcasecmp.o \
 		strerror.o strsignal.o syslog.o utmp.o fmtcheck.o \
-	aligned_alloc.o
+		aligned_alloc.o regcomp.o regexec.o
 
 .if (${USE_YP} != "no")
 HACKOBJS+=	yplib.o
@@ -78,9 +78,12 @@ libhack.o: ${HACKOBJS}
 	${HACKSRC} \
 	${HACKSRC}/../../../lib/libc/gen \
 	${HACKSRC}/../../../lib/libc/locale \
+	${HACKSRC}/../../../lib/libc/regex \
 	${HACKSRC}/../../../lib/libc/stdlib
 .else
 # XXX .PATH won't work here, because of crunchgen used by various builds
+regcomp.o:	${HACKSRC}/../../../lib/libc/regex/regcomp.c
+regexec.o:	${HACKSRC}/../../../lib/libc/regex/regexec.c
 getcap.o:	${HACKSRC}/../../../lib/libc/gen/getcap.c
 getgrent.o:	${HACKSRC}/getgrent.c
 gethost.o:	${HACKSRC}/gethost.c



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

2021-02-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 25 20:51:10 UTC 2021

Modified Files:
src/sys/arch/macppc/dev: smuiic.c

Log Message:
more node name adjustments
also, pass sensor names if we can find them
now we find and currectly use the hard drive temperature sensor on my iMac G5


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/macppc/dev/smuiic.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/macppc/dev/smuiic.c
diff -u src/sys/arch/macppc/dev/smuiic.c:1.5 src/sys/arch/macppc/dev/smuiic.c:1.6
--- src/sys/arch/macppc/dev/smuiic.c:1.5	Thu Jul  2 12:47:19 2020
+++ src/sys/arch/macppc/dev/smuiic.c	Thu Feb 25 20:51:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: smuiic.c,v 1.5 2020/07/02 12:47:19 macallan Exp $ */
+/*	$NetBSD: smuiic.c,v 1.6 2021/02/25 20:51:10 macallan Exp $ */
 
 /*-
  * Copyright (c) 2013 Phileas Fogg
@@ -62,6 +62,8 @@ smuiic_match(device_t parent, struct cfd
 
 	if (strcmp(ca->ca_name, "i2c-bus") == 0)
 		return 5;
+	if (strcmp(ca->ca_name, "i2c") == 0)
+		return 5;
 	
 	return 0;
 }
@@ -73,13 +75,13 @@ smuiic_attach(device_t parent, device_t 
 	struct smuiic_softc *sc = device_private(self);
 	struct i2cbus_attach_args iba;
 	prop_dictionary_t dict = device_properties(self);
-	int devs;
+	int devs, devc;
 	uint32_t addr;
 	char compat[256];
 	prop_array_t cfg;
 	prop_dictionary_t dev;
 	prop_data_t data;
-	char name[32];
+	char name[32], descr[32], num[8];
 
 	sc->sc_dev = self;
 	sc->sc_node = ca->ca_node;
@@ -108,6 +110,18 @@ smuiic_attach(device_t parent, device_t 
 		prop_object_release(data);
 		prop_dictionary_set_uint32(dev, "addr", addr);
 		prop_dictionary_set_uint64(dev, "cookie", devs);
+		devc = OF_child(devs);
+		while (devc != 0) {
+			int reg;
+			if (OF_getprop(devc, "reg", , 4) < 4) goto nope;
+			if (OF_getprop(devc, "location", descr, 32) <= 0)
+goto nope;
+			printf("found '%s' at %02x\n", descr, reg);
+			snprintf(num, 7, "s%02x", reg);
+			prop_dictionary_set_string(dev, num, descr);
+		nope:
+			devc = OF_peer(devc);
+		}
 		prop_array_add(cfg, dev);
 		prop_object_release(dev);
 	skip:



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

2021-02-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 25 20:49:08 UTC 2021

Modified Files:
src/sys/arch/macppc/dev: smu.c

Log Message:
deal with node name inconsistencies between PowerMac10,x and 8,x
Now we find fans and iic devices on iMac G5


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/macppc/dev/smu.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/macppc/dev/smu.c
diff -u src/sys/arch/macppc/dev/smu.c:1.9 src/sys/arch/macppc/dev/smu.c:1.10
--- src/sys/arch/macppc/dev/smu.c:1.9	Sat Jul  4 11:55:18 2020
+++ src/sys/arch/macppc/dev/smu.c	Thu Feb 25 20:49:08 2021
@@ -289,51 +289,56 @@ smu_setup_fans(struct smu_softc *sc)
 	struct sysctlnode *sysctl_fans, *sysctl_fan, *sysctl_node;
 	char type[32], sysctl_fan_name[32];
 	int node, i, j;
+	const char *fans[] = { "fans", "rpm-fans", 0 };
+	int n = 0;
+	
+	while (fans[n][0] != 0) {
+		node = of_getnode_byname(sc->sc_node, fans[n]);
+		for (node = OF_child(node);
+		(node != 0) && (sc->sc_num_fans < SMU_MAX_FANS);
+		node = OF_peer(node)) {
+			fan = >sc_fans[sc->sc_num_fans];
+			fan->sc = sc;
+
+			memset(fan->location, 0, sizeof(fan->location));
+			OF_getprop(node, "location", fan->location,
+			sizeof(fan->location));
+
+			if (OF_getprop(node, "reg", >reg,
+			sizeof(fan->reg)) <= 0)
+continue;
+
+			if (OF_getprop(node, "zone", >zone	,
+			sizeof(fan->zone)) <= 0)
+continue;
+
+			memset(type, 0, sizeof(type));
+			OF_getprop(node, "device_type", type, sizeof(type));
+			if (strcmp(type, "fan-rpm-control") == 0)
+fan->rpm_ctl = 1;
+			else
+fan->rpm_ctl = 0;
+
+			if (OF_getprop(node, "min-value", >min_rpm,
+			sizeof(fan->min_rpm)) <= 0)
+fan->min_rpm = 0;
+
+			if (OF_getprop(node, "max-value", >max_rpm,
+			sizeof(fan->max_rpm)) <= 0)
+fan->max_rpm = 0x;
+
+			if (OF_getprop(node, "unmanage-value", >default_rpm,
+			sizeof(fan->default_rpm)) <= 0)
+fan->default_rpm = fan->max_rpm;
+
+			DPRINTF("fan: location %s reg %x zone %d rpm_ctl %d "
+			"min_rpm %d max_rpm %d default_rpm %d\n",
+			fan->location, fan->reg, fan->zone, fan->rpm_ctl,
+			fan->min_rpm, fan->max_rpm, fan->default_rpm);
 
-	node = of_getnode_byname(sc->sc_node, "fans");
-	for (node = OF_child(node);
-	(node != 0) && (sc->sc_num_fans < SMU_MAX_FANS);
-	node = OF_peer(node)) {
-		fan = >sc_fans[sc->sc_num_fans];
-		fan->sc = sc;
-
-		memset(fan->location, 0, sizeof(fan->location));
-		OF_getprop(node, "location", fan->location,
-		sizeof(fan->location));
-
-		if (OF_getprop(node, "reg", >reg,
-		sizeof(fan->reg)) <= 0)
-			continue;
-
-		if (OF_getprop(node, "zone", >zone,
-		sizeof(fan->zone)) <= 0)
-			continue;
-
-		memset(type, 0, sizeof(type));
-		OF_getprop(node, "device_type", type, sizeof(type));
-		if (strcmp(type, "fan-rpm-control") == 0)
-			fan->rpm_ctl = 1;
-		else
-			fan->rpm_ctl = 0;
-
-		if (OF_getprop(node, "min-value", >min_rpm,
-		sizeof(fan->min_rpm)) <= 0)
-			fan->min_rpm = 0;
-
-		if (OF_getprop(node, "max-value", >max_rpm,
-		sizeof(fan->max_rpm)) <= 0)
-			fan->max_rpm = 0x;
-
-		if (OF_getprop(node, "unmanage-value", >default_rpm,
-		sizeof(fan->default_rpm)) <= 0)
-			fan->default_rpm = fan->max_rpm;
-
-		DPRINTF("fan: location %s reg %x zone %d rpm_ctl %d "
-		"min_rpm %d max_rpm %d default_rpm %d\n",
-		fan->location, fan->reg, fan->zone, fan->rpm_ctl,
-		fan->min_rpm, fan->max_rpm, fan->default_rpm);
-
-		sc->sc_num_fans++;
+			sc->sc_num_fans++;
+		}
+		n++;
 	}
 
 	for (i = 0; i < sc->sc_num_fans; i++) {
@@ -433,12 +438,14 @@ smu_setup_iicbus(struct smu_softc *sc)
 	char name[32];
 
 	node = of_getnode_byname(sc->sc_node, "smu-i2c-control");
+	if (node == 0) node = sc->sc_node;
 	for (node = OF_child(node);
 	(node != 0) && (sc->sc_num_iicbus < SMU_MAX_IICBUS);
 	node = OF_peer(node)) {
 		memset(name, 0, sizeof(name));
 		OF_getprop(node, "name", name, sizeof(name));
-		if (strcmp(name, "i2c-bus") != 0)
+		if ((strcmp(name, "i2c-bus") != 0) &&
+		(strcmp(name, "i2c") != 0))
 			continue;
 
 		iicbus = >sc_iicbus[sc->sc_num_iicbus];
@@ -862,7 +869,8 @@ smu_setup_zones(struct smu_softc *sc)
 	z->nfans = 0;
 	for (i = 0; i < SMU_MAX_FANS; i++) {
 		f = >sc_fans[i];
-		if (strstr(f->location, "CPU") != NULL) {
+		if ((strstr(f->location, "CPU") != NULL) || 
+		(strstr(f->location, "System") != NULL)) {
 			z->fans[z->nfans] = i;
 			z->nfans++;
 		}
@@ -878,7 +886,8 @@ smu_setup_zones(struct smu_softc *sc)
 	z->nfans = 0;
 	for (i = 0; i < SMU_MAX_FANS; i++) {
 		f = >sc_fans[i];
-		if (strstr(f->location, "DRIVE") != NULL) {
+		if ((strstr(f->location, "DRIVE") != NULL) ||
+		(strstr(f->location, "Drive") != NULL)) {
 			z->fans[z->nfans] = i;
 			z->nfans++;
 		}
@@ -959,7 +968,7 @@ smu_adjust(void *cookie)
 	while (!sc->sc_dying) {
 		for 

CVS commit: src/sys/dev/pci

2021-02-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 25 19:11:44 UTC 2021

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

Log Message:
match Geforce FX5200 Go found in some iMac G5 models


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/pci/gffb.c

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

Modified files:

Index: src/sys/dev/pci/gffb.c
diff -u src/sys/dev/pci/gffb.c:1.14 src/sys/dev/pci/gffb.c:1.15
--- src/sys/dev/pci/gffb.c:1.14	Thu May 21 22:55:48 2020
+++ src/sys/dev/pci/gffb.c	Thu Feb 25 19:11:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: gffb.c,v 1.14 2020/05/21 22:55:48 macallan Exp $	*/
+/*	$NetBSD: gffb.c,v 1.15 2021/02/25 19:11:44 macallan Exp $	*/
 
 /*
  * Copyright (c) 2013 Michael Lorenz
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gffb.c,v 1.14 2020/05/21 22:55:48 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gffb.c,v 1.15 2021/02/25 19:11:44 macallan Exp $");
 
 #include 
 #include 
@@ -165,6 +165,8 @@ gffb_match(device_t parent, cfdata_t mat
 		return 100;
 	if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_NVIDIA_GEFORCE_6800U)
 		return 100;
+	if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_NVIDIA_GF_FXGO5200)
+		return 100;
 	return (0);
 }
 



CVS commit: src/lib/libc/regex

2021-02-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 25 13:42:16 UTC 2021

Modified Files:
src/lib/libc/regex: regcomp.c

Log Message:
protect MIN from re-definition


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/lib/libc/regex/regcomp.c

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

Modified files:

Index: src/lib/libc/regex/regcomp.c
diff -u src/lib/libc/regex/regcomp.c:1.40 src/lib/libc/regex/regcomp.c:1.41
--- src/lib/libc/regex/regcomp.c:1.40	Wed Feb 24 13:13:21 2021
+++ src/lib/libc/regex/regcomp.c	Thu Feb 25 08:42:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: regcomp.c,v 1.40 2021/02/24 18:13:21 christos Exp $	*/
+/*	$NetBSD: regcomp.c,v 1.41 2021/02/25 13:42:16 christos Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-3-Clause
@@ -47,7 +47,7 @@
 static char sccsid[] = "@(#)regcomp.c	8.5 (Berkeley) 3/20/94";
 __FBSDID("$FreeBSD: head/lib/libc/regex/regcomp.c 368359 2020-12-05 03:18:48Z kevans $");
 #endif
-__RCSID("$NetBSD: regcomp.c,v 1.40 2021/02/24 18:13:21 christos Exp $");
+__RCSID("$NetBSD: regcomp.c,v 1.41 2021/02/25 13:42:16 christos Exp $");
 
 #define _OPENBSD_SOURCE
 #define REGEX_GNU_EXTENSIONS
@@ -218,7 +218,9 @@ static char nuls[10];		/* place to point
 #define	DROP(n)	(p->slen -= (n))
 
 /* Macro used by computejump()/computematchjump() */
+#ifndef MIN
 #define MIN(a,b)	((a)<(b)?(a):(b))
+#endif
 
 static int/* 0 success, otherwise REG_something */
 regcomp_internal(regex_t * __restrict preg,



CVS commit: src/tools/compat

2021-02-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 25 13:41:58 UTC 2021

Modified Files:
src/tools/compat: Makefile compat_defs.h configure configure.ac
nbtool_config.h.in

Log Message:
Add reallocarray; this is used by the new regex code and we don't want to
convert it to reallocarr so the code is kept similar with the original from
FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/tools/compat/Makefile
cvs rdiff -u -r1.117 -r1.118 src/tools/compat/compat_defs.h
cvs rdiff -u -r1.98 -r1.99 src/tools/compat/configure \
src/tools/compat/configure.ac
cvs rdiff -u -r1.52 -r1.53 src/tools/compat/nbtool_config.h.in

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

Modified files:

Index: src/tools/compat/Makefile
diff -u src/tools/compat/Makefile:1.88 src/tools/compat/Makefile:1.89
--- src/tools/compat/Makefile:1.88	Sat Jun 13 06:49:17 2020
+++ src/tools/compat/Makefile	Thu Feb 25 08:41:58 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.88 2020/06/13 10:49:17 lukem Exp $
+#	$NetBSD: Makefile,v 1.89 2021/02/25 13:41:58 christos Exp $
 
 HOSTLIB=	nbcompat
 
@@ -13,7 +13,8 @@ SRCS=		atoll.c basename.c cdbr.c cdbw.c 
 		mi_vector_hash.c mkdtemp.c \
 		mkstemp.c pread.c putc_unlocked.c pwcache.c pwrite.c \
 		pw_scan.c \
-		raise_default_signal.c rb.c reallocarr.c rmd160.c rmd160hl.c \
+		raise_default_signal.c rb.c reallocarr.c reallocarray.c \
+		rmd160.c rmd160hl.c \
 		regcomp.c regerror.c regexec.c regfree.c \
 		setenv.c setgroupent.c \
 		setpassent.c setprogname.c sha1.c sha1hl.c sha2.c \

Index: src/tools/compat/compat_defs.h
diff -u src/tools/compat/compat_defs.h:1.117 src/tools/compat/compat_defs.h:1.118
--- src/tools/compat/compat_defs.h:1.117	Tue Feb 23 11:03:00 2021
+++ src/tools/compat/compat_defs.h	Thu Feb 25 08:41:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_defs.h,v 1.117 2021/02/23 16:03:00 rin Exp $	*/
+/*	$NetBSD: compat_defs.h,v 1.118 2021/02/25 13:41:58 christos Exp $	*/
 
 #ifndef	__NETBSD_COMPAT_DEFS_H__
 #define	__NETBSD_COMPAT_DEFS_H__
@@ -556,6 +556,10 @@ int raise_default_signal(int);
 int reallocarr(void *, size_t, size_t);
 #endif
 
+#if !HAVE_DECL_REALLOCARRAY
+void *reallocarray(void *, size_t, size_t);
+#endif
+
 #if !HAVE_DECL_SETENV
 int setenv(const char *, const char *, int);
 #endif

Index: src/tools/compat/configure
diff -u src/tools/compat/configure:1.98 src/tools/compat/configure:1.99
--- src/tools/compat/configure:1.98	Wed Jun 24 10:44:44 2020
+++ src/tools/compat/configure	Thu Feb 25 08:41:58 2021
@@ -4832,6 +4832,19 @@ fi
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_REALLOCARR $ac_have_decl
 _ACEOF
+ac_fn_c_check_decl "$LINENO" "reallocarray" "ac_cv_have_decl_reallocarray" "
+#include 
+
+"
+if test "x$ac_cv_have_decl_reallocarray" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_REALLOCARRAY $ac_have_decl
+_ACEOF
 ac_fn_c_check_decl "$LINENO" "getsubopt" "ac_cv_have_decl_getsubopt" "
 #include 
 
@@ -5285,7 +5298,7 @@ for ac_func in atoll asprintf asnprintf 
 	getopt getopt_long group_from_gid gid_from_group \
 	heapsort isblank issetugid lchflags lchmod lchown lutimes mkstemp \
 	mkdtemp poll pread putc_unlocked pwcache_userdb pwcache_groupdb \
-	pwrite raise_default_signal random reallocarr setenv \
+	pwrite raise_default_signal random reallocarr reallocarray setenv \
 	setgroupent setprogname setpassent \
 	snprintb_m snprintf strlcat strlcpy strmode \
 	strcasecmp strncasecmp strndup strnlen strsep strsuftoll strtoi \
Index: src/tools/compat/configure.ac
diff -u src/tools/compat/configure.ac:1.98 src/tools/compat/configure.ac:1.99
--- src/tools/compat/configure.ac:1.98	Wed Jun 24 10:39:01 2020
+++ src/tools/compat/configure.ac	Thu Feb 25 08:41:58 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: configure.ac,v 1.98 2020/06/24 14:39:01 uwe Exp $
+#	$NetBSD: configure.ac,v 1.99 2021/02/25 13:41:58 christos Exp $
 #
 # Autoconf definition file for libnbcompat.
 #
@@ -179,8 +179,9 @@ AC_CHECK_DECLS([asprintf, asnprintf, vas
 #include 
 ])
 
-AC_CHECK_DECLS([atoll, heapsort, mkdtemp, mkstemp, reallocarr, getsubopt,
-	setenv, strtoi, strtoll, strtou, setprogname, getprogname],,, [
+AC_CHECK_DECLS([atoll, heapsort, mkdtemp, mkstemp, reallocarr, reallocarray,
+	getsubopt, setenv, strtoi, strtoll, strtou, setprogname,
+	getprogname],,, [
 #include 
 ])
 
@@ -223,7 +224,7 @@ AC_CHECK_FUNCS(atoll asprintf asnprintf 
 	getopt getopt_long group_from_gid gid_from_group \
 	heapsort isblank issetugid lchflags lchmod lchown lutimes mkstemp \
 	mkdtemp poll pread putc_unlocked pwcache_userdb pwcache_groupdb \
-	pwrite raise_default_signal random reallocarr setenv \
+	pwrite raise_default_signal random reallocarr reallocarray setenv \
 	setgroupent setprogname setpassent \
 	snprintb_m snprintf strlcat strlcpy strmode \
 	strcasecmp strncasecmp strndup strnlen strsep strsuftoll strtoi \

Index: 

CVS commit: othersrc/usr.bin/sleepto

2021-02-25 Thread Simon Burge
Module Name:othersrc
Committed By:   simonb
Date:   Thu Feb 25 10:18:38 UTC 2021

Modified Files:
othersrc/usr.bin/sleepto: sleepto.c

Log Message:
Use %lld and cast to "long long" for any time_t's.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 othersrc/usr.bin/sleepto/sleepto.c

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

Modified files:

Index: othersrc/usr.bin/sleepto/sleepto.c
diff -u othersrc/usr.bin/sleepto/sleepto.c:1.2 othersrc/usr.bin/sleepto/sleepto.c:1.3
--- othersrc/usr.bin/sleepto/sleepto.c:1.2	Thu Feb 25 08:42:31 2021
+++ othersrc/usr.bin/sleepto/sleepto.c	Thu Feb 25 10:18:38 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: sleepto.c,v 1.2 2021/02/25 08:42:31 simonb Exp $ */
+/* $NetBSD: sleepto.c,v 1.3 2021/02/25 10:18:38 simonb Exp $ */
 
 #include 
 #include 
@@ -42,7 +42,7 @@ main(int argc, char *argv[])
 	when = parsetime(argc, argv);
 	now = tv.tv_sec;
 
-	printf("sleeping for %ld seconds...\n", when - now);
+	printf("sleeping for %lld seconds...\n", (long long)when - now);
 	ntime.tv_sec = when - now;
 	if (ntime.tv_sec <= 0)
 		return EXIT_SUCCESS;
@@ -53,10 +53,10 @@ main(int argc, char *argv[])
 	while ((rv = nanosleep(, )) != 0) {
 		if (report_requested) {
 			/* Reporting does not bother with nanoseconds. */
-			warnx("about %ld second%s left out of the original %ld",
-			ntime.tv_sec,
+			warnx("about %lld second%s left out of the original %lld",
+			(long long)ntime.tv_sec,
 			ntime.tv_sec == 1 ? "" : "s",
-			original);
+			(long long)original);
 			report_requested = 0;
 		} else
 			break;



CVS commit: [netbsd-8] src/doc

2021-02-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 25 09:39:58 UTC 2021

Modified Files:
src/doc [netbsd-8]: CHANGES-8.3

Log Message:
Ticket #1659


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.74 -r1.1.2.75 src/doc/CHANGES-8.3

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

Modified files:

Index: src/doc/CHANGES-8.3
diff -u src/doc/CHANGES-8.3:1.1.2.74 src/doc/CHANGES-8.3:1.1.2.75
--- src/doc/CHANGES-8.3:1.1.2.74	Tue Feb 23 18:57:36 2021
+++ src/doc/CHANGES-8.3	Thu Feb 25 09:39:58 2021
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.3,v 1.1.2.74 2021/02/23 18:57:36 martin Exp $
+# $NetBSD: CHANGES-8.3,v 1.1.2.75 2021/02/25 09:39:58 martin Exp $
 
 A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3
 release:
@@ -1739,3 +1739,8 @@ bin/ksh/siglist.sh1.13
 	PR/56007: ksh unable to execute ERR traps.
 	[christos, ticket #1658]
 
+sys/arch/m68k/m68k/reenter_syscall.s		1.5-1.7
+
+	m68k: PR 55990: fix kernel stack overflow panic
+	[tsutsui, ticket #1659]
+



CVS commit: [netbsd-8] src/sys/arch/m68k/m68k

2021-02-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 25 09:38:48 UTC 2021

Modified Files:
src/sys/arch/m68k/m68k [netbsd-8]: reenter_syscall.s

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1659):

sys/arch/m68k/m68k/reenter_syscall.s: revision 1.5
sys/arch/m68k/m68k/reenter_syscall.s: revision 1.6
sys/arch/m68k/m68k/reenter_syscall.s: revision 1.7

Replace magic numbers with proper macros prepared in assym.h.

No binary changes.

Note this is a preparation for a possible fix of PR port-m68k/55990.

Consistently use motorola style.  No binary changes.
Seems missed in rev 1.3:
 https://mail-index.netbsd.org/source-changes/2013/08/01/msg046378.html

Plug kernel stack leaks in reenter_syscall() for setcontext(2).
This fixes long standing kernel crashes (MMU fault, address error,
and silent freeze by a double bus fault etc. seen for ~10 years)
caused by kernel stack overflow, especially on x68k and sun3 running
Xorg based servers.  See PR/55990 for more details.

"This change seems perfectly reasonable" from thorpej@ and
jklos@ also reported this also solved freeze of his mac68k system
with 10 megabyes of memory.

Should be pulled up to netbsd-9 and netbsd-8.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.22.1 src/sys/arch/m68k/m68k/reenter_syscall.s

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/m68k/m68k/reenter_syscall.s
diff -u src/sys/arch/m68k/m68k/reenter_syscall.s:1.4 src/sys/arch/m68k/m68k/reenter_syscall.s:1.4.22.1
--- src/sys/arch/m68k/m68k/reenter_syscall.s:1.4	Sat Sep  7 19:06:29 2013
+++ src/sys/arch/m68k/m68k/reenter_syscall.s	Thu Feb 25 09:38:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: reenter_syscall.s,v 1.4 2013/09/07 19:06:29 chs Exp $	*/
+/*	$NetBSD: reenter_syscall.s,v 1.4.22.1 2021/02/25 09:38:48 martin Exp $	*/
 
 /*
  * Written by ITOH Yasufumi.
@@ -6,6 +6,7 @@
  */
 
 #include 
+#include "assym.h"
 
 /*
  * void reenter_syscall(struct frame *fp, int stkadj)
@@ -38,18 +39,31 @@ ENTRY_NOPROFILE(reenter_syscall)
 .Lcpfr:	movel	(%a0)+,(%a1)+
 	dbra	%d0,.Lcpfr
 
-	movew	%d1,%sp@(16*4+2)	| set stack adjust count
+	movew	%d1,FR_ADJ(%sp)		| set stack adjust count
 	movel	(%sp),-(%sp)		| push syscall no (original d0 value)
 	jbsr	_C_LABEL(syscall)	| re-enter syscall()
 	addql	#4,%sp			| pop syscall no
 #ifdef DEBUG
-	tstw	%sp@(16*4+2)		| stack adjust must be zero
+	tstw	FR_ADJ(%sp)		| stack adjust must be zero
 	jeq	.Ladjzero
 	PANIC("reenter_syscall")
 .Ladjzero:
 #endif
-	moveal	%sp@(15*4),%a0		| grab and restore
+	moveal	FR_SP(%sp),%a0		| grab and restore
 	movel	%a0,%usp		|   user SP
+	movw	FR_ADJ(%sp),%d0		| need to adjust stack?
+	jne	.Ladjstk		| yes, go to it
 	moveml	(%sp)+,#0x7FFF		| restore user registers
 	addql	#8,%sp			| pop SP and stack adjust
 	jra	_ASM_LABEL(rei)		| rte
+.Ladjstk:
+	lea	FR_HW(%sp),%a1		| pointer to HW frame
+	addql	#8,%a1			| source pointer
+	movl	%a1,%a0			| source
+	addw	%d0,%a0			|  + hole size = dest pointer
+	movl	-(%a1),-(%a0)		| copy
+	movl	-(%a1),-(%a0)		|  8 bytes
+	movl	%a0,FR_SP(%sp)		| new SSP
+	moveml	(%sp)+,#0x7FFF		| restore user register
+	movl	(%sp),%sp		| and do real RTE
+	jra	_ASM_LABEL(rei)		| rte



CVS commit: [netbsd-9] src/doc

2021-02-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 25 09:37:34 UTC 2021

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

Log Message:
Ticket #1214


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.49 -r1.1.2.50 src/doc/CHANGES-9.2

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

Modified files:

Index: src/doc/CHANGES-9.2
diff -u src/doc/CHANGES-9.2:1.1.2.49 src/doc/CHANGES-9.2:1.1.2.50
--- src/doc/CHANGES-9.2:1.1.2.49	Wed Feb 24 08:08:43 2021
+++ src/doc/CHANGES-9.2	Thu Feb 25 09:37:33 2021
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.2,v 1.1.2.49 2021/02/24 08:08:43 martin Exp $
+# $NetBSD: CHANGES-9.2,v 1.1.2.50 2021/02/25 09:37:33 martin Exp $
 
 A complete list of changes from the NetBSD 9.1 release to the NetBSD 9.2
 release:
@@ -1699,3 +1699,8 @@ sys/arch/xen/xen/xennetback_xenbus.c		(a
 	fails in xennet(4) backend driver. Part of fixes for XSA-362.
 	[jdolecek, ticket #1213]
 
+sys/arch/m68k/m68k/reenter_syscall.s		1.5-1.7
+
+	m68k: PR 55990: fix kernel stack overflow panic
+	[tsutsui, ticket #1214]
+



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

2021-02-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 25 09:36:27 UTC 2021

Modified Files:
src/sys/arch/m68k/m68k [netbsd-9]: reenter_syscall.s

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1214):

sys/arch/m68k/m68k/reenter_syscall.s: revision 1.5
sys/arch/m68k/m68k/reenter_syscall.s: revision 1.6
sys/arch/m68k/m68k/reenter_syscall.s: revision 1.7

Replace magic numbers with proper macros prepared in assym.h.

No binary changes.

Note this is a preparation for a possible fix of PR port-m68k/55990.

Consistently use motorola style.  No binary changes.
Seems missed in rev 1.3:
 https://mail-index.netbsd.org/source-changes/2013/08/01/msg046378.html

Plug kernel stack leaks in reenter_syscall() for setcontext(2).
This fixes long standing kernel crashes (MMU fault, address error,
and silent freeze by a double bus fault etc. seen for ~10 years)
caused by kernel stack overflow, especially on x68k and sun3 running
Xorg based servers.  See PR/55990 for more details.

"This change seems perfectly reasonable" from thorpej@ and
jklos@ also reported this also solved freeze of his mac68k system
with 10 megabyes of memory.

Should be pulled up to netbsd-9 and netbsd-8.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.34.1 src/sys/arch/m68k/m68k/reenter_syscall.s

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/m68k/m68k/reenter_syscall.s
diff -u src/sys/arch/m68k/m68k/reenter_syscall.s:1.4 src/sys/arch/m68k/m68k/reenter_syscall.s:1.4.34.1
--- src/sys/arch/m68k/m68k/reenter_syscall.s:1.4	Sat Sep  7 19:06:29 2013
+++ src/sys/arch/m68k/m68k/reenter_syscall.s	Thu Feb 25 09:36:27 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: reenter_syscall.s,v 1.4 2013/09/07 19:06:29 chs Exp $	*/
+/*	$NetBSD: reenter_syscall.s,v 1.4.34.1 2021/02/25 09:36:27 martin Exp $	*/
 
 /*
  * Written by ITOH Yasufumi.
@@ -6,6 +6,7 @@
  */
 
 #include 
+#include "assym.h"
 
 /*
  * void reenter_syscall(struct frame *fp, int stkadj)
@@ -38,18 +39,31 @@ ENTRY_NOPROFILE(reenter_syscall)
 .Lcpfr:	movel	(%a0)+,(%a1)+
 	dbra	%d0,.Lcpfr
 
-	movew	%d1,%sp@(16*4+2)	| set stack adjust count
+	movew	%d1,FR_ADJ(%sp)		| set stack adjust count
 	movel	(%sp),-(%sp)		| push syscall no (original d0 value)
 	jbsr	_C_LABEL(syscall)	| re-enter syscall()
 	addql	#4,%sp			| pop syscall no
 #ifdef DEBUG
-	tstw	%sp@(16*4+2)		| stack adjust must be zero
+	tstw	FR_ADJ(%sp)		| stack adjust must be zero
 	jeq	.Ladjzero
 	PANIC("reenter_syscall")
 .Ladjzero:
 #endif
-	moveal	%sp@(15*4),%a0		| grab and restore
+	moveal	FR_SP(%sp),%a0		| grab and restore
 	movel	%a0,%usp		|   user SP
+	movw	FR_ADJ(%sp),%d0		| need to adjust stack?
+	jne	.Ladjstk		| yes, go to it
 	moveml	(%sp)+,#0x7FFF		| restore user registers
 	addql	#8,%sp			| pop SP and stack adjust
 	jra	_ASM_LABEL(rei)		| rte
+.Ladjstk:
+	lea	FR_HW(%sp),%a1		| pointer to HW frame
+	addql	#8,%a1			| source pointer
+	movl	%a1,%a0			| source
+	addw	%d0,%a0			|  + hole size = dest pointer
+	movl	-(%a1),-(%a0)		| copy
+	movl	-(%a1),-(%a0)		|  8 bytes
+	movl	%a0,FR_SP(%sp)		| new SSP
+	moveml	(%sp)+,#0x7FFF		| restore user register
+	movl	(%sp),%sp		| and do real RTE
+	jra	_ASM_LABEL(rei)		| rte



CVS commit: othersrc/usr.bin/sleepto

2021-02-25 Thread Simon Burge
Module Name:othersrc
Committed By:   simonb
Date:   Thu Feb 25 08:42:31 UTC 2021

Modified Files:
othersrc/usr.bin/sleepto: sleepto.c

Log Message:
Adapt rev 1.23 of bin/sleep/sleep.c:

  add SIGINFO support; from freebsd:

  when a SIGINFO is delivered, display the approximate remaining seconds.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 othersrc/usr.bin/sleepto/sleepto.c

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

Modified files:

Index: othersrc/usr.bin/sleepto/sleepto.c
diff -u othersrc/usr.bin/sleepto/sleepto.c:1.1 othersrc/usr.bin/sleepto/sleepto.c:1.2
--- othersrc/usr.bin/sleepto/sleepto.c:1.1	Thu Feb 25 07:03:57 2021
+++ othersrc/usr.bin/sleepto/sleepto.c	Thu Feb 25 08:42:31 2021
@@ -1,21 +1,34 @@
-/* $NetBSD: sleepto.c,v 1.1 2021/02/25 07:03:57 simonb Exp $ */
+/* $NetBSD: sleepto.c,v 1.2 2021/02/25 08:42:31 simonb Exp $ */
 
+#include 
+#include 
 #include 
 #include 
 #include 
 #include 
 
+#include "parsetime.h"
+
 #define TIMEFMT	"%R"
 
 static void	usage(void);
 
-extern time_t	parsetime(int, char **);
+static volatile sig_atomic_t report_requested;
+static void
+report_request(int signo __unused)
+{
+
+	report_requested = 1;
+}
+
 
 int
 main(int argc, char *argv[])
 {
+	struct timespec ntime;
 	struct timeval tv;
-	time_t when, now;
+	time_t when, now, original;
+	int rv;
 
 	if (argc < 2)
 		usage();
@@ -30,7 +43,27 @@ main(int argc, char *argv[])
 	now = tv.tv_sec;
 
 	printf("sleeping for %ld seconds...\n", when - now);
-	sleep(when - now);
+	ntime.tv_sec = when - now;
+	if (ntime.tv_sec <= 0)
+		return EXIT_SUCCESS;
+	ntime.tv_nsec = 0;
+
+	original = ntime.tv_sec;
+	signal(SIGINFO, report_request);
+	while ((rv = nanosleep(, )) != 0) {
+		if (report_requested) {
+			/* Reporting does not bother with nanoseconds. */
+			warnx("about %ld second%s left out of the original %ld",
+			ntime.tv_sec,
+			ntime.tv_sec == 1 ? "" : "s",
+			original);
+			report_requested = 0;
+		} else
+			break;
+	}
+
+	if (rv == -1)
+ 		err(EXIT_FAILURE, "nanosleep failed");
 
 	return EXIT_SUCCESS;
 }



CVS commit: othersrc/usr.bin/sleepto

2021-02-25 Thread Simon Burge
Module Name:othersrc
Committed By:   simonb
Date:   Thu Feb 25 08:40:43 UTC 2021

Modified Files:
othersrc/usr.bin/sleepto: parsetime.c stime.h

Log Message:
Include the "from" CVS tags.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 othersrc/usr.bin/sleepto/parsetime.c
cvs rdiff -u -r1.1 -r1.2 othersrc/usr.bin/sleepto/stime.h

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

Modified files:

Index: othersrc/usr.bin/sleepto/parsetime.c
diff -u othersrc/usr.bin/sleepto/parsetime.c:1.2 othersrc/usr.bin/sleepto/parsetime.c:1.3
--- othersrc/usr.bin/sleepto/parsetime.c:1.2	Thu Feb 25 07:52:27 2021
+++ othersrc/usr.bin/sleepto/parsetime.c	Thu Feb 25 08:40:43 2021
@@ -1,4 +1,5 @@
-/*	$NetBSD: parsetime.c,v 1.2 2021/02/25 07:52:27 simonb Exp $	*/
+/* from	NetBSD: parsetime.c,v 1.20 2019/02/16 17:56:57 kre Exp	*/
+/*	$NetBSD: parsetime.c,v 1.3 2021/02/25 08:40:43 simonb Exp $	*/
 
 /*
  * parsetime.c - parse time for at(1)
@@ -156,7 +157,7 @@ static bool sc_tokplur;	/* scanner - is 
 #if 0
 static char rcsid[] = "$OpenBSD: parsetime.c,v 1.4 1997/03/01 23:40:10 millert Exp $";
 #else
-__RCSID("$NetBSD: parsetime.c,v 1.2 2021/02/25 07:52:27 simonb Exp $");
+__RCSID("$NetBSD: parsetime.c,v 1.3 2021/02/25 08:40:43 simonb Exp $");
 #endif
 #endif
 

Index: othersrc/usr.bin/sleepto/stime.h
diff -u othersrc/usr.bin/sleepto/stime.h:1.1 othersrc/usr.bin/sleepto/stime.h:1.2
--- othersrc/usr.bin/sleepto/stime.h:1.1	Thu Feb 25 07:52:27 2021
+++ othersrc/usr.bin/sleepto/stime.h	Thu Feb 25 08:40:43 2021
@@ -1,4 +1,5 @@
-/*	$NetBSD: stime.h,v 1.1 2021/02/25 07:52:27 simonb Exp $	*/
+/* from	NetBSD: stime.h,v 1.4 2008/04/05 16:26:57 christos Exp	*/
+/*	$NetBSD: stime.h,v 1.2 2021/02/25 08:40:43 simonb Exp $	*/
 
 /*
  * Copyright (c) 1993