CVS commit: src/lib/libc/gen

2021-08-06 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Aug  7 03:17:23 UTC 2021

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

Log Message:
typo


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/lib/libc/gen/signal.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/signal.3
diff -u src/lib/libc/gen/signal.3:1.28 src/lib/libc/gen/signal.3:1.29
--- src/lib/libc/gen/signal.3:1.28	Wed Dec  6 16:38:22 2017
+++ src/lib/libc/gen/signal.3	Sat Aug  7 03:17:23 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: signal.3,v 1.28 2017/12/06 16:38:22 dholland Exp $
+.\"	$NetBSD: signal.3,v 1.29 2021/08/07 03:17:23 dholland Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -148,7 +148,7 @@ function;
 ignored signals remain ignored.
 .Pp
 Only functions that are async-signal-safe can safely be used in signal
-handlers, see
+handlers; see
 .Xr sigaction 2
 for a complete list.
 .Sh RETURN VALUES



CVS commit: src/games/fish

2021-07-24 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jul 25 02:00:42 UTC 2021

Modified Files:
src/games/fish: fish.c

Log Message:
Flush input to EOL correctly in games/fish.

PR 54885 from Mouse, with a somewhat different patch.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/games/fish/fish.c

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

Modified files:

Index: src/games/fish/fish.c
diff -u src/games/fish/fish.c:1.26 src/games/fish/fish.c:1.27
--- src/games/fish/fish.c:1.26	Sun May  2 12:25:55 2021
+++ src/games/fish/fish.c	Sun Jul 25 02:00:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fish.c,v 1.26 2021/05/02 12:25:55 rillig Exp $	*/
+/*	$NetBSD: fish.c,v 1.27 2021/07/25 02:00:42 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 19
 #if 0
 static char sccsid[] = "@(#)fish.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: fish.c,v 1.26 2021/05/02 12:25:55 rillig Exp $");
+__RCSID("$NetBSD: fish.c,v 1.27 2021/07/25 02:00:42 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -432,15 +432,20 @@ init(void)
 static void
 instructions(void)
 {
-	int input;
+	int input, c;
 	pid_t pid;
 	int fd;
 	const char *pager;
 	int status;
 
 	(void)printf("Would you like instructions (y or n)? ");
-	input = getchar();
-	while (getchar() != '\n');
+	input = c = getchar();
+	while (c != '\n') {
+		c = getchar();
+		if (c == EOF) {
+			exit(1);
+		}
+	}
 	if (input != 'y')
 		return;
 



CVS commit: src/sys/miscfs/kernfs

2021-07-18 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jul 19 01:33:53 UTC 2021

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

Log Message:
Abolish all the silly indirection macros for initializing vnode ops tables.

These are things of the form #define foofs_op genfs_op, or #define
foofs_op genfs_eopnotsupp, or similar. They serve no purpose besides
obfuscation, and have gotten cutpasted all over everywhere.

Part 3; cvs randomly didn't commit all the files the first time, still
hunting down the files it skipped.


To generate a diff of this commit:
cvs rdiff -u -r1.171 -r1.172 src/sys/miscfs/kernfs/kernfs_vnops.c

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

Modified files:

Index: src/sys/miscfs/kernfs/kernfs_vnops.c
diff -u src/sys/miscfs/kernfs/kernfs_vnops.c:1.171 src/sys/miscfs/kernfs/kernfs_vnops.c:1.172
--- src/sys/miscfs/kernfs/kernfs_vnops.c:1.171	Sun Jul 18 23:56:13 2021
+++ src/sys/miscfs/kernfs/kernfs_vnops.c	Mon Jul 19 01:33:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kernfs_vnops.c,v 1.171 2021/07/18 23:56:13 dholland Exp $	*/
+/*	$NetBSD: kernfs_vnops.c,v 1.172 2021/07/19 01:33:53 dholland Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.171 2021/07/18 23:56:13 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.172 2021/07/19 01:33:53 dholland Exp $");
 
 #include 
 #include 
@@ -137,8 +137,6 @@ const struct kernfs_fileop kernfs_defaul
 };
 
 int	kernfs_lookup(void *);
-#define	kernfs_create	genfs_eopnotsupp
-#define	kernfs_mknod	genfs_eopnotsupp
 int	kernfs_open(void *);
 int	kernfs_close(void *);
 int	kernfs_access(void *);
@@ -146,34 +144,15 @@ int	kernfs_getattr(void *);
 int	kernfs_setattr(void *);
 int	kernfs_read(void *);
 int	kernfs_write(void *);
-#define	kernfs_fcntl	genfs_fcntl
 int	kernfs_ioctl(void *);
-#define	kernfs_poll	genfs_poll
-#define kernfs_revoke	genfs_revoke
-#define	kernfs_fsync	genfs_nullop
-#define	kernfs_seek	genfs_nullop
-#define	kernfs_remove	genfs_eopnotsupp
 int	kernfs_link(void *);
-#define	kernfs_rename	genfs_eopnotsupp
-#define	kernfs_mkdir	genfs_eopnotsupp
-#define	kernfs_rmdir	genfs_eopnotsupp
 int	kernfs_symlink(void *);
 int	kernfs_readdir(void *);
-#define	kernfs_readlink	genfs_eopnotsupp
-#define	kernfs_abortop	genfs_abortop
 int	kernfs_inactive(void *);
 int	kernfs_reclaim(void *);
-#define	kernfs_lock	genfs_lock
-#define	kernfs_unlock	genfs_unlock
-#define	kernfs_bmap	genfs_badop
-#define	kernfs_strategy	genfs_eopnotsupp
 int	kernfs_print(void *);
-#define	kernfs_islocked	genfs_islocked
 int	kernfs_pathconf(void *);
-#define	kernfs_advlock	genfs_einval
-#define	kernfs_bwrite	genfs_eopnotsupp
 int	kernfs_getpages(void *);
-#define	kernfs_putpages	genfs_putpages
 
 static int	kernfs_xread(struct kernfs_node *, int, char **,
 size_t, size_t *);
@@ -184,8 +163,8 @@ const struct vnodeopv_entry_desc kernfs_
 	{ _default_desc, vn_default_error },
 	{ _parsepath_desc, genfs_parsepath },	/* parsepath */
 	{ _lookup_desc, kernfs_lookup },		/* lookup */
-	{ _create_desc, kernfs_create },		/* create */
-	{ _mknod_desc, kernfs_mknod },		/* mknod */
+	{ _create_desc, genfs_eopnotsupp },		/* create */
+	{ _mknod_desc, genfs_eopnotsupp },		/* mknod */
 	{ _open_desc, kernfs_open },		/* open */
 	{ _close_desc, kernfs_close },		/* close */
 	{ _access_desc, kernfs_access },		/* access */
@@ -196,35 +175,35 @@ const struct vnodeopv_entry_desc kernfs_
 	{ _write_desc, kernfs_write },		/* write */
 	{ _fallocate_desc, genfs_eopnotsupp },	/* fallocate */
 	{ _fdiscard_desc, genfs_eopnotsupp },	/* fdiscard */
-	{ _fcntl_desc, kernfs_fcntl },		/* fcntl */
+	{ _fcntl_desc, genfs_fcntl },		/* fcntl */
 	{ _ioctl_desc, kernfs_ioctl },		/* ioctl */
-	{ _poll_desc, kernfs_poll },		/* poll */
+	{ _poll_desc, genfs_poll },			/* poll */
 	{ _kqfilter_desc, genfs_kqfilter },		/* kqfilter */
-	{ _revoke_desc, kernfs_revoke },		/* revoke */
-	{ _fsync_desc, kernfs_fsync },		/* fsync */
-	{ _seek_desc, kernfs_seek },		/* seek */
-	{ _remove_desc, kernfs_remove },		/* remove */
+	{ _revoke_desc, genfs_revoke },		/* revoke */
+	{ _fsync_desc, genfs_nullop },		/* fsync */
+	{ _seek_desc, genfs_nullop },		/* seek */
+	{ _remove_desc, genfs_eopnotsupp },		/* remove */
 	{ _link_desc, kernfs_link },		/* link */
-	{ _rename_desc, kernfs_rename },		/* rename */
-	{ _mkdir_desc, kernfs_mkdir },		/* mkdir */
-	{ _rmdir_desc, kernfs_rmdir },		/* rmdir */
+	{ _rename_desc, genfs_eopnotsupp },		/* rename */
+	{ _mkdir_desc, genfs_eopnotsupp },		/* mkdir */
+	{ _rmdir_desc, genfs_eopnotsupp },		/* rmdir */
 	{ _symlink_desc, kernfs_symlink },		/* symlink */
 	{ _readdir_desc, kernfs_readdir },		/* readdir */
-	{ _readlink_desc, kernfs_readlink },	/* readlink */
-	{ _abortop_desc, kernfs_abortop },		/* abortop */
+	{ _readlink_desc, genfs_eopnotsupp },	/* readlink */
+	{ _abortop_desc, genfs_abortop },		/* abortop 

CVS commit: src/sys/fs

2021-07-18 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jul 19 01:30:25 UTC 2021

Modified Files:
src/sys/fs/cd9660: cd9660_vnops.c
src/sys/fs/puffs: puffs_vnops.c
src/sys/fs/tmpfs: tmpfs_fifoops.c tmpfs_specops.c

Log Message:
Abolish all the silly indirection macros for initializing vnode ops tables.

These are things of the form #define foofs_op genfs_op, or #define
foofs_op genfs_eopnotsupp, or similar. They serve no purpose besides
obfuscation, and have gotten cutpasted all over everywhere.

Part 2; cvs randomly didn't commit these changes before, and then hid
them from me until I touched the files to force it to rethink. Dunno
what happened.

There's probably more of these, going to have to scan the tree the
hard way.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/fs/cd9660/cd9660_vnops.c
cvs rdiff -u -r1.220 -r1.221 src/sys/fs/puffs/puffs_vnops.c
cvs rdiff -u -r1.14 -r1.15 src/sys/fs/tmpfs/tmpfs_fifoops.c
cvs rdiff -u -r1.15 -r1.16 src/sys/fs/tmpfs/tmpfs_specops.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/fs/cd9660/cd9660_vnops.c
diff -u src/sys/fs/cd9660/cd9660_vnops.c:1.60 src/sys/fs/cd9660/cd9660_vnops.c:1.61
--- src/sys/fs/cd9660/cd9660_vnops.c:1.60	Sun Jul 18 23:56:13 2021
+++ src/sys/fs/cd9660/cd9660_vnops.c	Mon Jul 19 01:30:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd9660_vnops.c,v 1.60 2021/07/18 23:56:13 dholland Exp $	*/
+/*	$NetBSD: cd9660_vnops.c,v 1.61 2021/07/19 01:30:24 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1994
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cd9660_vnops.c,v 1.60 2021/07/18 23:56:13 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd9660_vnops.c,v 1.61 2021/07/19 01:30:24 dholland Exp $");
 
 #include 
 #include 
@@ -829,21 +829,6 @@ cd9660_setattr(void *v)
 }
 
 /*
- * Global vfs data structures for isofs
- */
-#define	cd9660_create	genfs_eopnotsupp
-#define	cd9660_mknod	genfs_eopnotsupp
-#define	cd9660_write	genfs_eopnotsupp
-#define	cd9660_fsync	genfs_nullop
-#define	cd9660_remove	genfs_eopnotsupp
-#define	cd9660_rename	genfs_eopnotsupp
-#define	cd9660_mkdir	genfs_eopnotsupp
-#define	cd9660_rmdir	genfs_eopnotsupp
-#define	cd9660_advlock	genfs_einval
-#define	cd9660_bwrite	genfs_eopnotsupp
-#define cd9660_revoke	genfs_revoke
-
-/*
  * Global vfs data structures for cd9660
  */
 int (**cd9660_vnodeop_p)(void *);
@@ -851,34 +836,34 @@ const struct vnodeopv_entry_desc cd9660_
 	{ _default_desc, vn_default_error },
 	{ _parsepath_desc, genfs_parsepath },	/* parsepath */
 	{ _lookup_desc, cd9660_lookup },		/* lookup */
-	{ _create_desc, cd9660_create },		/* create */
-	{ _mknod_desc, cd9660_mknod },		/* mknod */
-	{ _open_desc, cd9660_open },		/* open */
-	{ _close_desc, cd9660_close },		/* close */
+	{ _create_desc, genfs_eopnotsupp },		/* create */
+	{ _mknod_desc, genfs_eopnotsupp },		/* mknod */
+	{ _open_desc, genfs_nullop },		/* open */
+	{ _close_desc, genfs_nullop },		/* close */
 	{ _access_desc, cd9660_access },		/* access */
 	{ _accessx_desc, genfs_accessx },		/* accessx */
 	{ _getattr_desc, cd9660_getattr },		/* getattr */
 	{ _setattr_desc, cd9660_setattr },		/* setattr */
 	{ _read_desc, cd9660_read },		/* read */
-	{ _write_desc, cd9660_write },		/* write */
+	{ _write_desc, genfs_eopnotsupp },		/* write */
 	{ _fallocate_desc, genfs_eopnotsupp },	/* fallocate */
 	{ _fdiscard_desc, genfs_eopnotsupp },	/* fdiscard */
 	{ _fcntl_desc, genfs_fcntl },		/* fcntl */
-	{ _ioctl_desc, cd9660_ioctl },		/* ioctl */
-	{ _poll_desc, cd9660_poll },		/* poll */
-	{ _revoke_desc, cd9660_revoke },		/* revoke */
-	{ _mmap_desc, cd9660_mmap },		/* mmap */
-	{ _fsync_desc, cd9660_fsync },		/* fsync */
-	{ _seek_desc, cd9660_seek },		/* seek */
-	{ _remove_desc, cd9660_remove },		/* remove */
+	{ _ioctl_desc, genfs_enoioctl },		/* ioctl */
+	{ _poll_desc, genfs_poll },			/* poll */
+	{ _revoke_desc, genfs_revoke },		/* revoke */
+	{ _mmap_desc, genfs_mmap },			/* mmap */
+	{ _fsync_desc, genfs_nullop },		/* fsync */
+	{ _seek_desc, genfs_seek },			/* seek */
+	{ _remove_desc, genfs_eopnotsupp },		/* remove */
 	{ _link_desc, cd9660_link },		/* link */
-	{ _rename_desc, cd9660_rename },		/* rename */
-	{ _mkdir_desc, cd9660_mkdir },		/* mkdir */
-	{ _rmdir_desc, cd9660_rmdir },		/* rmdir */
+	{ _rename_desc, genfs_eopnotsupp },		/* rename */
+	{ _mkdir_desc, genfs_eopnotsupp },		/* mkdir */
+	{ _rmdir_desc, genfs_eopnotsupp },		/* rmdir */
 	{ _symlink_desc, cd9660_symlink },		/* symlink */
 	{ _readdir_desc, cd9660_readdir },		/* readdir */
 	{ _readlink_desc, cd9660_readlink },	/* readlink */
-	{ _abortop_desc, cd9660_abortop },		/* abortop */
+	{ _abortop_desc, genfs_abortop },		/* abortop */
 	{ _inactive_desc, cd9660_inactive },	/* inactive */
 	{ _reclaim_desc, cd9660_reclaim },		/* reclaim */
 	{ _lock_desc, genfs_lock },			/* lock */
@@ -888,7 +873,7 @@ const struct vnodeopv_entry_desc 

CVS commit: src/sys/fs/ptyfs

2021-07-18 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jul 18 23:57:34 UTC 2021

Modified Files:
src/sys/fs/ptyfs: ptyfs_vnops.c

Log Message:
Fix ptyfs link and symlink ops.

They were set (via macro obfuscation just eliminated) to
genfs_abortop, which is the wrong thing. These code paths are
currently inaccessible because of EROFS enforcement in namei, but if
either were reached odd behavior would likely ensue. Use
genfs_eopnotsupp like the rest of the ops that don't make sense here.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/fs/ptyfs/ptyfs_vnops.c

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

Modified files:

Index: src/sys/fs/ptyfs/ptyfs_vnops.c
diff -u src/sys/fs/ptyfs/ptyfs_vnops.c:1.65 src/sys/fs/ptyfs/ptyfs_vnops.c:1.66
--- src/sys/fs/ptyfs/ptyfs_vnops.c:1.65	Sun Jul 18 23:57:14 2021
+++ src/sys/fs/ptyfs/ptyfs_vnops.c	Sun Jul 18 23:57:34 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptyfs_vnops.c,v 1.65 2021/07/18 23:57:14 dholland Exp $	*/
+/*	$NetBSD: ptyfs_vnops.c,v 1.66 2021/07/18 23:57:34 dholland Exp $	*/
 
 /*
  * Copyright (c) 1993, 1995
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ptyfs_vnops.c,v 1.65 2021/07/18 23:57:14 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ptyfs_vnops.c,v 1.66 2021/07/18 23:57:34 dholland Exp $");
 
 #include 
 #include 
@@ -167,11 +167,11 @@ const struct vnodeopv_entry_desc ptyfs_v
 	{ _fsync_desc, genfs_nullop },		/* fsync */
 	{ _seek_desc, genfs_nullop },		/* seek */
 	{ _remove_desc, genfs_eopnotsupp },		/* remove */
-	{ _link_desc, genfs_abortop },		/* link */
+	{ _link_desc, genfs_eopnotsupp },		/* link */
 	{ _rename_desc, genfs_eopnotsupp },		/* rename */
 	{ _mkdir_desc, genfs_eopnotsupp },		/* mkdir */
 	{ _rmdir_desc, genfs_eopnotsupp },		/* rmdir */
-	{ _symlink_desc, genfs_abortop },		/* symlink */
+	{ _symlink_desc, genfs_eopnotsupp },	/* symlink */
 	{ _readdir_desc, ptyfs_readdir },		/* readdir */
 	{ _readlink_desc, genfs_eopnotsupp },	/* readlink */
 	{ _abortop_desc, genfs_abortop },		/* abortop */



CVS commit: src

2021-07-18 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jul 18 23:57:16 UTC 2021

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c
src/sys/fs/adosfs: advnops.c
src/sys/fs/cd9660: cd9660_node.h
src/sys/fs/filecorefs: filecore_node.h filecore_vnops.c
src/sys/fs/msdosfs: denode.h msdosfs_vnops.c
src/sys/fs/ptyfs: ptyfs_vnops.c
src/sys/fs/tmpfs: tmpfs_fifoops.h tmpfs_specops.h tmpfs_vnops.c
tmpfs_vnops.h
src/sys/miscfs/deadfs: dead_vnops.c
src/sys/miscfs/procfs: procfs_vnops.c
src/sys/miscfs/specfs: spec_vnops.c specdev.h
src/sys/nfs: nfs_vnops.c nfsnode.h
src/sys/ufs/ext2fs: ext2fs_vnops.c
src/sys/ufs/ffs: ffs_vnops.c
src/sys/ufs/lfs: lfs_vnops.c ulfs_extern.h
src/sys/ufs/mfs: mfs_extern.h mfs_vnops.c mfsnode.h
src/sys/ufs/ufs: ufs_extern.h

Log Message:
Abolish all the silly indirection macros for initializing vnode ops tables.

These are things of the form #define foofs_op genfs_op, or #define
foofs_op genfs_eopnotsupp, or similar. They serve no purpose besides
obfuscation, and have gotten cutpasted all over everywhere.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
cvs rdiff -u -r1.56 -r1.57 src/sys/fs/adosfs/advnops.c
cvs rdiff -u -r1.16 -r1.17 src/sys/fs/cd9660/cd9660_node.h
cvs rdiff -u -r1.6 -r1.7 src/sys/fs/filecorefs/filecore_node.h
cvs rdiff -u -r1.48 -r1.49 src/sys/fs/filecorefs/filecore_vnops.c
cvs rdiff -u -r1.25 -r1.26 src/sys/fs/msdosfs/denode.h
cvs rdiff -u -r1.105 -r1.106 src/sys/fs/msdosfs/msdosfs_vnops.c
cvs rdiff -u -r1.64 -r1.65 src/sys/fs/ptyfs/ptyfs_vnops.c
cvs rdiff -u -r1.8 -r1.9 src/sys/fs/tmpfs/tmpfs_fifoops.h \
src/sys/fs/tmpfs/tmpfs_specops.h
cvs rdiff -u -r1.146 -r1.147 src/sys/fs/tmpfs/tmpfs_vnops.c
cvs rdiff -u -r1.13 -r1.14 src/sys/fs/tmpfs/tmpfs_vnops.h
cvs rdiff -u -r1.64 -r1.65 src/sys/miscfs/deadfs/dead_vnops.c
cvs rdiff -u -r1.217 -r1.218 src/sys/miscfs/procfs/procfs_vnops.c
cvs rdiff -u -r1.182 -r1.183 src/sys/miscfs/specfs/spec_vnops.c
cvs rdiff -u -r1.45 -r1.46 src/sys/miscfs/specfs/specdev.h
cvs rdiff -u -r1.319 -r1.320 src/sys/nfs/nfs_vnops.c
cvs rdiff -u -r1.74 -r1.75 src/sys/nfs/nfsnode.h
cvs rdiff -u -r1.134 -r1.135 src/sys/ufs/ext2fs/ext2fs_vnops.c
cvs rdiff -u -r1.136 -r1.137 src/sys/ufs/ffs/ffs_vnops.c
cvs rdiff -u -r1.338 -r1.339 src/sys/ufs/lfs/lfs_vnops.c
cvs rdiff -u -r1.25 -r1.26 src/sys/ufs/lfs/ulfs_extern.h
cvs rdiff -u -r1.31 -r1.32 src/sys/ufs/mfs/mfs_extern.h
cvs rdiff -u -r1.62 -r1.63 src/sys/ufs/mfs/mfs_vnops.c
cvs rdiff -u -r1.21 -r1.22 src/sys/ufs/mfs/mfsnode.h
cvs rdiff -u -r1.86 -r1.87 src/sys/ufs/ufs/ufs_extern.h

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.73 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.74
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.73	Sun Jul 18 23:56:12 2021
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Sun Jul 18 23:57:13 2021
@@ -6337,13 +6337,6 @@ const struct genfs_ops zfs_genfsops = {
 	.gop_putrange = zfs_netbsd_gop_putrange,
 };
 
-#define	zfs_netbsd_lock		genfs_lock
-#define	zfs_netbsd_unlock	genfs_unlock
-#define	zfs_netbsd_islocked	genfs_islocked
-#define zfs_netbsd_seek		genfs_seek
-#define zfs_netbsd_mmap		genfs_mmap
-#define zfs_netbsd_fcntl	genfs_fcntl
-
 int (**zfs_vnodeop_p)(void *);
 const struct vnodeopv_entry_desc zfs_vnodeop_entries[] = {
 	{ _default_desc,		vn_default_error },
@@ -6366,8 +6359,8 @@ const struct vnodeopv_entry_desc zfs_vno
 	{ _fsync_desc,		zfs_netbsd_fsync },
 	{ _remove_desc,		zfs_netbsd_remove },
 	{ _link_desc,		zfs_netbsd_link },
-	{ _lock_desc,		zfs_netbsd_lock },
-	{ _unlock_desc,		zfs_netbsd_unlock },
+	{ _lock_desc,		genfs_lock },
+	{ _unlock_desc,		genfs_unlock },
 	{ _rename_desc,		zfs_netbsd_rename },
 	{ _mkdir_desc,		zfs_netbsd_mkdir },
 	{ _rmdir_desc,		zfs_netbsd_rmdir },
@@ -6377,14 +6370,14 @@ const struct vnodeopv_entry_desc zfs_vno
 	{ _inactive_desc,		zfs_netbsd_inactive },
 	{ _reclaim_desc,		zfs_netbsd_reclaim },
 	{ _pathconf_desc,		zfs_netbsd_pathconf },
-	{ _seek_desc,		zfs_netbsd_seek },
+	{ _seek_desc,		genfs_seek },
 	{ _getpages_desc,		zfs_netbsd_getpages },
 	{ _putpages_desc,		zfs_netbsd_putpages },
-	{ _mmap_desc,		zfs_netbsd_mmap },
-	{ _islocked_desc,		zfs_netbsd_islocked },
+	{ _mmap_desc,		genfs_mmap },
+	{ _islocked_desc,		genfs_islocked },
 	{ _advlock_desc,		zfs_netbsd_advlock },
 	{ _print_desc,		zfs_netbsd_print },
-	{ _fcntl_desc,		zfs_netbsd_fcntl },
+	{ _fcntl_desc,		genfs_fcntl },
 	{ NULL, NULL }
 };
 
@@ -6403,14 +6396,14 @@ const struct vnodeopv_entry_desc zfs_spe
 	{ _read_desc,		/**/zfs_netbsd_read },
 	{ 

CVS commit: src

2021-07-18 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jul 18 23:56:14 UTC 2021

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c
src/sys/fs/cd9660: cd9660_vnops.c
src/sys/fs/efs: efs_vnops.c
src/sys/fs/hfs: hfs_vnops.c
src/sys/fs/puffs: puffs_vnops.c
src/sys/fs/tmpfs: tmpfs_fifoops.c tmpfs_specops.c
src/sys/fs/v7fs: v7fs_extern.c
src/sys/miscfs/fifofs: fifo.h
src/sys/miscfs/kernfs: kernfs_vnops.c
src/sys/miscfs/specfs: specdev.h
src/sys/nfs: nfs_vnops.c
src/sys/rump/librump/rumpvfs: rumpfs.c
src/sys/ufs/chfs: chfs_vnops.c
src/sys/ufs/ext2fs: ext2fs_vnops.c
src/sys/ufs/ffs: ffs_vnops.c
src/sys/ufs/lfs: lfs_vnops.c

Log Message:
Use macros for the canned parts of device and fifo vnode op tables.

Add GENFS_SPECOP_ENTRIES and GENFS_FIFOOP_ENTRIES macros that contain
the portion of the vnode ops table declaration that is
(conservatively) the same in every fs. Use these in every fs that
supports devices and/or fifos with separate ops tables.

Note that ptyfs works differently (it has one type of vnode with
open-coded dispatch to the specfs code, which I haven't changed in
this commit) and rump/librump/rumpvfs/rumpfs.c has an indirect dynamic
dispatch that already does more or less the same thing, which I also
haven't changed.

Also note that this anticipates a few bits in the next changeset here
and there, and adds missing but unreachable calls in some cases (e.g.
most fses weren't defining whiteout on devices and fifos, but it isn't
reachable there), and it changes parsepath on devices and fifos to
genfs_badop from genfs_parsepath (but it's not reachable there
either).

It appears that devices in kernfs were missing kqfilter, so it's
possible that if you try to use kqueue on /kern/rootdev that it'll
explode.

And finally note that the ops declaration tables aren't
order-dependent. (Other than vop_default_desc has to come first.)
Otherwise this wouldn't work.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
cvs rdiff -u -r1.59 -r1.60 src/sys/fs/cd9660/cd9660_vnops.c
cvs rdiff -u -r1.42 -r1.43 src/sys/fs/efs/efs_vnops.c
cvs rdiff -u -r1.38 -r1.39 src/sys/fs/hfs/hfs_vnops.c
cvs rdiff -u -r1.219 -r1.220 src/sys/fs/puffs/puffs_vnops.c
cvs rdiff -u -r1.13 -r1.14 src/sys/fs/tmpfs/tmpfs_fifoops.c
cvs rdiff -u -r1.14 -r1.15 src/sys/fs/tmpfs/tmpfs_specops.c
cvs rdiff -u -r1.8 -r1.9 src/sys/fs/v7fs/v7fs_extern.c
cvs rdiff -u -r1.26 -r1.27 src/sys/miscfs/fifofs/fifo.h
cvs rdiff -u -r1.170 -r1.171 src/sys/miscfs/kernfs/kernfs_vnops.c
cvs rdiff -u -r1.44 -r1.45 src/sys/miscfs/specfs/specdev.h
cvs rdiff -u -r1.318 -r1.319 src/sys/nfs/nfs_vnops.c
cvs rdiff -u -r1.164 -r1.165 src/sys/rump/librump/rumpvfs/rumpfs.c
cvs rdiff -u -r1.44 -r1.45 src/sys/ufs/chfs/chfs_vnops.c
cvs rdiff -u -r1.133 -r1.134 src/sys/ufs/ext2fs/ext2fs_vnops.c
cvs rdiff -u -r1.135 -r1.136 src/sys/ufs/ffs/ffs_vnops.c
cvs rdiff -u -r1.337 -r1.338 src/sys/ufs/lfs/lfs_vnops.c

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.72 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.73
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.72	Fri Jul  2 17:14:36 2021
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Sun Jul 18 23:56:12 2021
@@ -6394,10 +6394,7 @@ const struct vnodeopv_desc zfs_vnodeop_o
 int (**zfs_specop_p)(void *);
 const struct vnodeopv_entry_desc zfs_specop_entries[] = {
 	{ _default_desc,		vn_default_error },
-	{ _lookup_desc,		spec_lookup },
-	{ _create_desc,		spec_create },
-	{ _mknod_desc,		spec_mknod },
-	{ _open_desc,		spec_open },
+	GENFS_SPECOP_ENTRIES,
 	{ _close_desc,		spec_close },
 	{ _access_desc,		zfs_netbsd_access },
 	{ _accessx_desc,		genfs_accessx },
@@ -6405,31 +6402,12 @@ const struct vnodeopv_entry_desc zfs_spe
 	{ _setattr_desc,		zfs_netbsd_setattr },
 	{ _read_desc,		/**/zfs_netbsd_read },
 	{ _write_desc,		/**/zfs_netbsd_write },
-	{ _ioctl_desc,		spec_ioctl },
-	{ _poll_desc,		spec_poll },
-	{ _kqfilter_desc,		spec_kqfilter },
-	{ _revoke_desc,		spec_revoke },
 	{ _fsync_desc,		zfs_spec_fsync },
-	{ _remove_desc,		spec_remove },
-	{ _link_desc,		spec_link },
 	{ _lock_desc,		zfs_netbsd_lock },
 	{ _unlock_desc,		zfs_netbsd_unlock },
-	{ _rename_desc,		spec_rename },
-	{ _mkdir_desc,		spec_mkdir },
-	{ _rmdir_desc,		spec_rmdir },
-	{ _symlink_desc,		spec_symlink },
-	{ _readdir_desc,		spec_readdir },
-	{ _readlink_desc,		spec_readlink },
 	{ _inactive_desc,		zfs_netbsd_inactive },
 	{ _reclaim_desc,		zfs_netbsd_reclaim },
-	{ _pathconf_desc,		spec_pathconf },
-	{ _seek_desc,		spec_seek },
-	{ _getpages_desc,		spec_getpages },
-	{ 

CVS commit: src/sys/kern

2021-07-18 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jul 18 09:30:36 UTC 2021

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

Log Message:
Fix confusion arising from whether FOLLOW or NOFOLLOW is 0.

In vn_open, don't set and then throw away FOLLOW, and clarify the
comment about requesting FOLLOW/NOFOLLOW behavior.

Related to PR 56316.


To generate a diff of this commit:
cvs rdiff -u -r1.220 -r1.221 src/sys/kern/vfs_vnops.c

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

Modified files:

Index: src/sys/kern/vfs_vnops.c
diff -u src/sys/kern/vfs_vnops.c:1.220 src/sys/kern/vfs_vnops.c:1.221
--- src/sys/kern/vfs_vnops.c:1.220	Thu Jul  1 15:53:20 2021
+++ src/sys/kern/vfs_vnops.c	Sun Jul 18 09:30:36 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnops.c,v 1.220 2021/07/01 15:53:20 martin Exp $	*/
+/*	$NetBSD: vfs_vnops.c,v 1.221 2021/07/18 09:30:36 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.220 2021/07/01 15:53:20 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.221 2021/07/18 09:30:36 dholland Exp $");
 
 #include "veriexec.h"
 
@@ -155,8 +155,9 @@ const struct fileops vnops = {
  * EOPNOTSUPP will be produced in the cases that would otherwise return
  * a file descriptor.
  *
- * Note that callers that want NOFOLLOW should pass O_NOFOLLOW in fmode,
- * not NOFOLLOW in nmode.
+ * Note that callers that want no-follow behavior should pass
+ * O_NOFOLLOW in fmode. Neither FOLLOW nor NOFOLLOW in nmode is
+ * honored.
  */
 int
 vn_open(struct vnode *at_dvp, struct pathbuf *pb,
@@ -179,7 +180,7 @@ vn_open(struct vnode *at_dvp, struct pat
 	if ((fmode & (O_CREAT | O_DIRECTORY)) == (O_CREAT | O_DIRECTORY))
 		return EINVAL;
 
-	NDINIT(, LOOKUP, FOLLOW | nmode, pb);
+	NDINIT(, LOOKUP, nmode, pb);
 	if (at_dvp != NULL)
 		NDAT(, at_dvp);
 



CVS commit: src/tests/usr.sbin/execsnoop

2021-07-18 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jul 18 06:24:58 UTC 2021

Modified Files:
src/tests/usr.sbin/execsnoop: t_execsnoop.sh

Log Message:
Mark t_execsnoop xfail (PR 53417)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.sbin/execsnoop/t_execsnoop.sh

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

Modified files:

Index: src/tests/usr.sbin/execsnoop/t_execsnoop.sh
diff -u src/tests/usr.sbin/execsnoop/t_execsnoop.sh:1.3 src/tests/usr.sbin/execsnoop/t_execsnoop.sh:1.4
--- src/tests/usr.sbin/execsnoop/t_execsnoop.sh:1.3	Sat Jul 11 09:55:26 2020
+++ src/tests/usr.sbin/execsnoop/t_execsnoop.sh	Sun Jul 18 06:24:58 2021
@@ -1,4 +1,4 @@
-# $NetBSD: t_execsnoop.sh,v 1.3 2020/07/11 09:55:26 jruoho Exp $
+# $NetBSD: t_execsnoop.sh,v 1.4 2021/07/18 06:24:58 dholland Exp $
 #
 # Copyright (c) 2020 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -37,6 +37,7 @@ basic_head() {
 }
 
 basic_body() {
+	atf_expect_fail "PR kern/53417"
 
 	n=10
 	atf_check -s exit:0 -o ignore -e empty -x "execsnoop > $tmp &"



CVS commit: src/games/fortune/datfiles

2021-07-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jul 11 00:35:05 UTC 2021

Modified Files:
src/games/fortune/datfiles: fortunes

Log Message:
add something


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/games/fortune/datfiles/fortunes

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

Modified files:

Index: src/games/fortune/datfiles/fortunes
diff -u src/games/fortune/datfiles/fortunes:1.96 src/games/fortune/datfiles/fortunes:1.97
--- src/games/fortune/datfiles/fortunes:1.96	Mon Nov  9 03:23:14 2020
+++ src/games/fortune/datfiles/fortunes	Sun Jul 11 00:35:05 2021
@@ -16307,3 +16307,5 @@ The purpose of computing numbers is not 
 %
 Iamonthemoonandthereisnowheretogetabeer.
 Thereisnospacebar.
+%
+metropole, n.: The axis on which the subway turns.



CVS commit: src/sys/miscfs/kernfs

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

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.169 -r1.170 src/sys/miscfs/kernfs/kernfs_vnops.c

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

Modified files:

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



CVS commit: src/sys/miscfs/kernfs

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

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

Log Message:
Add missing VOP_KQFILTER to kernfs.

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


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/sys/miscfs/kernfs/kernfs_vnops.c

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

Modified files:

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



CVS commit: src/sys/ufs/chfs

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

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

Log Message:
whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/ufs/chfs/chfs_vnops.c

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

Modified files:

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



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2021-07-02 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Fri Jul  2 17:14:37 UTC 2021

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c

Log Message:
Add VOP_PARSEPATH to zfs's vnode table. "oops"

zfs not being under src/sys strikes again :-(


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.71 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.72
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.71	Sun Nov 15 00:54:13 2020
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Fri Jul  2 17:14:36 2021
@@ -6347,6 +6347,7 @@ const struct genfs_ops zfs_genfsops = {
 int (**zfs_vnodeop_p)(void *);
 const struct vnodeopv_entry_desc zfs_vnodeop_entries[] = {
 	{ _default_desc,		vn_default_error },
+	{ _parsepath_desc,		genfs_parsepath },
 	{ _lookup_desc,		zfs_netbsd_lookup },
 	{ _create_desc,		zfs_netbsd_create },
 	{ _mknod_desc,		zfs_netbsd_mknod },



CVS commit: src/sys

2021-07-02 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Fri Jul  2 16:57:16 UTC 2021

Modified Files:
src/sys/kern: vnode_if.c
src/sys/rump/include/rump: rumpvnode_if.h
src/sys/rump/librump/rumpvfs: rumpvnode_if.c
src/sys/sys: vnode_if.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/kern/vnode_if.c
cvs rdiff -u -r1.35 -r1.36 src/sys/rump/include/rump/rumpvnode_if.h
cvs rdiff -u -r1.35 -r1.36 src/sys/rump/librump/rumpvfs/rumpvnode_if.c
cvs rdiff -u -r1.106 -r1.107 src/sys/sys/vnode_if.h

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

Modified files:

Index: src/sys/kern/vnode_if.c
diff -u src/sys/kern/vnode_if.c:1.113 src/sys/kern/vnode_if.c:1.114
--- src/sys/kern/vnode_if.c:1.113	Tue Jun 29 22:37:11 2021
+++ src/sys/kern/vnode_if.c	Fri Jul  2 16:57:15 2021
@@ -1,11 +1,11 @@
-/*	$NetBSD: vnode_if.c,v 1.113 2021/06/29 22:37:11 dholland Exp $	*/
+/*	$NetBSD: vnode_if.c,v 1.114 2021/07/02 16:57:15 dholland Exp $	*/
 
 /*
  * Warning: DO NOT EDIT! This file is automatically generated!
  * (Modifications made here may easily be lost!)
  *
  * Created from the file:
- *	NetBSD: vnode_if.src,v 1.81 2021/06/29 22:34:08 dholland Exp
+ *	NetBSD: vnode_if.src,v 1.82 2021/07/02 16:56:22 dholland Exp
  * by the script:
  *	NetBSD: vnode_if.sh,v 1.70 2020/05/16 18:31:50 christos Exp
  */
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.113 2021/06/29 22:37:11 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.114 2021/07/02 16:57:15 dholland Exp $");
 
 #include 
 #include 
@@ -171,11 +171,11 @@ VOP_PARSEPATH(struct vnode *dvp,
 	a.a_dvp = dvp;
 	a.a_name = name;
 	a.a_retval = retval;
-	error = vop_pre(dvp, , , FST_YES);
+	error = vop_pre(dvp, , , FST_NO);
 	if (error)
 		return error;
 	error = (VCALL(dvp, VOFFSET(vop_parsepath), ));
-	vop_post(dvp, mp, mpsafe, FST_YES);
+	vop_post(dvp, mp, mpsafe, FST_NO);
 	return error;
 }
 

Index: src/sys/rump/include/rump/rumpvnode_if.h
diff -u src/sys/rump/include/rump/rumpvnode_if.h:1.35 src/sys/rump/include/rump/rumpvnode_if.h:1.36
--- src/sys/rump/include/rump/rumpvnode_if.h:1.35	Tue Jun 29 22:37:11 2021
+++ src/sys/rump/include/rump/rumpvnode_if.h	Fri Jul  2 16:57:15 2021
@@ -1,11 +1,11 @@
-/*	$NetBSD: rumpvnode_if.h,v 1.35 2021/06/29 22:37:11 dholland Exp $	*/
+/*	$NetBSD: rumpvnode_if.h,v 1.36 2021/07/02 16:57:15 dholland Exp $	*/
 
 /*
  * Warning: DO NOT EDIT! This file is automatically generated!
  * (Modifications made here may easily be lost!)
  *
  * Created from the file:
- *	NetBSD: vnode_if.src,v 1.81 2021/06/29 22:34:08 dholland Exp
+ *	NetBSD: vnode_if.src,v 1.82 2021/07/02 16:56:22 dholland Exp
  * by the script:
  *	NetBSD: vnode_if.sh,v 1.70 2020/05/16 18:31:50 christos Exp
  */

Index: src/sys/rump/librump/rumpvfs/rumpvnode_if.c
diff -u src/sys/rump/librump/rumpvfs/rumpvnode_if.c:1.35 src/sys/rump/librump/rumpvfs/rumpvnode_if.c:1.36
--- src/sys/rump/librump/rumpvfs/rumpvnode_if.c:1.35	Tue Jun 29 22:37:11 2021
+++ src/sys/rump/librump/rumpvfs/rumpvnode_if.c	Fri Jul  2 16:57:16 2021
@@ -1,11 +1,11 @@
-/*	$NetBSD: rumpvnode_if.c,v 1.35 2021/06/29 22:37:11 dholland Exp $	*/
+/*	$NetBSD: rumpvnode_if.c,v 1.36 2021/07/02 16:57:16 dholland Exp $	*/
 
 /*
  * Warning: DO NOT EDIT! This file is automatically generated!
  * (Modifications made here may easily be lost!)
  *
  * Created from the file:
- *	NetBSD: vnode_if.src,v 1.81 2021/06/29 22:34:08 dholland Exp
+ *	NetBSD: vnode_if.src,v 1.82 2021/07/02 16:56:22 dholland Exp
  * by the script:
  *	NetBSD: vnode_if.sh,v 1.70 2020/05/16 18:31:50 christos Exp
  */
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpvnode_if.c,v 1.35 2021/06/29 22:37:11 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpvnode_if.c,v 1.36 2021/07/02 16:57:16 dholland Exp $");
 
 #include 
 #include 

Index: src/sys/sys/vnode_if.h
diff -u src/sys/sys/vnode_if.h:1.106 src/sys/sys/vnode_if.h:1.107
--- src/sys/sys/vnode_if.h:1.106	Tue Jun 29 22:37:11 2021
+++ src/sys/sys/vnode_if.h	Fri Jul  2 16:57:15 2021
@@ -1,11 +1,11 @@
-/*	$NetBSD: vnode_if.h,v 1.106 2021/06/29 22:37:11 dholland Exp $	*/
+/*	$NetBSD: vnode_if.h,v 1.107 2021/07/02 16:57:15 dholland Exp $	*/
 
 /*
  * Warning: DO NOT EDIT! This file is automatically generated!
  * (Modifications made here may easily be lost!)
  *
  * Created from the file:
- *	NetBSD: vnode_if.src,v 1.81 2021/06/29 22:34:08 dholland Exp
+ *	NetBSD: vnode_if.src,v 1.82 2021/07/02 16:56:22 dholland Exp
  * by the script:
  *	NetBSD: vnode_if.sh,v 1.70 2020/05/16 18:31:50 christos Exp
  */



CVS commit: src/sys/kern

2021-07-02 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Fri Jul  2 16:56:22 UTC 2021

Modified Files:
src/sys/kern: vnode_if.src

Log Message:
Turn off fstrans for VOP_PARSEPATH. Fixes t_umountstress deadlock.

Diagnosis by hannken@.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/kern/vnode_if.src

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

Modified files:

Index: src/sys/kern/vnode_if.src
diff -u src/sys/kern/vnode_if.src:1.81 src/sys/kern/vnode_if.src:1.82
--- src/sys/kern/vnode_if.src:1.81	Tue Jun 29 22:34:08 2021
+++ src/sys/kern/vnode_if.src	Fri Jul  2 16:56:22 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: vnode_if.src,v 1.81 2021/06/29 22:34:08 dholland Exp $
+#	$NetBSD: vnode_if.src,v 1.82 2021/07/02 16:56:22 dholland Exp $
 #
 # Copyright (c) 1992, 1993
 #	The Regents of the University of California.  All rights reserved.
@@ -60,9 +60,10 @@ vop_bwrite {
 };
 
 #
-#% parsepath  dvp L L L
+#% parsepath  dvp = = =
 #
 vop_parsepath {
+	FSTRANS=NO
 	IN struct vnode *dvp;
 	IN const char *name;
 	OUT size_t *retval;



CVS commit: src/sys/kern

2021-06-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Jun 30 17:51:49 UTC 2021

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

Log Message:
Improve Christos's vn_open fix.

- assert about api misuse up front (suggested by riastradh)
- restore the behavior of returning EOPNOTSUPP if ret_fd is NULL and we
  get a fd back (otherwise things like ktruss -o /dev/stderr panic)
- clear error to 0 for the EDUPFD and EMOVEFD cases so opening a
  cloner succeeds


To generate a diff of this commit:
cvs rdiff -u -r1.217 -r1.218 src/sys/kern/vfs_vnops.c

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

Modified files:

Index: src/sys/kern/vfs_vnops.c
diff -u src/sys/kern/vfs_vnops.c:1.217 src/sys/kern/vfs_vnops.c:1.218
--- src/sys/kern/vfs_vnops.c:1.217	Wed Jun 30 11:20:32 2021
+++ src/sys/kern/vfs_vnops.c	Wed Jun 30 17:51:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnops.c,v 1.217 2021/06/30 11:20:32 christos Exp $	*/
+/*	$NetBSD: vfs_vnops.c,v 1.218 2021/06/30 17:51:49 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.217 2021/06/30 11:20:32 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.218 2021/06/30 17:51:49 dholland Exp $");
 
 #include "veriexec.h"
 
@@ -173,6 +173,9 @@ vn_open(struct vnode *at_dvp, struct pat
 
 	KASSERT((nmode & (TRYEMULROOT | NOCHROOT)) == nmode);
 
+	KASSERT(ret_vp != NULL);
+	KASSERT((ret_domove == NULL) == (ret_fd == NULL));
+
 	if ((fmode & (O_CREAT | O_DIRECTORY)) == (O_CREAT | O_DIRECTORY))
 		return EINVAL;
 
@@ -332,9 +335,11 @@ out:
 	case EDUPFD:
 	case EMOVEFD:
 		/* if the caller isn't prepared to handle fds, fail for them */
-		KASSERTMSG(ret_domove && ret_fd,
-		"caller did not supply ret_domove and ret_fd for %d",
-		error);
+		if (ret_fd == NULL) {
+			error = EOPNOTSUPP;
+			break;
+		}
+		error = 0;
 		*ret_vp = NULL;
 		*ret_domove = error == EMOVEFD;
 		*ret_fd = l->l_dupfd;



CVS commit: src

2021-06-29 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Jun 29 22:40:54 UTC 2021

Modified Files:
src/external/cddl/osnet/sys/sys: vnode.h
src/share/man/man9: errno.9 vnsubr.9
src/sys/dev: firmload.c fss.c kloader.c vnd.c
src/sys/kern: kern_acct.c kern_core.c kern_descrip.c kern_ktrace_vfs.c
kern_module_vfs.c subr_exec_fd.c subr_kobj_vfs.c tty_ptm.c
vfs_syscalls.c vfs_vnops.c
src/sys/miscfs/fdesc: fdesc_vnops.c
src/sys/modules/lua: lua.c
src/sys/sys: filedesc.h vnode.h
src/sys/ufs/lfs: ulfs_extattr.c ulfs_quota1.c
src/sys/ufs/ufs: ufs_extattr.c ufs_quota1.c

Log Message:
Add containment for the cloning devices hack in vn_open.

Cloning devices (and also things like /dev/stderr) work by allocating
a struct file, stuffing it in the file table (which is a layer
violation), stuffing the file descriptor number for it in a magic
field of struct lwp (which is gross), and then "failing" with one of
two magic errnos, EDUPFD or EMOVEFD.

Before this commit, all callers of vn_open in the kernel (there are
quite a few) were expected to check for these errors and handle the
situation. Needless to say, none of them except for open() itself did,
resulting in internal negative errnos being returned to userspace.

This hack is fairly deeply rooted and cannot be eliminated all at
once. This commit adds logic to handle the magic errnos inside
vn_open; now on success vn_open returns either a vnode or an integer
file descriptor, along with a flag that says whether the underlying
code requested EDUPFD or EMOVEFD. Callers not prepared to cope with
file descriptors can pass NULL for the extra return values, in which
case if a file descriptor would be produced vn_open fails with
EOPNOTSUPP.

Since I'm rearranging vn_open's signature anyway, stop exposing struct
nameidata. Instead, take three arguments: an optional vnode to use as
the starting point (like openat()), the path, and additional namei
flags to use, restricted to NOCHROOT and TRYEMULROOT. (Other namei
behavior, e.g. NOFOLLOW, can be requested via the open flags.)

This change requires a kernel bump. Ride the one an hour ago.
(That was supposed to be coordinated; did not intend to let an hour
slip by. My fault.)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/external/cddl/osnet/sys/sys/vnode.h
cvs rdiff -u -r1.5 -r1.6 src/share/man/man9/errno.9
cvs rdiff -u -r1.47 -r1.48 src/share/man/man9/vnsubr.9
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/firmload.c
cvs rdiff -u -r1.110 -r1.111 src/sys/dev/fss.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/kloader.c
cvs rdiff -u -r1.281 -r1.282 src/sys/dev/vnd.c
cvs rdiff -u -r1.97 -r1.98 src/sys/kern/kern_acct.c
cvs rdiff -u -r1.34 -r1.35 src/sys/kern/kern_core.c
cvs rdiff -u -r1.250 -r1.251 src/sys/kern/kern_descrip.c
cvs rdiff -u -r1.2 -r1.3 src/sys/kern/kern_ktrace_vfs.c
cvs rdiff -u -r1.17 -r1.18 src/sys/kern/kern_module_vfs.c
cvs rdiff -u -r1.11 -r1.12 src/sys/kern/subr_exec_fd.c \
src/sys/kern/subr_kobj_vfs.c
cvs rdiff -u -r1.42 -r1.43 src/sys/kern/tty_ptm.c
cvs rdiff -u -r1.549 -r1.550 src/sys/kern/vfs_syscalls.c
cvs rdiff -u -r1.215 -r1.216 src/sys/kern/vfs_vnops.c
cvs rdiff -u -r1.137 -r1.138 src/sys/miscfs/fdesc/fdesc_vnops.c
cvs rdiff -u -r1.24 -r1.25 src/sys/modules/lua/lua.c
cvs rdiff -u -r1.68 -r1.69 src/sys/sys/filedesc.h
cvs rdiff -u -r1.296 -r1.297 src/sys/sys/vnode.h
cvs rdiff -u -r1.16 -r1.17 src/sys/ufs/lfs/ulfs_extattr.c
cvs rdiff -u -r1.11 -r1.12 src/sys/ufs/lfs/ulfs_quota1.c
cvs rdiff -u -r1.52 -r1.53 src/sys/ufs/ufs/ufs_extattr.c
cvs rdiff -u -r1.23 -r1.24 src/sys/ufs/ufs/ufs_quota1.c

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

Modified files:

Index: src/external/cddl/osnet/sys/sys/vnode.h
diff -u src/external/cddl/osnet/sys/sys/vnode.h:1.18 src/external/cddl/osnet/sys/sys/vnode.h:1.19
--- src/external/cddl/osnet/sys/sys/vnode.h:1.18	Thu Apr 15 06:59:57 2021
+++ src/external/cddl/osnet/sys/sys/vnode.h	Tue Jun 29 22:40:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnode.h,v 1.18 2021/04/15 06:59:57 christos Exp $	*/
+/*	$NetBSD: vnode.h,v 1.19 2021/06/29 22:40:53 dholland Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -239,7 +239,6 @@ zfs_vn_open(const char *pnamep, enum uio
 vnode_t **vpp, enum create crwhy, mode_t umask)
 {
 	struct pathbuf *pb;
-	struct nameidata nd;
 	int error;
 
 	ASSERT(seg == UIO_SYSSPACE);
@@ -247,12 +246,12 @@ zfs_vn_open(const char *pnamep, enum uio
 	ASSERT(crwhy == CRCREAT);
 	ASSERT(umask == 0);
 
+	filemode |= O_NOFOLLOW;
+
 	pb = pathbuf_create(pnamep);
-	NDINIT(, LOOKUP, NOFOLLOW, pb);
-	error = vn_open(, filemode, createmode);
+	error = vn_open(NULL, pb, 0, filemode, createmode, vpp, NULL, NULL);
 	if (error == 0) {
-		VOP_UNLOCK(nd.ni_vp, 0);
-		*vpp = nd.ni_vp;
+		VOP_UNLOCK(*vpp, 0);
 	}
 	pathbuf_destroy(pb);
 	return (error);

Index: src/share/man/man9/errno.9
diff -u src/share/man/man9/errno.9:1.5 

CVS commit: src/sys

2021-06-29 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Jun 29 22:40:06 UTC 2021

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

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/rump/include/rump/rump_namei.h
cvs rdiff -u -r1.114 -r1.115 src/sys/sys/namei.h

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

Modified files:

Index: src/sys/rump/include/rump/rump_namei.h
diff -u src/sys/rump/include/rump/rump_namei.h:1.47 src/sys/rump/include/rump/rump_namei.h:1.48
--- src/sys/rump/include/rump/rump_namei.h:1.47	Wed Jun 16 01:52:39 2021
+++ src/sys/rump/include/rump/rump_namei.h	Tue Jun 29 22:40:06 2021
@@ -1,11 +1,11 @@
-/*	$NetBSD: rump_namei.h,v 1.47 2021/06/16 01:52:39 dholland Exp $	*/
+/*	$NetBSD: rump_namei.h,v 1.48 2021/06/29 22:40:06 dholland Exp $	*/
 
 
 /*
  * WARNING: GENERATED FILE.  DO NOT EDIT
  * (edit namei.src and run make namei in src/sys/sys)
  *   by:   NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp 
- *   from: NetBSD: namei.src,v 1.58 2020/05/30 20:16:14 ad Exp 
+ *   from: NetBSD: namei.src,v 1.60 2021/06/29 22:39:21 dholland Exp 
  */
 
 #ifndef _RUMP_RUMP_NAMEI_H_

Index: src/sys/sys/namei.h
diff -u src/sys/sys/namei.h:1.114 src/sys/sys/namei.h:1.115
--- src/sys/sys/namei.h:1.114	Wed Jun 16 01:52:39 2021
+++ src/sys/sys/namei.h	Tue Jun 29 22:40:06 2021
@@ -1,11 +1,11 @@
-/*	$NetBSD: namei.h,v 1.114 2021/06/16 01:52:39 dholland Exp $	*/
+/*	$NetBSD: namei.h,v 1.115 2021/06/29 22:40:06 dholland Exp $	*/
 
 
 /*
  * WARNING: GENERATED FILE.  DO NOT EDIT
  * (edit namei.src and run make namei in src/sys/sys)
  *   by:   NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp 
- *   from: NetBSD: namei.src,v 1.58 2020/05/30 20:16:14 ad Exp 
+ *   from: NetBSD: namei.src,v 1.60 2021/06/29 22:39:21 dholland Exp 
  */
 
 /*
@@ -102,7 +102,6 @@ struct componentname {
 	 */
 	const char 	*cn_nameptr;	/* pointer to looked up name */
 	size_t		cn_namelen;	/* length of looked up comp */
-	size_t		cn_consume;	/* chars to consume in lookup */
 };
 
 /*



CVS commit: src/sys

2021-06-29 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Jun 29 22:39:21 UTC 2021

Modified Files:
src/sys/fs/puffs: puffs_vnops.c
src/sys/fs/union: union_vnops.c
src/sys/fs/unionfs: unionfs_subr.c
src/sys/kern: vfs_getcwd.c vfs_lookup.c
src/sys/sys: namei.src

Log Message:
Now remove cn_consume from struct componentname.

This change requires a kernel bump.

Note though that I'm not going to version the VOP_LOOKUP args
structure (or any other args structure) as code that doesn't touch
cn_consume doesn't need attention and code that does will fail on it
without further intervention.


To generate a diff of this commit:
cvs rdiff -u -r1.218 -r1.219 src/sys/fs/puffs/puffs_vnops.c
cvs rdiff -u -r1.76 -r1.77 src/sys/fs/union/union_vnops.c
cvs rdiff -u -r1.14 -r1.15 src/sys/fs/unionfs/unionfs_subr.c
cvs rdiff -u -r1.60 -r1.61 src/sys/kern/vfs_getcwd.c
cvs rdiff -u -r1.228 -r1.229 src/sys/kern/vfs_lookup.c
cvs rdiff -u -r1.59 -r1.60 src/sys/sys/namei.src

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

Modified files:

Index: src/sys/fs/puffs/puffs_vnops.c
diff -u src/sys/fs/puffs/puffs_vnops.c:1.218 src/sys/fs/puffs/puffs_vnops.c:1.219
--- src/sys/fs/puffs/puffs_vnops.c:1.218	Tue Jun 29 22:34:07 2021
+++ src/sys/fs/puffs/puffs_vnops.c	Tue Jun 29 22:39:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_vnops.c,v 1.218 2021/06/29 22:34:07 dholland Exp $	*/
+/*	$NetBSD: puffs_vnops.c,v 1.219 2021/06/29 22:39:20 dholland Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.218 2021/06/29 22:34:07 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.219 2021/06/29 22:39:20 dholland Exp $");
 
 #include 
 #include 
@@ -711,9 +711,10 @@ puffs_vnop_lookup(void *v)
 	/* XXX */
 	if ((lookup_msg->pvnr_cn.pkcn_flags & REQUIREDIR) == 0)
 		cnp->cn_flags &= ~REQUIREDIR;
-	if (lookup_msg->pvnr_cn.pkcn_consume)
-		cnp->cn_consume = MIN(lookup_msg->pvnr_cn.pkcn_consume,
-		strlen(cnp->cn_nameptr) - cnp->cn_namelen);
+	if (lookup_msg->pvnr_cn.pkcn_consume) {
+		printf("puffs: warning: ignoring cn_consume of %zu chars\n",
+		lookup_msg->pvnr_cn.pkcn_consume);
+	}
 
 	VPTOPP(vp)->pn_nlookup++;
 

Index: src/sys/fs/union/union_vnops.c
diff -u src/sys/fs/union/union_vnops.c:1.76 src/sys/fs/union/union_vnops.c:1.77
--- src/sys/fs/union/union_vnops.c:1.76	Tue Jun 29 22:38:46 2021
+++ src/sys/fs/union/union_vnops.c	Tue Jun 29 22:39:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: union_vnops.c,v 1.76 2021/06/29 22:38:46 dholland Exp $	*/
+/*	$NetBSD: union_vnops.c,v 1.77 2021/06/29 22:39:20 dholland Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993, 1994, 1995
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.76 2021/06/29 22:38:46 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.77 2021/06/29 22:39:20 dholland Exp $");
 
 #include 
 #include 
@@ -358,12 +358,6 @@ start:
 	if (upperdvp != NULLVP) {
 		uerror = union_lookup1(um->um_uppervp, ,
 	, cnp);
-		if (cnp->cn_consume != 0) {
-			if (uppervp != upperdvp)
-VOP_UNLOCK(uppervp);
-			*ap->a_vpp = uppervp;
-			return (uerror);
-		}
 		if (uerror == ENOENT || uerror == EJUSTRETURN) {
 			if (cnp->cn_flags & ISWHITEOUT) {
 iswhiteout = 1;
@@ -415,18 +409,6 @@ start:
 
 		if (lowervp != lowerdvp)
 			VOP_UNLOCK(lowerdvp);
-
-		if (cnp->cn_consume != 0) {
-			if (uppervp != NULLVP) {
-if (uppervp == upperdvp)
-	vrele(uppervp);
-else
-	vput(uppervp);
-uppervp = NULLVP;
-			}
-			*ap->a_vpp = lowervp;
-			return (lerror);
-		}
 	} else {
 		lerror = ENOENT;
 		if ((cnp->cn_flags & ISDOTDOT) && dun->un_pvp != NULLVP) {

Index: src/sys/fs/unionfs/unionfs_subr.c
diff -u src/sys/fs/unionfs/unionfs_subr.c:1.14 src/sys/fs/unionfs/unionfs_subr.c:1.15
--- src/sys/fs/unionfs/unionfs_subr.c:1.14	Thu Jun  1 02:45:13 2017
+++ src/sys/fs/unionfs/unionfs_subr.c	Tue Jun 29 22:39:20 2021
@@ -317,7 +317,6 @@ unionfs_relookup(struct vnode *dvp, stru
 	cn->cn_cred = cnp->cn_cred;
 
 	cn->cn_nameptr = pnbuf;
-	cn->cn_consume = cnp->cn_consume;
 
 	if (nameiop == DELETE)
 		cn->cn_flags |= (cnp->cn_flags & DOWHITEOUT);
@@ -629,7 +628,6 @@ unionfs_vn_create_on_upper(struct vnode 
 	cn.cn_flags = (LOCKPARENT | LOCKLEAF | ISLASTCN);
 	cn.cn_cred = cred;
 	cn.cn_nameptr = pnbuf;
-	cn.cn_consume = 0;
 
 	vref(udvp);
 	if ((error = relookup(udvp, , , 0)) != 0)
@@ -860,7 +858,6 @@ unionfs_check_rmdir(struct vnode *vp, ka
 			cn.cn_nameiop = LOOKUP;
 			cn.cn_flags = (LOCKPARENT | LOCKLEAF | RDONLY | ISLASTCN);
 			cn.cn_cred = cred;
-			cn.cn_consume = 0;
 
 			/*
 			 * check entry in lower.

Index: src/sys/kern/vfs_getcwd.c
diff -u src/sys/kern/vfs_getcwd.c:1.60 src/sys/kern/vfs_getcwd.c:1.61
--- src/sys/kern/vfs_getcwd.c:1.60	Sat May 16 18:31:50 2020
+++ src/sys/kern/vfs_getcwd.c	Tue Jun 29 22:39:21 2021
@@ -1,4 

CVS commit: src/sys/fs

2021-06-29 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Jun 29 22:38:46 UTC 2021

Modified Files:
src/sys/fs/union: union_vnops.c
src/sys/fs/unionfs: unionfs_vnops.c

Log Message:
Onionfs needs to know about parsepath too, in case it has one of the
other cases underneath it.

The solution here is not really very good (take the longer
path-to-consume if they're different) but it will serve for the cases
that exist.

(If we were to add a fs that really uses different naming semantics,
we'd have to take additional steps; probably it doesn't make sense to
allow unionfs to union such a thing with a normal fs and attempting it
should fail at mount time.)

Update fs/unionfs as well to avoid increasing the current set of
compile failures there. Though maybe it's time to just remove
fs/unionfs.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/fs/union/union_vnops.c
cvs rdiff -u -r1.15 -r1.16 src/sys/fs/unionfs/unionfs_vnops.c

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

Modified files:

Index: src/sys/fs/union/union_vnops.c
diff -u src/sys/fs/union/union_vnops.c:1.75 src/sys/fs/union/union_vnops.c:1.76
--- src/sys/fs/union/union_vnops.c:1.75	Tue Jun 29 22:34:07 2021
+++ src/sys/fs/union/union_vnops.c	Tue Jun 29 22:38:46 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: union_vnops.c,v 1.75 2021/06/29 22:34:07 dholland Exp $	*/
+/*	$NetBSD: union_vnops.c,v 1.76 2021/06/29 22:38:46 dholland Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993, 1994, 1995
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.75 2021/06/29 22:34:07 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.76 2021/06/29 22:38:46 dholland Exp $");
 
 #include 
 #include 
@@ -93,6 +93,7 @@ __KERNEL_RCSID(0, "$NetBSD: union_vnops.
 #include 
 #include 
 
+int union_parsepath(void *);
 int union_lookup(void *);
 int union_create(void *);
 int union_whiteout(void *);
@@ -144,7 +145,7 @@ static int union_lookup1(struct vnode *,
 int (**union_vnodeop_p)(void *);
 const struct vnodeopv_entry_desc union_vnodeop_entries[] = {
 	{ _default_desc, vn_default_error },
-	{ _parsepath_desc, genfs_parsepath },	/* parsepath */
+	{ _parsepath_desc, union_parsepath },	/* parsepath */
 	{ _lookup_desc, union_lookup },		/* lookup */
 	{ _create_desc, union_create },		/* create */
 	{ _whiteout_desc, union_whiteout },		/* whiteout */
@@ -197,6 +198,40 @@ const struct vnodeopv_desc union_vnodeop
 	((vp)->v_type == VBLK || (vp)->v_type == VCHR || \
 	(vp)->v_type == VSOCK || (vp)->v_type == VFIFO)
 
+int
+union_parsepath(void *v)
+{
+	struct vop_parsepath_args /* {
+		struct vnode *a_dvp;
+		const char *a_name;
+		size_t *a_retval;
+	} */ *ap = v;
+	struct vnode *upperdvp, *lowerdvp;
+	size_t upper, lower;
+	int error;
+
+	upperdvp = UPPERVP(ap->a_dvp);
+	lowerdvp = LOWERVP(ap->a_dvp);
+
+	error = VOP_PARSEPATH(upperdvp, ap->a_name, );
+	if (error) {
+		return error;
+	}
+
+	error = VOP_PARSEPATH(lowerdvp, ap->a_name, );
+	if (error) {
+		return error;
+	}
+
+	/*
+	 * If they're different, use the larger one. This is not a
+	 * comprehensive solution, but it's sufficient for the
+	 * non-default cases of parsepath that currently exist.
+	 */
+	*ap->a_retval = MAX(upper, lower);
+	return 0;
+}
+
 static int
 union_lookup1(struct vnode *udvp, struct vnode **dvpp, struct vnode **vpp,
 	struct componentname *cnp)

Index: src/sys/fs/unionfs/unionfs_vnops.c
diff -u src/sys/fs/unionfs/unionfs_vnops.c:1.15 src/sys/fs/unionfs/unionfs_vnops.c:1.16
--- src/sys/fs/unionfs/unionfs_vnops.c:1.15	Tue Jun 29 22:34:08 2021
+++ src/sys/fs/unionfs/unionfs_vnops.c	Tue Jun 29 22:38:46 2021
@@ -65,6 +65,42 @@
 #endif
 
 static int
+unionfs_parsepath(void *v)
+{
+	struct vop_parsepath_args /* {
+		struct vnode *a_dvp;
+		const char *a_name;
+		size_t *a_retval;
+	} */ *ap = v;
+	struct unionfs_node *dunp;
+	struct vnode *upperdvp, *lowerdvp;
+	size_t upper, lower;
+	int error;
+
+	dunp = VTOUNIONFS(ap->a_dvp);
+	upperdvp = dunp->un_uppervp;
+	lowerdvp = dunp->un_lowervp;
+
+	error = VOP_PARSEPATH(upperdvp, ap->a_name, );
+	if (error) {
+		return error;
+	}
+
+	error = VOP_PARSEPATH(lowerdvp, ap->a_name, );
+	if (error) {
+		return error;
+	}
+
+	/*
+	 * If they're different, use the larger one. This is not a
+	 * comprehensive solution, but it's sufficient for the
+	 * non-default cases of parsepath that currently exist.
+	 */
+	*ap->a_retval = MAX(upper, lower);
+	return 0;
+}
+
+static int
 unionfs_lookup(void *v)
 {
 	struct vop_lookup_args *ap = v;
@@ -1814,7 +1850,7 @@ unionfs_revoke(void *v)
 int (**unionfs_vnodeop_p)(void *);
 const struct vnodeopv_entry_desc unionfs_vnodeop_entries[] = {
 	{ _default_desc, vn_default_error },
-	{ _parsepath_desc, genfs_parsepath },	/* parsepath */
+	{ _parsepath_desc, unionfs_parsepath },	/* parsepath */
 	{ _lookup_desc, unionfs_lookup },		/* lookup */
 	{ _create_desc, unionfs_create },		/* create */
 	{ 

CVS commit: src/sys/rump/librump/rumpvfs

2021-06-29 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Jun 29 22:38:10 UTC 2021

Modified Files:
src/sys/rump/librump/rumpvfs: rumpfs.c

Log Message:
Add parsepath for rumpfs in place of using cn_consume.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/rump/librump/rumpvfs/rumpfs.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/rump/librump/rumpvfs/rumpfs.c
diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.163 src/sys/rump/librump/rumpvfs/rumpfs.c:1.164
--- src/sys/rump/librump/rumpvfs/rumpfs.c:1.163	Tue Jun 29 22:34:09 2021
+++ src/sys/rump/librump/rumpvfs/rumpfs.c	Tue Jun 29 22:38:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpfs.c,v 1.163 2021/06/29 22:34:09 dholland Exp $	*/
+/*	$NetBSD: rumpfs.c,v 1.164 2021/06/29 22:38:10 dholland Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.163 2021/06/29 22:34:09 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.164 2021/06/29 22:38:10 dholland Exp $");
 
 #include 
 #include 
@@ -61,6 +61,7 @@ __KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1
 #include 
 #include 
 
+static int rump_vop_parsepath(void *);
 static int rump_vop_lookup(void *);
 static int rump_vop_getattr(void *);
 static int rump_vop_setattr(void *);
@@ -90,7 +91,7 @@ static int rump_vop_fcntl(void *);
 int (**rump_vnodeop_p)(void *);
 const struct vnodeopv_entry_desc rump_vnodeop_entries[] = {
 	{ _default_desc, vn_default_error },
-	{ _parsepath_desc, genfs_parsepath },
+	{ _parsepath_desc, rump_vop_parsepath },
 	{ _lookup_desc, rump_vop_lookup },
 	{ _getattr_desc, rump_vop_getattr },
 	{ _setattr_desc, rump_vop_setattr },
@@ -634,6 +635,33 @@ rumpfs_update(int flags, struct vnode *v
 }
 
 /*
+ * parsepath for rump file systems - check for etfs entries.
+ */
+static int
+rump_vop_parsepath(void *v)
+{
+	struct vop_parsepath_args /* {
+		struct vnode *a_dvp;
+		const char *a_name;
+		size_t *a_retval;
+	}; */ *ap = v;
+	struct etfs *et;
+	bool found;
+
+	/* check for etfs */
+	if (ap->a_dvp == rootvnode) {
+		mutex_enter(_lock);
+		found = etfs_find(ap->a_name, , false);
+		mutex_exit(_lock);
+		if (found) {
+			*ap->a_retval = et->et_keylen;
+			return 0;
+		}
+	}
+	return genfs_parsepath(v);
+}
+
+/*
  * Simple lookup for rump file systems.
  *
  * uhm, this is twisted.  C F C C, hope of C C F C looming
@@ -654,7 +682,6 @@ rump_vop_lookup(void *v)
 	struct etfs *et;
 	bool dotdot = (cnp->cn_flags & ISDOTDOT) != 0;
 	int rv = 0;
-	const char *cp;
 
 	*vpp = NULL;
 
@@ -687,19 +714,18 @@ rump_vop_lookup(void *v)
 		mutex_exit(_lock);
 
 		if (found) {
+			if (et->et_keylen != cnp->cn_namelen) {
+/*
+ * This can theoretically happen if an
+ * etfs entry is added or removed
+ * while lookups are being done as we
+ * don't hold etfs_lock across here
+ * and parsepath. Won't ordinarily be
+ * the case. No biggie, just retry.
+ */
+return ERESTART;
+			}
 			rn = et->et_rn;
-			cnp->cn_consume += et->et_keylen - cnp->cn_namelen;
-			/*
-			 * consume trailing slashes if any and clear
-			 * REQUIREDIR if we consumed the full path.
-			 */
-			cp = >cn_nameptr[cnp->cn_namelen];
-			cp += cnp->cn_consume;
-			KASSERT(*cp == '\0' || *cp == '/');
-			if (*cp == '\0' && rn->rn_va.va_type != VDIR)
-cnp->cn_flags &= ~REQUIREDIR;
-			while (*cp++ == '/')
-cnp->cn_consume++;
 			goto getvnode;
 		}
 	}



CVS commit: src/sys/fs/hfs

2021-06-29 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Jun 29 22:37:50 UTC 2021

Modified Files:
src/sys/fs/hfs: hfs_vnops.c

Log Message:
Implement VOP_PARSEPATH() for hfs.

This checks for a following "/rsrc" at the end of the pathname (to
indicate the resource fork of a file) and assimilates it into the
component name to be looked up. Then cn_namelen will already include
this text in lookup, and it's no longer necessary to muck with
cn_consume.

Invalid uses of "/rsrc" are ignored rather than rejected, which
appears to be the same as the old behavior. It is possible that the
parsepath logic should only consume the "/rsrc" if the name names a
file and not a directory, which would require looking it up in
parsepath and be a general nuisance; I hope not. It's also possible
that the whole thing doesn't work at all now, or it didn't before, as
I don't have any way to test it.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/fs/hfs/hfs_vnops.c

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

Modified files:

Index: src/sys/fs/hfs/hfs_vnops.c
diff -u src/sys/fs/hfs/hfs_vnops.c:1.37 src/sys/fs/hfs/hfs_vnops.c:1.38
--- src/sys/fs/hfs/hfs_vnops.c:1.37	Tue Jun 29 22:34:06 2021
+++ src/sys/fs/hfs/hfs_vnops.c	Tue Jun 29 22:37:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: hfs_vnops.c,v 1.37 2021/06/29 22:34:06 dholland Exp $	*/
+/*	$NetBSD: hfs_vnops.c,v 1.38 2021/06/29 22:37:50 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hfs_vnops.c,v 1.37 2021/06/29 22:34:06 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hfs_vnops.c,v 1.38 2021/06/29 22:37:50 dholland Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ipsec.h"
@@ -132,6 +132,7 @@ __KERNEL_RCSID(0, "$NetBSD: hfs_vnops.c,
 
 #include 
 
+int	hfs_vop_parsepath(void *);
 int	hfs_vop_lookup(void *);
 int	hfs_vop_open(void *);
 int	hfs_vop_close(void *);
@@ -331,6 +332,29 @@ const struct vnodeopv_desc hfs_fifoop_op
 	{ _fifoop_p, hfs_fifoop_entries };
 
 int
+hfs_vop_parsepath(void *v)
+{
+	struct vop_parsepath_args /* {
+		struct vnode *a_dvp;
+		const char *a_name;
+		size_t *a_retval;
+	} */ *ap = v;
+	size_t len;
+	int error;
+
+	error = genfs_parsepath(v);
+	if (error) {
+		return error;
+	}
+
+	len = *ap->a_retval;
+	if (!strcmp(ap->a_name + len, "/rsrc")) {
+		*ap->a_retval += 5;
+	}
+	return 0;
+}
+
+int
 hfs_vop_lookup(void *v)
 {
 	struct vop_lookup_v2_args /* {
@@ -346,6 +370,8 @@ hfs_vop_lookup(void *v)
 	struct vnode *vdp;		/* vnode for directory being searched */
 	hfs_catalog_key_t key;	/* hfs+ catalog search key for requested child */
 	hfs_catalog_keyed_record_t rec; /* catalog record of requested child */
+	size_t namelen;
+	int use_resource_fork = 0;
 	unichar_t* unicn;		/* name of component, in Unicode */
 	const char *pname;
 	int error;
@@ -420,12 +446,18 @@ hfs_vop_lookup(void *v)
 
 		hfslib_init_cbargs();
 
+		namelen = cnp->cn_namelen;
+		if (namelen > 5 &&
+		!strcmp(cnp->cn_nameptr + namelen - 5, "/rsrc")) {
+			namelen -= 5;
+			use_resource_fork = 1;
+		}
+
 		/* XXX: when decomposing, string could grow
 		   and we have to handle overflow */
-		unicn = malloc(cnp->cn_namelen * sizeof(unicn[0]),
-		M_TEMP, M_WAITOK);
-		len = utf8_to_utf16(unicn, cnp->cn_namelen,
-		cnp->cn_nameptr, cnp->cn_namelen, 0, NULL);
+		unicn = malloc(namelen * sizeof(unicn[0]), M_TEMP, M_WAITOK);
+		len = utf8_to_utf16(unicn, namelen,
+		cnp->cn_nameptr, namelen, 0, NULL);
 		for (ni = 0; ni < len; ni++)
 			if (unicn[ni] == (unichar_t)':')
 unicn[ni] = (unichar_t)'/';
@@ -462,13 +494,11 @@ hfs_vop_lookup(void *v)
 		}
 
 		if (rec.type == HFS_REC_FILE
-		&& strcmp(cnp->cn_nameptr+cnp->cn_namelen, "/rsrc") == 0
+		&& use_resource_fork
 		&& rec.file.rsrc_fork.logical_size > 0) {
-		/* advance namei next pointer to end of stirng */
-		cnp->cn_consume = 5;
-		cnp->cn_flags &= ~REQUIREDIR; /* XXX: needed? */
-		error = hfs_vget_internal(vdp->v_mount, rec.file.cnid,
-			HFS_RSRCFORK, );
+		/* advance namei next pointer to end of string */
+			error = hfs_vget_internal(vdp->v_mount, rec.file.cnid,
+			HFS_RSRCFORK, );
 		} else
 			error = hfs_vget_internal(vdp->v_mount, rec.file.cnid,
 			HFS_DATAFORK, );



CVS commit: src/sys

2021-06-29 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Jun 29 22:37:11 UTC 2021

Modified Files:
src/sys/kern: vnode_if.c
src/sys/rump/include/rump: rumpvnode_if.h
src/sys/rump/librump/rumpvfs: rumpvnode_if.c
src/sys/sys: vnode_if.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/kern/vnode_if.c
cvs rdiff -u -r1.34 -r1.35 src/sys/rump/include/rump/rumpvnode_if.h
cvs rdiff -u -r1.34 -r1.35 src/sys/rump/librump/rumpvfs/rumpvnode_if.c
cvs rdiff -u -r1.105 -r1.106 src/sys/sys/vnode_if.h

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

Modified files:

Index: src/sys/kern/vnode_if.c
diff -u src/sys/kern/vnode_if.c:1.112 src/sys/kern/vnode_if.c:1.113
--- src/sys/kern/vnode_if.c:1.112	Mon May 18 08:30:06 2020
+++ src/sys/kern/vnode_if.c	Tue Jun 29 22:37:11 2021
@@ -1,13 +1,13 @@
-/*	$NetBSD: vnode_if.c,v 1.112 2020/05/18 08:30:06 hannken Exp $	*/
+/*	$NetBSD: vnode_if.c,v 1.113 2021/06/29 22:37:11 dholland Exp $	*/
 
 /*
  * Warning: DO NOT EDIT! This file is automatically generated!
  * (Modifications made here may easily be lost!)
  *
  * Created from the file:
- *	NetBSD: vnode_if.src,v 1.78 2019/10/11 08:04:52 hannken Exp
+ *	NetBSD: vnode_if.src,v 1.81 2021/06/29 22:34:08 dholland Exp
  * by the script:
- *	NetBSD: vnode_if.sh,v 1.69 2020/02/23 22:14:04 ad Exp
+ *	NetBSD: vnode_if.sh,v 1.70 2020/05/16 18:31:50 christos Exp
  */
 
 /*
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.112 2020/05/18 08:30:06 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.113 2021/06/29 22:37:11 dholland Exp $");
 
 #include 
 #include 
@@ -145,6 +145,40 @@ VOP_BWRITE(struct vnode *vp,
 	return error;
 }
 
+const int vop_parsepath_vp_offsets[] = {
+	VOPARG_OFFSETOF(struct vop_parsepath_args,a_dvp),
+	VDESC_NO_OFFSET
+};
+const struct vnodeop_desc vop_parsepath_desc = {
+	VOP_PARSEPATH_DESCOFFSET,
+	"vop_parsepath",
+	0,
+	vop_parsepath_vp_offsets,
+	VDESC_NO_OFFSET,
+	VDESC_NO_OFFSET,
+	VDESC_NO_OFFSET,
+};
+int
+VOP_PARSEPATH(struct vnode *dvp,
+const char *name,
+size_t *retval)
+{
+	int error;
+	bool mpsafe;
+	struct vop_parsepath_args a;
+	struct mount *mp;
+	a.a_desc = VDESC(vop_parsepath);
+	a.a_dvp = dvp;
+	a.a_name = name;
+	a.a_retval = retval;
+	error = vop_pre(dvp, , , FST_YES);
+	if (error)
+		return error;
+	error = (VCALL(dvp, VOFFSET(vop_parsepath), ));
+	vop_post(dvp, mp, mpsafe, FST_YES);
+	return error;
+}
+
 const int vop_lookup_vp_offsets[] = {
 	VOPARG_OFFSETOF(struct vop_lookup_v2_args,a_dvp),
 	VDESC_NO_OFFSET
@@ -2000,6 +2034,7 @@ const struct vnodeop_desc * const vfs_op
 	_default_desc,	/* MUST BE FIRST */
 
 	_bwrite_desc,
+	_parsepath_desc,
 	_lookup_desc,
 	_create_desc,
 	_mknod_desc,

Index: src/sys/rump/include/rump/rumpvnode_if.h
diff -u src/sys/rump/include/rump/rumpvnode_if.h:1.34 src/sys/rump/include/rump/rumpvnode_if.h:1.35
--- src/sys/rump/include/rump/rumpvnode_if.h:1.34	Sat May 16 18:31:52 2020
+++ src/sys/rump/include/rump/rumpvnode_if.h	Tue Jun 29 22:37:11 2021
@@ -1,13 +1,13 @@
-/*	$NetBSD: rumpvnode_if.h,v 1.34 2020/05/16 18:31:52 christos Exp $	*/
+/*	$NetBSD: rumpvnode_if.h,v 1.35 2021/06/29 22:37:11 dholland Exp $	*/
 
 /*
  * Warning: DO NOT EDIT! This file is automatically generated!
  * (Modifications made here may easily be lost!)
  *
  * Created from the file:
- *	NetBSD: vnode_if.src,v 1.78 2019/10/11 08:04:52 hannken Exp
+ *	NetBSD: vnode_if.src,v 1.81 2021/06/29 22:34:08 dholland Exp
  * by the script:
- *	NetBSD: vnode_if.sh,v 1.69 2020/02/23 22:14:04 ad Exp
+ *	NetBSD: vnode_if.sh,v 1.70 2020/05/16 18:31:50 christos Exp
  */
 
 /*
@@ -55,6 +55,7 @@ struct acl;
 #endif
 
 int RUMP_VOP_BWRITE(struct vnode *, struct buf *);
+int RUMP_VOP_PARSEPATH(struct vnode *, const char *, size_t *);
 int RUMP_VOP_LOOKUP(struct vnode *, struct vnode **, struct componentname *);
 int RUMP_VOP_CREATE(struct vnode *, struct vnode **, struct componentname *, 
 struct vattr *);

Index: src/sys/rump/librump/rumpvfs/rumpvnode_if.c
diff -u src/sys/rump/librump/rumpvfs/rumpvnode_if.c:1.34 src/sys/rump/librump/rumpvfs/rumpvnode_if.c:1.35
--- src/sys/rump/librump/rumpvfs/rumpvnode_if.c:1.34	Sat May 16 18:31:53 2020
+++ src/sys/rump/librump/rumpvfs/rumpvnode_if.c	Tue Jun 29 22:37:11 2021
@@ -1,13 +1,13 @@
-/*	$NetBSD: rumpvnode_if.c,v 1.34 2020/05/16 18:31:53 christos Exp $	*/
+/*	$NetBSD: rumpvnode_if.c,v 1.35 2021/06/29 22:37:11 dholland Exp $	*/
 
 /*
  * Warning: DO NOT EDIT! This file is automatically generated!
  * (Modifications made here may easily be lost!)
  *
  * Created from the file:
- *	NetBSD: vnode_if.src,v 1.78 2019/10/11 08:04:52 hannken Exp
+ *	NetBSD: vnode_if.src,v 1.81 2021/06/29 22:34:08 dholland Exp
  * by the script:
- *	NetBSD: vnode_if.sh,v 1.69 2020/02/23 22:14:04 ad Exp
+ *	NetBSD: vnode_if.sh,v 1.70 2020/05/16 18:31:50 christos Exp
  */
 
 /*
@@ -40,7 +40,7 @@
  */

CVS commit: src/sys

2021-06-29 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Jun 29 22:34:10 UTC 2021

Modified Files:
src/sys/coda: coda_vnops.c
src/sys/fs/adosfs: advnops.c
src/sys/fs/autofs: autofs_vnops.c
src/sys/fs/cd9660: cd9660_vnops.c
src/sys/fs/efs: efs_vnops.c
src/sys/fs/filecorefs: filecore_vnops.c
src/sys/fs/hfs: hfs_vnops.c
src/sys/fs/msdosfs: msdosfs_vnops.c
src/sys/fs/nilfs: nilfs_vnops.c
src/sys/fs/ntfs: ntfs_vnops.c
src/sys/fs/ptyfs: ptyfs_vnops.c
src/sys/fs/puffs: puffs_vnops.c
src/sys/fs/sysvbfs: sysvbfs.c
src/sys/fs/tmpfs: tmpfs_fifoops.c tmpfs_specops.c tmpfs_vnops.c
src/sys/fs/udf: udf_vnops.c
src/sys/fs/union: union_vnops.c
src/sys/fs/unionfs: unionfs_vnops.c
src/sys/fs/v7fs: v7fs_extern.c
src/sys/kern: vfs_lookup.c vnode_if.src
src/sys/miscfs/deadfs: dead_vnops.c
src/sys/miscfs/fdesc: fdesc_vnops.c
src/sys/miscfs/fifofs: fifo_vnops.c
src/sys/miscfs/genfs: genfs.h genfs_vnops.c
src/sys/miscfs/kernfs: kernfs_vnops.c
src/sys/miscfs/procfs: procfs_vnops.c
src/sys/miscfs/specfs: spec_vnops.c
src/sys/nfs: nfs_vnops.c
src/sys/rump/librump/rumpvfs: rumpfs.c
src/sys/ufs/chfs: chfs_vnops.c
src/sys/ufs/ext2fs: ext2fs_vnops.c
src/sys/ufs/ffs: ffs_vnops.c
src/sys/ufs/lfs: lfs_vnops.c
src/sys/ufs/mfs: mfs_vnops.c

Log Message:
- Add a new vnode op: VOP_PARSEPATH.
 - Move namei_getcomponent to genfs_vnops.c and call it genfs_parsepath.
 - Add a parsepath entry to every vnode ops table.

VOP_PARSEPATH takes a directory vnode to be searched and a complete
following path and chooses how much of that path to consume. To begin
with, all parsepath calls are genfs_parsepath, which locates the first
'/' as always.

Note that the call doesn't take the whole struct componentname, only
the string. The other bits of struct componentname should not be
needed and there's no reason to cause potential complications by
exposing them.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/coda/coda_vnops.c
cvs rdiff -u -r1.55 -r1.56 src/sys/fs/adosfs/advnops.c
cvs rdiff -u -r1.6 -r1.7 src/sys/fs/autofs/autofs_vnops.c
cvs rdiff -u -r1.58 -r1.59 src/sys/fs/cd9660/cd9660_vnops.c
cvs rdiff -u -r1.41 -r1.42 src/sys/fs/efs/efs_vnops.c
cvs rdiff -u -r1.47 -r1.48 src/sys/fs/filecorefs/filecore_vnops.c
cvs rdiff -u -r1.36 -r1.37 src/sys/fs/hfs/hfs_vnops.c
cvs rdiff -u -r1.104 -r1.105 src/sys/fs/msdosfs/msdosfs_vnops.c
cvs rdiff -u -r1.42 -r1.43 src/sys/fs/nilfs/nilfs_vnops.c
cvs rdiff -u -r1.65 -r1.66 src/sys/fs/ntfs/ntfs_vnops.c
cvs rdiff -u -r1.63 -r1.64 src/sys/fs/ptyfs/ptyfs_vnops.c
cvs rdiff -u -r1.217 -r1.218 src/sys/fs/puffs/puffs_vnops.c
cvs rdiff -u -r1.18 -r1.19 src/sys/fs/sysvbfs/sysvbfs.c
cvs rdiff -u -r1.12 -r1.13 src/sys/fs/tmpfs/tmpfs_fifoops.c
cvs rdiff -u -r1.13 -r1.14 src/sys/fs/tmpfs/tmpfs_specops.c
cvs rdiff -u -r1.145 -r1.146 src/sys/fs/tmpfs/tmpfs_vnops.c
cvs rdiff -u -r1.114 -r1.115 src/sys/fs/udf/udf_vnops.c
cvs rdiff -u -r1.74 -r1.75 src/sys/fs/union/union_vnops.c
cvs rdiff -u -r1.14 -r1.15 src/sys/fs/unionfs/unionfs_vnops.c
cvs rdiff -u -r1.7 -r1.8 src/sys/fs/v7fs/v7fs_extern.c
cvs rdiff -u -r1.227 -r1.228 src/sys/kern/vfs_lookup.c
cvs rdiff -u -r1.80 -r1.81 src/sys/kern/vnode_if.src
cvs rdiff -u -r1.63 -r1.64 src/sys/miscfs/deadfs/dead_vnops.c
cvs rdiff -u -r1.136 -r1.137 src/sys/miscfs/fdesc/fdesc_vnops.c
cvs rdiff -u -r1.82 -r1.83 src/sys/miscfs/fifofs/fifo_vnops.c
cvs rdiff -u -r1.36 -r1.37 src/sys/miscfs/genfs/genfs.h
cvs rdiff -u -r1.210 -r1.211 src/sys/miscfs/genfs/genfs_vnops.c
cvs rdiff -u -r1.167 -r1.168 src/sys/miscfs/kernfs/kernfs_vnops.c
cvs rdiff -u -r1.216 -r1.217 src/sys/miscfs/procfs/procfs_vnops.c
cvs rdiff -u -r1.181 -r1.182 src/sys/miscfs/specfs/spec_vnops.c
cvs rdiff -u -r1.317 -r1.318 src/sys/nfs/nfs_vnops.c
cvs rdiff -u -r1.162 -r1.163 src/sys/rump/librump/rumpvfs/rumpfs.c
cvs rdiff -u -r1.42 -r1.43 src/sys/ufs/chfs/chfs_vnops.c
cvs rdiff -u -r1.132 -r1.133 src/sys/ufs/ext2fs/ext2fs_vnops.c
cvs rdiff -u -r1.133 -r1.134 src/sys/ufs/ffs/ffs_vnops.c
cvs rdiff -u -r1.336 -r1.337 src/sys/ufs/lfs/lfs_vnops.c
cvs rdiff -u -r1.61 -r1.62 src/sys/ufs/mfs/mfs_vnops.c

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

Modified files:

Index: src/sys/coda/coda_vnops.c
diff -u src/sys/coda/coda_vnops.c:1.114 src/sys/coda/coda_vnops.c:1.115
--- src/sys/coda/coda_vnops.c:1.114	Sat Nov 14 11:42:56 2020
+++ src/sys/coda/coda_vnops.c	Tue Jun 29 22:34:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vnops.c,v 1.114 2020/11/14 11:42:56 hannken Exp $	*/
+/*	$NetBSD: coda_vnops.c,v 1.115 2021/06/29 22:34:05 dholland Exp $	*/
 
 /*
  *
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.114 2020/11/14 11:42:56 hannken Exp $");
+__KERNEL_RCSID(0, 

CVS commit: src/sys/kern

2021-06-29 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Jun 29 22:29:59 UTC 2021

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

Log Message:
Adjust namei internals to be able to make an external call to parse
the pathname. (Basically, this means change the signature of
namei_getcomponent(), and thus lookup_parsepath(), to pass in the
directory vnode and to allow failures.)


To generate a diff of this commit:
cvs rdiff -u -r1.226 -r1.227 src/sys/kern/vfs_lookup.c

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

Modified files:

Index: src/sys/kern/vfs_lookup.c
diff -u src/sys/kern/vfs_lookup.c:1.226 src/sys/kern/vfs_lookup.c:1.227
--- src/sys/kern/vfs_lookup.c:1.226	Wed Jun 16 01:51:57 2021
+++ src/sys/kern/vfs_lookup.c	Tue Jun 29 22:29:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_lookup.c,v 1.226 2021/06/16 01:51:57 dholland Exp $	*/
+/*	$NetBSD: vfs_lookup.c,v 1.227 2021/06/29 22:29:59 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.226 2021/06/16 01:51:57 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.227 2021/06/29 22:29:59 dholland Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_magiclinks.h"
@@ -229,16 +229,19 @@ namei_hash(const char *name, const char 
  * Find the end of the first path component in NAME and return its
  * length.
  */
-static size_t
-namei_getcomponent(const char *name)
+static int
+namei_getcomponent(struct vnode *dvp, const char *name, size_t *ret)
 {
 	size_t pos;
 
+	(void)dvp;
+
 	pos = 0;
 	while (name[pos] != '\0' && name[pos] != '/') {
 		pos++;
 	}
-	return pos;
+	*ret = pos;
+	return 0;
 }
 
 
@@ -840,9 +843,10 @@ namei_follow(struct namei_state *state, 
  * Inspect the leading path component and update the state accordingly.
  */
 static int
-lookup_parsepath(struct namei_state *state)
+lookup_parsepath(struct namei_state *state, struct vnode *searchdir)
 {
 	const char *cp;			/* pointer into pathname argument */
+	int error;
 
 	struct componentname *cnp = state->cnp;
 	struct nameidata *ndp = state->ndp;
@@ -861,7 +865,11 @@ lookup_parsepath(struct namei_state *sta
 	 * is held.
 	 */
 	cnp->cn_consume = 0;
-	cnp->cn_namelen = namei_getcomponent(cnp->cn_nameptr);
+	error = namei_getcomponent(searchdir, cnp->cn_nameptr,
+   >cn_namelen);
+	if (error) {
+		return error;
+	}
 	cp = cnp->cn_nameptr + cnp->cn_namelen;
 	if (cnp->cn_namelen > KERNEL_NAME_MAX) {
 		return ENAMETOOLONG;
@@ -1325,7 +1333,7 @@ lookup_fastforward(struct namei_state *s
 		 */
 		KASSERT(cnp->cn_nameptr[0] != '/');
 		KASSERT(cnp->cn_nameptr[0] != '\0');
-		if ((error = lookup_parsepath(state)) != 0) {
+		if ((error = lookup_parsepath(state, searchdir)) != 0) {
 			break;
 		}
 
@@ -1500,9 +1508,13 @@ lookup_fastforward(struct namei_state *s
 			}
 			cnp->cn_nameptr = oldnameptr;
 			ndp->ni_pathlen = oldpathlen;
-			error = lookup_parsepath(state);
-			if (error == 0) {
+			if (searchdir == NULL) {
 error = EOPNOTSUPP;
+			} else {
+error = lookup_parsepath(state, searchdir);
+if (error == 0) {
+	error = EOPNOTSUPP;
+}
 			}
 		}
 	} else if (plock != NULL) {
@@ -2049,7 +2061,7 @@ lookup_for_nfsd(struct nameidata *ndp, s
 static int
 do_lookup_for_nfsd_index(struct namei_state *state)
 {
-	int error = 0;
+	int error;
 
 	struct componentname *cnp = state->cnp;
 	struct nameidata *ndp = state->ndp;
@@ -2068,7 +2080,12 @@ do_lookup_for_nfsd_index(struct namei_st
 	ndp->ni_dvp = NULL;
 
 	cnp->cn_consume = 0;
-	cnp->cn_namelen = namei_getcomponent(cnp->cn_nameptr);
+	error = namei_getcomponent(startdir, cnp->cn_nameptr,
+   >cn_namelen);
+	if (error) {
+		return error;
+	}
+
 	cp = cnp->cn_nameptr + cnp->cn_namelen;
 	KASSERT(cnp->cn_namelen <= KERNEL_NAME_MAX);
 	ndp->ni_pathlen -= cnp->cn_namelen;
@@ -2199,7 +2216,10 @@ relookup(struct vnode *dvp, struct vnode
 	if ((uint32_t)newhash != (uint32_t)cnp->cn_hash)
 		panic("relookup: bad hash");
 #endif
-	newlen = namei_getcomponent(cnp->cn_nameptr);
+	error = namei_getcomponent(dvp, cnp->cn_nameptr, );
+	if (error) {
+		panic("relookup: parsepath failed with error %d", error);
+	}
 	if (cnp->cn_namelen != newlen)
 		panic("relookup: bad len");
 	cp = cnp->cn_nameptr + cnp->cn_namelen;



CVS commit: src/sys

2021-06-15 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Jun 16 01:52:40 UTC 2021

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

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/rump/include/rump/rump_namei.h
cvs rdiff -u -r1.113 -r1.114 src/sys/sys/namei.h

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

Modified files:

Index: src/sys/rump/include/rump/rump_namei.h
diff -u src/sys/rump/include/rump/rump_namei.h:1.46 src/sys/rump/include/rump/rump_namei.h:1.47
--- src/sys/rump/include/rump/rump_namei.h:1.46	Sat May 30 20:16:34 2020
+++ src/sys/rump/include/rump/rump_namei.h	Wed Jun 16 01:52:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump_namei.h,v 1.46 2020/05/30 20:16:34 ad Exp $	*/
+/*	$NetBSD: rump_namei.h,v 1.47 2021/06/16 01:52:39 dholland Exp $	*/
 
 
 /*
@@ -25,7 +25,8 @@
 #define RUMP_NAMEI_EMULROOTSET	0x0080
 #define RUMP_NAMEI_LOCKSHARED	0x0100
 #define RUMP_NAMEI_NOCHROOT	0x0100
-#define RUMP_NAMEI_MODMASK	0x010001fc
+#define RUMP_NAMEI_NONEXCLHACK	0x0200
+#define RUMP_NAMEI_MODMASK	0x030001fc
 #define RUMP_NAMEI_NOCROSSMOUNT	0x800
 #define RUMP_NAMEI_RDONLY	0x0001000
 #define RUMP_NAMEI_ISDOTDOT	0x0002000

Index: src/sys/sys/namei.h
diff -u src/sys/sys/namei.h:1.113 src/sys/sys/namei.h:1.114
--- src/sys/sys/namei.h:1.113	Sat May 30 20:16:34 2020
+++ src/sys/sys/namei.h	Wed Jun 16 01:52:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: namei.h,v 1.113 2020/05/30 20:16:34 ad Exp $	*/
+/*	$NetBSD: namei.h,v 1.114 2021/06/16 01:52:39 dholland Exp $	*/
 
 
 /*
@@ -162,7 +162,8 @@ struct nameidata {
 	   in ni_erootdir */
 #define	LOCKSHARED	0x0100	/* want shared locks if possible */
 #define	NOCHROOT	0x0100	/* no chroot on abs path lookups */
-#define	MODMASK		0x010001fc	/* mask of operational modifiers */
+#define	NONEXCLHACK	0x0200	/* open wwith O_CREAT but not O_EXCL */
+#define	MODMASK		0x030001fc	/* mask of operational modifiers */
 /*
  * Namei parameter descriptors.
  */
@@ -364,7 +365,8 @@ struct	nchstats _NAMEI_CACHE_STATS(uint6
 #define NAMEI_EMULROOTSET	0x0080
 #define NAMEI_LOCKSHARED	0x0100
 #define NAMEI_NOCHROOT	0x0100
-#define NAMEI_MODMASK	0x010001fc
+#define NAMEI_NONEXCLHACK	0x0200
+#define NAMEI_MODMASK	0x030001fc
 #define NAMEI_NOCROSSMOUNT	0x800
 #define NAMEI_RDONLY	0x0001000
 #define NAMEI_ISDOTDOT	0x0002000



CVS commit: src/sys

2021-06-15 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Jun 16 01:51:57 UTC 2021

Modified Files:
src/sys/kern: vfs_lookup.c vfs_vnops.c
src/sys/sys: namei.src

Log Message:
Add a new namei flag NONEXCLHACK for open with O_CREAT and not O_EXCL.

This case needs to be distinguished from the other CREATE operations
because it is supposed to successfully return (and open) the target if
it exists. In the case where that target is the root, or a mount
point, such that there's no parent dir, "real" CREATE operations fail,
but O_CREAT without O_EXCL needs to succeed.

So (a) add the flag, (b) test for it in namei in the situation
described above, (c) set it in open under the appropriate
circumstances, and (d) because this can result in namei returning
ni_dvp of NULL, cope with that case.

Should get into -9 and maybe even -8, because it was prompted by
issues with 3rd-party code. The use of a flag (vs. adding an
additional nameiop, which would be more appropriate) was deliberate to
make the patch small and noninvasive.


To generate a diff of this commit:
cvs rdiff -u -r1.225 -r1.226 src/sys/kern/vfs_lookup.c
cvs rdiff -u -r1.214 -r1.215 src/sys/kern/vfs_vnops.c
cvs rdiff -u -r1.58 -r1.59 src/sys/sys/namei.src

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

Modified files:

Index: src/sys/kern/vfs_lookup.c
diff -u src/sys/kern/vfs_lookup.c:1.225 src/sys/kern/vfs_lookup.c:1.226
--- src/sys/kern/vfs_lookup.c:1.225	Tue Dec 29 22:13:40 2020
+++ src/sys/kern/vfs_lookup.c	Wed Jun 16 01:51:57 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_lookup.c,v 1.225 2020/12/29 22:13:40 chs Exp $	*/
+/*	$NetBSD: vfs_lookup.c,v 1.226 2021/06/16 01:51:57 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.225 2020/12/29 22:13:40 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.226 2021/06/16 01:51:57 dholland Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_magiclinks.h"
@@ -1802,10 +1802,33 @@ namei_oneroot(struct namei_state *state,
 		 * a CREATE, DELETE, or RENAME), and we don't have one
 		 * (because this is the root directory, or we crossed
 		 * a mount point), then we must fail.
+		 *
+		 * 20210604 dholland when NONEXCLHACK is set (open
+		 * with O_CREAT but not O_EXCL) skip this logic. Since
+		 * we have a foundobj, open will not be creating, so
+		 * it doesn't actually need or use the searchdir, so
+		 * it's ok to return it even if it's on a different
+		 * volume, and it's also ok to return NULL; by setting
+		 * NONEXCLHACK the open code promises to cope with
+		 * those cases correctly. (That is, it should do what
+		 * it would do anyway, that is, just release the
+		 * searchdir, except not crash if it's null.) This is
+		 * needed because otherwise opening mountpoints with
+		 * O_CREAT but not O_EXCL fails... which is a silly
+		 * thing to do but ought to work. (This whole issue
+		 * came to light because 3rd party code wanted to open
+		 * certain procfs nodes with O_CREAT for some 3rd
+		 * party reason, and it failed.)
+		 *
+		 * Note that NONEXCLHACK is properly a different
+		 * nameiop (it is partway between LOOKUP and CREATE)
+		 * but it was stuffed in as a flag instead to make the
+		 * resulting patch less invasive for pullup. Blah.
 		 */
 		if (cnp->cn_nameiop != LOOKUP &&
 		(searchdir == NULL ||
-		 searchdir->v_mount != foundobj->v_mount)) {
+		 searchdir->v_mount != foundobj->v_mount) &&
+		(cnp->cn_flags & NONEXCLHACK) == 0) {
 			if (searchdir) {
 if (searchdir_locked) {
 	vput(searchdir);

Index: src/sys/kern/vfs_vnops.c
diff -u src/sys/kern/vfs_vnops.c:1.214 src/sys/kern/vfs_vnops.c:1.215
--- src/sys/kern/vfs_vnops.c:1.214	Mon Nov  9 18:09:02 2020
+++ src/sys/kern/vfs_vnops.c	Wed Jun 16 01:51:57 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnops.c,v 1.214 2020/11/09 18:09:02 chs Exp $	*/
+/*	$NetBSD: vfs_vnops.c,v 1.215 2021/06/16 01:51:57 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.214 2020/11/09 18:09:02 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.215 2021/06/16 01:51:57 dholland Exp $");
 
 #include "veriexec.h"
 
@@ -161,6 +161,8 @@ vn_open(struct nameidata *ndp, int fmode
 		if ((fmode & O_EXCL) == 0 &&
 		((fmode & O_NOFOLLOW) == 0))
 			ndp->ni_cnd.cn_flags |= FOLLOW;
+		if ((fmode & O_EXCL) == 0)
+			ndp->ni_cnd.cn_flags |= NONEXCLHACK;
 	} else {
 		ndp->ni_cnd.cn_nameiop = LOOKUP;
 		ndp->ni_cnd.cn_flags |= LOCKLEAF;
@@ -183,7 +185,12 @@ vn_open(struct nameidata *ndp, int fmode
 	error = veriexec_openchk(l, ndp->ni_vp, pathstring, fmode);
 	if (error) {
 		/* We have to release the locks ourselves */
-		if (fmode & O_CREAT) {
+		/*
+		 * 20210604 dholland passing NONEXCLHACK means we can
+		 * get ni_dvp == NULL back if ni_vp exists, and we should
+		 * 

CVS commit: src/sbin/ping6

2021-06-07 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jun  7 22:13:34 UTC 2021

Modified Files:
src/sbin/ping6: ping6.8 ping6.c

Log Message:
In ping6, there's no blank space in the ping packets by default.

- document that if you use -p to specify a fill pattern you need to
make the packets bigger with -s;

- warn if -p is used and there's not at least one byte of fill space.

PR 56057


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sbin/ping6/ping6.8
cvs rdiff -u -r1.104 -r1.105 src/sbin/ping6/ping6.c

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

Modified files:

Index: src/sbin/ping6/ping6.8
diff -u src/sbin/ping6/ping6.8:1.33 src/sbin/ping6/ping6.8:1.34
--- src/sbin/ping6/ping6.8:1.33	Mon Apr 23 18:44:39 2018
+++ src/sbin/ping6/ping6.8	Mon Jun  7 22:13:34 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ping6.8,v 1.33 2018/04/23 18:44:39 maxv Exp $
+.\"	$NetBSD: ping6.8,v 1.34 2021/06/07 22:13:34 dholland Exp $
 .\"	$KAME: ping6.8,v 1.57 2002/05/26 13:18:25 itojun Exp $
 .\"
 .\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -28,7 +28,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd April 23, 2018
+.Dd June 7, 2021
 .Dt PING6 8
 .Os
 .Sh NAME
@@ -202,6 +202,10 @@ For example,
 .Dq Li \-p ff
 will cause the sent packet to be filled with all
 ones.
+Note that for IPv6 there is no fill space by default so it is
+necessary to also use the
+.Fl s
+option to expand the packet.
 .\" new IPsec
 .It Fl q
 Quiet output.

Index: src/sbin/ping6/ping6.c
diff -u src/sbin/ping6/ping6.c:1.104 src/sbin/ping6/ping6.c:1.105
--- src/sbin/ping6/ping6.c:1.104	Sun May 23 07:17:50 2021
+++ src/sbin/ping6/ping6.c	Mon Jun  7 22:13:34 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ping6.c,v 1.104 2021/05/23 07:17:50 thorpej Exp $	*/
+/*	$NetBSD: ping6.c,v 1.105 2021/06/07 22:13:34 dholland Exp $	*/
 /*	$KAME: ping6.c,v 1.164 2002/11/16 14:05:37 itojun Exp $	*/
 
 /*
@@ -77,7 +77,7 @@ static char sccsid[] = "@(#)ping.c	8.1 (
 #else
 #include 
 #ifndef lint
-__RCSID("$NetBSD: ping6.c,v 1.104 2021/05/23 07:17:50 thorpej Exp $");
+__RCSID("$NetBSD: ping6.c,v 1.105 2021/06/07 22:13:34 dholland Exp $");
 #endif
 #endif
 
@@ -569,6 +569,10 @@ main(int argc, char *argv[])
 	} else
 		target = argv[argc - 1];
 
+	if ((options & F_PINGFILLED) != 0 && datalen <= (int)ICMP6ECHOTMLEN) {
+		warnx("-p: No fill space; increase packet size with -s");
+	}
+
 	/* getaddrinfo */
 	memset(, 0, sizeof(struct addrinfo));
 	hints.ai_flags = AI_CANONNAME;



CVS commit: src/sbin/mount_chfs

2021-06-07 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jun  7 21:44:35 UTC 2021

Modified Files:
src/sbin/mount_chfs: mount_chfs.8 mount_chfs.c

Log Message:
Teach mount_chfs to understand -o. From Andrius V.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sbin/mount_chfs/mount_chfs.8
cvs rdiff -u -r1.3 -r1.4 src/sbin/mount_chfs/mount_chfs.c

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

Modified files:

Index: src/sbin/mount_chfs/mount_chfs.8
diff -u src/sbin/mount_chfs/mount_chfs.8:1.4 src/sbin/mount_chfs/mount_chfs.8:1.5
--- src/sbin/mount_chfs/mount_chfs.8:1.4	Mon Sep 12 00:38:42 2016
+++ src/sbin/mount_chfs/mount_chfs.8	Mon Jun  7 21:44:35 2021
@@ -1,4 +1,4 @@
-.\" $NetBSD: mount_chfs.8,v 1.4 2016/09/12 00:38:42 sevan Exp $
+.\" $NetBSD: mount_chfs.8,v 1.5 2021/06/07 21:44:35 dholland Exp $
 .\"
 .\" Copyright (c) 2011 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd September 12, 2016
+.Dd June 7, 2021
 .Dt MOUNT_CHFS 8
 .Os
 .Sh NAME
@@ -41,6 +41,21 @@ For regular block devices like SSD drive
 please use a regular file system.
 The file system will be created during the first mount.
 CHFS stands for Chip File System.
+.Pp
+This command is normally executed by
+.Xr mount 8
+at boot time.
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl o
+Options are specified with a
+.Fl o
+flag followed by a comma-separated string of options.
+See the
+.Xr mount 8
+man page for possible options and their meanings.
+.El
 .Sh EXAMPLES
 .Dl mount_chfs /dev/flash0 /mnt
 .Sh SEE ALSO

Index: src/sbin/mount_chfs/mount_chfs.c
diff -u src/sbin/mount_chfs/mount_chfs.c:1.3 src/sbin/mount_chfs/mount_chfs.c:1.4
--- src/sbin/mount_chfs/mount_chfs.c:1.3	Fri Jun  4 22:41:36 2021
+++ src/sbin/mount_chfs/mount_chfs.c	Mon Jun  7 21:44:35 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mount_chfs.c,v 1.3 2021/06/04 22:41:36 riastradh Exp $	*/
+/*	$NetBSD: mount_chfs.c,v 1.4 2021/06/07 21:44:35 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2010 Department of Software Engineering,
@@ -53,6 +53,12 @@
 #include "mountprog.h"
 #include "mount_chfs.h"
 
+static const struct mntopt mopts[] = {
+	MOPT_STDOPTS,
+	MOPT_GETARGS,
+	MOPT_NULL,
+};
+
 /* - */
 
 static void	usage(void) __dead;
@@ -64,6 +70,7 @@ mount_chfs_parseargs(int argc, char *arg
 int *mntflags, char *canon_dev, char *canon_dir)
 {
 	int ch;
+	mntoptparse_t mp;
 	struct stat sb;
 
 	/* Set default values for mount point arguments. */
@@ -72,8 +79,14 @@ mount_chfs_parseargs(int argc, char *arg
 
 	optind = optreset = 1;
 
-	while ((ch = getopt(argc, argv, "i:")) != -1) {
+	while ((ch = getopt(argc, argv, "o:")) != -1) {
 		switch (ch) {
+		case 'o':
+			mp = getmntopts(optarg, mopts, mntflags, 0);
+			if (mp == NULL)
+err(1, "getmntopts");
+			freemntopts(mp);
+			break;
 		case '?':
 		default:
 			usage();



CVS commit: src/share/man/man4

2021-06-06 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jun  7 03:04:50 UTC 2021

Modified Files:
src/share/man/man4: ums.4

Log Message:
Mention in ums(4) that a lot of usb mice detach/reattcah when not in use.

Prompted by PR 56209 but not related to the actual problem there.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/share/man/man4/ums.4

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

Modified files:

Index: src/share/man/man4/ums.4
diff -u src/share/man/man4/ums.4:1.11 src/share/man/man4/ums.4:1.12
--- src/share/man/man4/ums.4:1.11	Wed Sep  6 14:47:35 2017
+++ src/share/man/man4/ums.4	Mon Jun  7 03:04:50 2021
@@ -1,4 +1,4 @@
-.\" $NetBSD: ums.4,v 1.11 2017/09/06 14:47:35 ryoon Exp $
+.\" $NetBSD: ums.4,v 1.12 2021/06/07 03:04:50 dholland Exp $
 .\"
 .\" Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd September 6, 2017
+.Dd June 6, 2021
 .Dt UMS 4
 .Os
 .Sh NAME
@@ -43,6 +43,16 @@ driver provides support for USB mice and
 Access to the movement data is through the
 .Xr wsmouse 4
 driver.
+.Pp
+Be aware that many USB mice will, if the mouse device is not open,
+detach and reattach themselves repeatedly at regular intervals
+(usually around one minute) causing spam on the console and the system
+log.
+This is apparently intentional behavior on the part of the hardware
+manufacturers.
+The best workaround is to keep the mouse device open, either via 
+X11, or, if not using the window system, by running
+.Xr wsmoused 8 .
 .Sh SEE ALSO
 .Xr uhidev 4 ,
 .Xr usb 4 ,



CVS commit: src/share/man/man7

2021-05-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun May 30 07:17:01 UTC 2021

Modified Files:
src/share/man/man7: signal.7

Log Message:
signal.7: minor clarification. Bump date (to when I wrote the change)


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/share/man/man7/signal.7

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

Modified files:

Index: src/share/man/man7/signal.7
diff -u src/share/man/man7/signal.7:1.25 src/share/man/man7/signal.7:1.26
--- src/share/man/man7/signal.7:1.25	Wed May 30 23:41:44 2018
+++ src/share/man/man7/signal.7	Sun May 30 07:17:01 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: signal.7,v 1.25 2018/05/30 23:41:44 uwe Exp $
+.\"	$NetBSD: signal.7,v 1.26 2021/05/30 07:17:01 dholland Exp $
 .\"
 .\" Copyright (c) 1999, 2016 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 28, 2018
+.Dd August 24, 2018
 .Dt SIGNAL 7
 .Os
 .Sh NAME
@@ -81,7 +81,8 @@ This is always done in a way that allows
 desired.
 (Note, however, that some signals may not be caught.)
 Otherwise, the default action for the signal is taken.
-For most signals the default action is a core dump.
+For most signals the default action is to terminate the process and
+generate a core dump.
 See the table below.
 Note that the term
 .Em delivery



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

2021-05-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun May 30 06:53:15 UTC 2021

Modified Files:
src/sys/arch/arm/arm32: cpuswitch.S

Log Message:
typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/arm/arm32/cpuswitch.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/arm/arm32/cpuswitch.S
diff -u src/sys/arch/arm/arm32/cpuswitch.S:1.104 src/sys/arch/arm/arm32/cpuswitch.S:1.105
--- src/sys/arch/arm/arm32/cpuswitch.S:1.104	Sat Nov 21 19:44:52 2020
+++ src/sys/arch/arm/arm32/cpuswitch.S	Sun May 30 06:53:15 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuswitch.S,v 1.104 2020/11/21 19:44:52 skrll Exp $	*/
+/*	$NetBSD: cpuswitch.S,v 1.105 2021/05/30 06:53:15 dholland Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -87,7 +87,7 @@
 #include 
 #include 
 
-	RCSID("$NetBSD: cpuswitch.S,v 1.104 2020/11/21 19:44:52 skrll Exp $")
+	RCSID("$NetBSD: cpuswitch.S,v 1.105 2021/05/30 06:53:15 dholland Exp $")
 
 /* LINTSTUB: include  */
 
@@ -136,7 +136,7 @@ ENTRY(cpu_switchto)
 	mov	ip, sp
 	push	{r4-r7, ip, lr}
 
-	/* move lwps into caller saved registers */
+	/* move lwps into callee saved registers */
 	mov	r6, r1
 	mov	r4, r0
 



CVS commit: src/sys/dev/scsipi

2021-05-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun May 30 06:46:46 UTC 2021

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

Log Message:
typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.331 -r1.332 src/sys/dev/scsipi/sd.c

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

Modified files:

Index: src/sys/dev/scsipi/sd.c
diff -u src/sys/dev/scsipi/sd.c:1.331 src/sys/dev/scsipi/sd.c:1.332
--- src/sys/dev/scsipi/sd.c:1.331	Wed Feb 10 16:30:01 2021
+++ src/sys/dev/scsipi/sd.c	Sun May 30 06:46:46 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sd.c,v 1.331 2021/02/10 16:30:01 christos Exp $	*/
+/*	$NetBSD: sd.c,v 1.332 2021/05/30 06:46:46 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.331 2021/02/10 16:30:01 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.332 2021/05/30 06:46:46 dholland Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_scsi.h"
@@ -681,7 +681,7 @@ sd_diskstart(device_t dev, struct buf *b
 	/*
 	 * If the device has become invalid, abort all the
 	 * reads and writes until all files have been closed and
-	 * re-opened
+	 * re-opened.
 	 */
 	if (__predict_false(
 	(periph->periph_flags & PERIPH_MEDIA_LOADED) == 0)) {



CVS commit: src/games/cgram

2021-05-27 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Fri May 28 03:55:46 UTC 2021

Modified Files:
src/games/cgram: cgram.c

Log Message:
I don't see any code I wrote left in here.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/games/cgram/cgram.c

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

Modified files:

Index: src/games/cgram/cgram.c
diff -u src/games/cgram/cgram.c:1.24 src/games/cgram/cgram.c:1.25
--- src/games/cgram/cgram.c:1.24	Fri May 28 03:55:08 2021
+++ src/games/cgram/cgram.c	Fri May 28 03:55:45 2021
@@ -1,11 +1,11 @@
-/* $NetBSD: cgram.c,v 1.24 2021/05/28 03:55:08 dholland Exp $ */
+/* $NetBSD: cgram.c,v 1.25 2021/05/28 03:55:45 dholland Exp $ */
 
 /*-
  * Copyright (c) 2013, 2021 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
- * by David A. Holland and Roland Illig.
+ * by Roland Illig.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.c,v 1.24 2021/05/28 03:55:08 dholland Exp $");
+__RCSID("$NetBSD: cgram.c,v 1.25 2021/05/28 03:55:45 dholland Exp $");
 #endif
 
 #include 



CVS commit: src/games/cgram

2021-05-27 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Fri May 28 03:55:08 UTC 2021

Modified Files:
src/games/cgram: cgram.c

Log Message:
Restore return value of main, arbitrarily thrown away in -r1.4.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/games/cgram/cgram.c

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

Modified files:

Index: src/games/cgram/cgram.c
diff -u src/games/cgram/cgram.c:1.23 src/games/cgram/cgram.c:1.24
--- src/games/cgram/cgram.c:1.23	Sat May  1 20:29:23 2021
+++ src/games/cgram/cgram.c	Fri May 28 03:55:08 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: cgram.c,v 1.23 2021/05/01 20:29:23 rillig Exp $ */
+/* $NetBSD: cgram.c,v 1.24 2021/05/28 03:55:08 dholland Exp $ */
 
 /*-
  * Copyright (c) 2013, 2021 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.c,v 1.23 2021/05/01 20:29:23 rillig Exp $");
+__RCSID("$NetBSD: cgram.c,v 1.24 2021/05/28 03:55:08 dholland Exp $");
 #endif
 
 #include 
@@ -612,4 +612,5 @@ main(int argc, char *argv[])
 	init(argc > 1 ? argv[1] : NULL);
 	loop();
 	done();
+	return 0;
 }



CVS commit: src/sys/arch

2021-05-23 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun May 23 23:22:55 UTC 2021

Modified Files:
src/sys/arch/mips/mips: db_disasm.c db_interface.c
src/sys/arch/riscv/riscv: db_disasm.c db_machdep.c

Log Message:
Improve ddb disassembly for mips (and riscv, cribbed from mips).

- use db_read_bytes to get instructions
- move the address check logic previously attached only to fetching
  instructions for disassembly to db_read_bytes (and db_write_bytes)

Motivated by related x86 changes this afternoon.

Note that the address check logic is not as sophisticated as what the
x86 code does, but it's what we had before. (Except that riscv will
now also try to fetch usermode instructions instead of just failing.)


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/mips/mips/db_disasm.c
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/mips/mips/db_interface.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/riscv/riscv/db_disasm.c \
src/sys/arch/riscv/riscv/db_machdep.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/mips/mips/db_disasm.c
diff -u src/sys/arch/mips/mips/db_disasm.c:1.42 src/sys/arch/mips/mips/db_disasm.c:1.43
--- src/sys/arch/mips/mips/db_disasm.c:1.42	Mon Apr 12 11:35:22 2021
+++ src/sys/arch/mips/mips/db_disasm.c	Sun May 23 23:22:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.42 2021/04/12 11:35:22 simonb Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.43 2021/05/23 23:22:55 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.42 2021/04/12 11:35:22 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.43 2021/05/23 23:22:55 dholland Exp $");
 
 #include 
 #include 
@@ -47,6 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: db_disasm.c,
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -218,11 +219,6 @@ static void print_addr(db_addr_t);
  * "next instruction" does NOT mean the next instruction to
  * be executed but the 'linear' next instruction.
  */
-#ifdef _LP64
-#define	DISASM_KERN_START	MIPS_XKSEG_START
-#else
-#define	DISASM_KERN_START	MIPS_KSEG0_START
-#endif
 db_addr_t
 db_disasm(db_addr_t loc, bool altfmt)
 {
@@ -232,19 +228,14 @@ db_disasm(db_addr_t loc, bool altfmt)
 	 * Take some care with addresses to not UTLB here as it
 	 * loses the current debugging context.  KSEG2 and XKSEG
 	 * are not checked.
+	 * Update: db_read_bytes is supposed to do that, and now
+	 * does, so we can use that.
+	 *
+	 * XXX db_read_bytes_can't return failure but instead zeros
+	 * the output. That's ok here, but if ever improved the
+	 * proper thing here on error is to return the original loc.
 	 */
-	if (loc < (db_addr_t)DISASM_KERN_START) {
-#ifdef _KERNEL
-		if (ufetch_32((void *)loc, ) != 0) {
-			db_printf("invalid address.\n");
-			return loc;
-		}
-#else
-		return loc;
-#endif
-	} else {
-		instr =  *(uint32_t *)loc;
-	}
+	db_read_bytes(loc, sizeof(instr), (void *));
 
 	return (db_disasm_insn(instr, loc, altfmt));
 }

Index: src/sys/arch/mips/mips/db_interface.c
diff -u src/sys/arch/mips/mips/db_interface.c:1.93 src/sys/arch/mips/mips/db_interface.c:1.94
--- src/sys/arch/mips/mips/db_interface.c:1.93	Mon Apr 12 02:23:41 2021
+++ src/sys/arch/mips/mips/db_interface.c	Sun May 23 23:22:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.93 2021/04/12 02:23:41 mrg Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.94 2021/05/23 23:22:55 dholland Exp $	*/
 
 /*
  * Mach Operating System
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.93 2021/04/12 02:23:41 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.94 2021/05/23 23:22:55 dholland Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_multiprocessor.h"
@@ -180,6 +180,23 @@ void
 db_read_bytes(vaddr_t addr, size_t size, char *data)
 {
 	const char *src = (char *)addr;
+	int err;
+
+	/*
+	 * If asked to fetch from userspace, do it safely.
+	 * Note that MIPS_KSEG0_START is the proper address for
+	 * both 32-bit and 64-bit kernels.
+	 */
+	if (addr < (vaddr_t)MIPS_KSEG0_START) {
+		err = copyin(src, data, size);
+		if (err) {
+#ifdef DDB
+			db_printf("address %p is invalid\n", src);
+#endif
+			memset(data, 0, size);
+		}
+		return;
+	}
 
 	if (size <= 8 && (size & (size-1)) == 0 && (addr & (size-1)) == 0
 	&& ((uintptr_t)data & (size-1)) == 0) {
@@ -205,6 +222,18 @@ db_write_bytes(vaddr_t addr, size_t size
 {
 	char *p = (char *)addr;
 	size_t n = size;
+	int err;
+
+	/* If asked to fetch from userspace, do it safely */
+	if (addr < (vaddr_t)MIPS_KSEG0_START) {
+		err = copyout(data, p, size);
+		if (err) {
+#ifdef DDB
+			db_printf("address %p is invalid\n", p);
+#endif
+		}
+		return;
+	}
 
 	if (size <= 8 && (size & (size-1)) == 0 && (addr & (size-1)) == 0
 	&& ((uintptr_t)data & (size-1)) == 0) {

Index: src/sys/arch/riscv/riscv/db_disasm.c
diff -u 

CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb

2021-05-18 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue May 18 20:34:20 UTC 2021

Modified Files:
src/sys/arch/amiga/stand/bootblock/elf2bb: elf2bb.c

Log Message:
Remove some unused variables, found by gcc -Wall.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c

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

Modified files:

Index: src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c
diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.19 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.20
--- src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.19	Tue May 18 20:32:18 2021
+++ src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c	Tue May 18 20:34:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf2bb.c,v 1.19 2021/05/18 20:32:18 dholland Exp $	*/
+/*	$NetBSD: elf2bb.c,v 1.20 2021/05/18 20:34:20 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1996,2006 The NetBSD Foundation, Inc.
@@ -92,7 +92,6 @@ int
 main(int argc, char *argv[])
 {
 	int ifd, ofd;
-	u_int mid, flags, magic;
 	void *image;
 	Elf32_Ehdr *eh;
 	Elf32_Shdr *sh;
@@ -104,7 +103,7 @@ main(int argc, char *argv[])
 	int i, l, delta;
 	u_int8_t *rpo;
 	u_int32_t oldaddr, addrdiff;
-	u_int32_t tsz, dsz, bsz, trsz, drsz, entry, relver;
+	u_int32_t tsz, dsz, bsz, trsz, relver;
 	u_int32_t pcrelsz, r32sz;
 	int sumsize = 16;
 	int c;



CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb

2021-05-18 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue May 18 20:32:18 UTC 2021

Modified Files:
src/sys/arch/amiga/stand/bootblock/elf2bb: elf2bb.c

Log Message:
Print ptrdiff_t with %td, not %d. Appeared in passing in PR 56188.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c

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

Modified files:

Index: src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c
diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.18 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.19
--- src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.18	Thu Feb 25 03:40:27 2021
+++ src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c	Tue May 18 20:32:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf2bb.c,v 1.18 2021/02/25 03:40:27 rin Exp $	*/
+/*	$NetBSD: elf2bb.c,v 1.19 2021/05/18 20:32:18 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1996,2006 The NetBSD Foundation, Inc.
@@ -421,7 +421,7 @@ retry:
 	*rpo = 0; rpo += delta;
 	*rpo = 0; rpo += delta;
 
-	printf("using %d bytes, %d bytes remaining.\n", delta > 0 ?
+	printf("using %td bytes, %td bytes remaining.\n", delta > 0 ?
 	rpo-buffer-tsz-dsz : buffer+bbsize-rpo, delta > 0 ?
 	buffer + bbsize - rpo : rpo - buffer - tsz - dsz);
 	/*



CVS commit: src/sys/arch/riscv

2021-04-19 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Apr 19 07:55:59 UTC 2021

Modified Files:
src/sys/arch/riscv/include: insn.h
src/sys/arch/riscv/riscv: db_disasm.c

Log Message:
Make the riscv disassembler work, as best as I can test from amd64 userspace.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/riscv/include/insn.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/riscv/riscv/db_disasm.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/riscv/include/insn.h
diff -u src/sys/arch/riscv/include/insn.h:1.3 src/sys/arch/riscv/include/insn.h:1.4
--- src/sys/arch/riscv/include/insn.h:1.3	Wed Apr 14 06:32:20 2021
+++ src/sys/arch/riscv/include/insn.h	Mon Apr 19 07:55:59 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: insn.h,v 1.3 2021/04/14 06:32:20 dholland Exp $ */
+/* $NetBSD: insn.h,v 1.4 2021/04/19 07:55:59 dholland Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -241,16 +241,16 @@ union riscv_insn {
  * Quadrant 1 goes FUNCT3 -> FUNCT2a -> FUNCT3b,
  * Quadrant 2 goes FUNCT3 -> FUNCT1b.
  */
-#define INSN16_FUNCT3(insn)	(((insn) && 0xe000) >> 13)
-#define INSN16_FUNCT2a(insn)	(((insn) && 0x0c00) >> 10)
-#define INSN16_FUNCT1b(insn)	(((insn) && 0x1000) >> 12)
-#define INSN16_FUNCT2b(insn)	(((insn) && 0x0060) >> 5)
+#define INSN16_FUNCT3(insn)	(((insn) & 0xe000) >> 13)
+#define INSN16_FUNCT2a(insn)	(((insn) & 0x0c00) >> 10)
+#define INSN16_FUNCT1b(insn)	(((insn) & 0x1000) >> 12)
+#define INSN16_FUNCT2b(insn)	(((insn) & 0x0060) >> 5)
 #define INSN16_FUNCT3c(insn)	\
 	((INSN16_FUNCT1b(insn) << 2) | INSN16_FUNCT2b(insn))
 
 /* full-size register fields */
 #define INSN16_RS1(insn)	(((insn) & 0x0f80) >> 7)  /* bits 7-11 */
-#define INSN16_RS2(insn)	(((insn) & 0x007c) >> 7)  /* bits 2-6 */
+#define INSN16_RS2(insn)	(((insn) & 0x007c) >> 2)  /* bits 2-6 */
 
 /* small register fields, for registers 8-15 */
 #define INSN16_RS1x(insn)	insn) & 0x0380) >> 7) + 8)	/* bits 7-9 */
@@ -422,6 +422,12 @@ union riscv_insn {
 #define OPFP_D			0b01
 #define OPFP_Q			0b11
 
+// in some instructions they're an integer operand size instead
+#define OPFP_W			0b00
+#define OPFP_WU			0b01
+#define OPFP_L			0b10
+#define OPFP_LU			0b11
+
 // primary is AMO (0b01011, 11), top 5 bits
 // (bottom two bits are ACQUIRE and RELEASE flags respectively)
 // funct3 gives the operand size
@@ -644,7 +650,7 @@ union riscv_insn {
 
 #define OPCODE16_Q0	0b00	/* quadrant 0 */
 #define OPCODE16_Q1	0b01	/* quadrant 1 */
-#define OPCODE16_Q2	0b11	/* quadrant 2 */
+#define OPCODE16_Q2	0b10	/* quadrant 2 */
 
 /* quadrant 0 */
 #define Q0_ADDI4SPN	0b000

Index: src/sys/arch/riscv/riscv/db_disasm.c
diff -u src/sys/arch/riscv/riscv/db_disasm.c:1.3 src/sys/arch/riscv/riscv/db_disasm.c:1.4
--- src/sys/arch/riscv/riscv/db_disasm.c:1.3	Wed Apr 14 06:32:20 2021
+++ src/sys/arch/riscv/riscv/db_disasm.c	Mon Apr 19 07:55:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.3 2021/04/14 06:32:20 dholland Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.4 2021/04/19 07:55:59 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__RCSID("$NetBSD: db_disasm.c,v 1.3 2021/04/14 06:32:20 dholland Exp $");
+__RCSID("$NetBSD: db_disasm.c,v 1.4 2021/04/19 07:55:59 dholland Exp $");
 
 #include 
 #include 
@@ -65,6 +65,11 @@ db_print_addr(db_addr_t loc)
 	db_sym_t sym;
 	const char *symname;
 
+/* hack for testing since the test program is ASLR'd */
+#ifndef _KERNEL
+	loc &= 0xfff;
+#endif
+
 	diff = INT_MAX;
 	symname = NULL;
 	sym = db_search_symbol(loc, DB_STGY_ANY, );
@@ -101,6 +106,30 @@ db_print_addr(db_addr_t loc)
 #define IN_Q1(op) COMBINE(op, OPCODE16_Q1)
 #define IN_Q2(op) COMBINE(op, OPCODE16_Q2)
 
+/*
+ * All the 16-bit immediate bit-wrangling is done in uint32_t, which
+ * is sufficient, but on RV64 the resulting values should be printed
+ * as 64-bit. Continuing the assumption that we're disassembling for
+ * the size we're built on, do nothing for RV32 and sign-extend from
+ * 32 to 64 for RV64. (And bail on RV128 since it's not clear what
+ * the C type sizes are going to be there anyway...)
+ */
+static
+unsigned long
+maybe_signext64(uint32_t x)
+{
+#if __riscv_xlen == 32
+	return x;
+#elif __riscv_xlen == 64
+	uint64_t xx;
+
+	xx = ((x & 0x8000) ? 0x : 0) | x;
+	return xx;
+#else
+#error Oops.
+#endif
+}
+
 static
 int
 db_disasm_16(db_addr_t loc, uint32_t insn, bool altfmt)
@@ -110,10 +139,15 @@ db_disasm_16(db_addr_t loc, uint32_t ins
 	uint32_t imm;
 	unsigned rd, rs1, rs2;
 
+	//warnx("toot 0x%x", insn);
 	switch (COMBINE(INSN16_FUNCT3(insn), INSN16_QUADRANT(insn))) {
 	case IN_Q0(Q0_ADDI4SPN):
 		rd = INSN16_RS2x(insn);
 		imm = INSN16_IMM_CIW(insn);
+		if (imm == 0) {
+			/* reserved (all bits 0 -> invalid) */
+			return EINVAL;
+		}
 		db_printf("c.addi4spn %s, 0x%x\n", riscv_registers[rd], imm);
 		break;
 	case 

CVS commit: src/sys/arch/riscv

2021-04-14 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Apr 14 06:32:20 UTC 2021

Modified Files:
src/sys/arch/riscv/include: db_machdep.h insn.h
src/sys/arch/riscv/riscv: db_disasm.c db_machdep.c

Log Message:
Add a ddb disassembler for riscv.

builds, but not really tested yet.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/riscv/include/db_machdep.h \
src/sys/arch/riscv/include/insn.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/riscv/riscv/db_disasm.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/riscv/riscv/db_machdep.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/riscv/include/db_machdep.h
diff -u src/sys/arch/riscv/include/db_machdep.h:1.2 src/sys/arch/riscv/include/db_machdep.h:1.3
--- src/sys/arch/riscv/include/db_machdep.h:1.2	Mon Nov  6 03:47:48 2017
+++ src/sys/arch/riscv/include/db_machdep.h	Wed Apr 14 06:32:20 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.h,v 1.2 2017/11/06 03:47:48 christos Exp $ */
+/* $NetBSD: db_machdep.h,v 1.3 2021/04/14 06:32:20 dholland Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -62,6 +62,17 @@ extern const uint32_t __cpu_Debugger_ins
 #define	BKPT_SIZE	(sizeof(uint32_t))	/* size of breakpoint inst */
 #define	BKPT_SET(inst, addr)	(BKPT_INST)
 
+/*
+ * XXX with the C extension there's also a 16-bit-wide breakpoint
+ * instruction, the idea being that you use it when inserting a
+ * breakpoint into a stream of 16-bit instructions, but it looks like
+ * MI ddb can't cope with having two sizes :-(
+ */
+#if 0
+#define BKPT_INST_2	0x9002
+#define BKPT_SIZE_2	(sizeof(uint16_t))
+#endif
+
 #define	IS_BREAKPOINT_TRAP(type, code)	((type) == CAUSE_BREAKPOINT)
 #define IS_WATCHPOINT_TRAP(type, code)	(0)
 
Index: src/sys/arch/riscv/include/insn.h
diff -u src/sys/arch/riscv/include/insn.h:1.2 src/sys/arch/riscv/include/insn.h:1.3
--- src/sys/arch/riscv/include/insn.h:1.2	Wed Nov  4 07:09:45 2020
+++ src/sys/arch/riscv/include/insn.h	Wed Apr 14 06:32:20 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: insn.h,v 1.2 2020/11/04 07:09:45 skrll Exp $ */
+/* $NetBSD: insn.h,v 1.3 2021/04/14 06:32:20 dholland Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -32,8 +32,14 @@
 #ifndef _RISCV_INSN_H_
 #define _RISCV_INSN_H_
 
+/*
+ * I have corrected and updated this, but it's the wrong way to do it.
+ * It's still used by ddb_machdep.c but that code should be fixed to
+ * use the newer stuff below. - dholland
+ */
 union riscv_insn {
 	uint32_t val;
+	/* register ops */
 	struct {
 		unsigned int r_opcode : 7;
 		unsigned int r_rd : 5;
@@ -42,14 +48,26 @@ union riscv_insn {
 		unsigned int r_rs2 : 5;
 		unsigned int r_funct7 : 7;
 	} type_r;
+	/* 32-bit shifts */
+	struct {
+		unsigned int rs32_opcode : 7;
+		unsigned int rs32_rd : 5;
+		unsigned int rs32_funct3 : 3;
+		unsigned int rs32_rs1 : 5;
+		unsigned int rs32_shamt : 5;
+		unsigned int rs32_funct7 : 7;
+	} type_rs32;
+	/* 64-bit shifts */
 	struct {
-		unsigned int rs_opcode : 7;
-		unsigned int rs_rd : 5;
-		unsigned int rs_funct3 : 3;
-		unsigned int rs_rs1 : 5;
-		unsigned int rs_shmat : 6;
-		unsigned int rs_funct6 : 6;
-	} type_rs;
+		unsigned int rs64_opcode : 7;
+		unsigned int rs64_rd : 5;
+		unsigned int rs64_funct3 : 3;
+		unsigned int rs64_rs1 : 5;
+		unsigned int rs64_shamt : 6;
+		unsigned int rs64_zero : 1;
+		unsigned int rs64_funct5 : 5;
+	} type_rs64;
+	/* atomics */
 	struct {
 		unsigned int ra_opcode : 7;
 		unsigned int ra_rd : 5;
@@ -58,17 +76,29 @@ union riscv_insn {
 		unsigned int ra_rs2 : 5;
 		unsigned int ra_rl : 1;
 		unsigned int ra_aq : 1;
-		unsigned int ra_funct5 : 6;
+		unsigned int ra_funct5 : 5;
 	} type_ra;
+	/* certain fpu ops */
 	struct {
 		unsigned int rf_opcode : 7;
 		unsigned int rf_rd : 5;
 		unsigned int rf_rm : 3;
 		unsigned int rf_rs1 : 5;
 		unsigned int rf_rs2 : 5;
-		unsigned int rf_funct2 : 2;
-		unsigned int rf_rs3 : 5;
+		unsigned int rf_size : 2;
+		unsigned int rf_funct5 : 5;
 	} type_rf;
+	/* other fpu ops */
+	struct {
+		unsigned int rf4_opcode : 7;
+		unsigned int rf4_rd : 5;
+		unsigned int rf4_rm : 3;
+		unsigned int rf4_rs1 : 5;
+		unsigned int rf4_rs2 : 5;
+		unsigned int rf4_size : 2;
+		unsigned int rf4_rs3 : 5;
+	} type_rf4;
+	/* immediates */
 	struct {
 		unsigned int i_opcode : 7;
 		unsigned int i_rd : 5;
@@ -76,6 +106,7 @@ union riscv_insn {
 		unsigned int i_rs1 : 5;
 		signed int i_imm11to0 : 12;
 	} type_i;
+	/* stores */
 	struct {
 		unsigned int s_opcode : 7;
 		unsigned int s_imm4_to_0 : 5;
@@ -84,33 +115,241 @@ union riscv_insn {
 		unsigned int s_rs2 : 5;
 		signed int s_imm11_to_5 : 7;
 	} type_s;
+	/* branches */
 	struct {
-		unsigned int sb_opcode : 7;
-		unsigned int sb_imm11 : 1;
-		unsigned int sb_imm4to1 : 4;
-		unsigned int sb_funct3 : 3;
-		unsigned int sb_rs1 : 5;
-		unsigned int sb_rs2 : 5;
-		unsigned int sb_imm10to5 : 6;
-		signed int sb_imm12 : 1;
-	} type_sb;

CVS commit: src/lib/libc/sys

2021-03-27 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Mar 28 03:29:32 UTC 2021

Modified Files:
src/lib/libc/sys: bind.2 connect.2 send.2

Log Message:
Document EINVAL for out of range socket address lengths.

This is what happens, but wasn't documented. Applies to bind(2),
connect(2), and send(2).


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/lib/libc/sys/bind.2
cvs rdiff -u -r1.28 -r1.29 src/lib/libc/sys/connect.2
cvs rdiff -u -r1.32 -r1.33 src/lib/libc/sys/send.2

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/sys/bind.2
diff -u src/lib/libc/sys/bind.2:1.30 src/lib/libc/sys/bind.2:1.31
--- src/lib/libc/sys/bind.2:1.30	Mon Jul  3 21:32:50 2017
+++ src/lib/libc/sys/bind.2	Sun Mar 28 03:29:31 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: bind.2,v 1.30 2017/07/03 21:32:50 wiz Exp $
+.\"	$NetBSD: bind.2,v 1.31 2021/03/28 03:29:31 dholland Exp $
 .\"
 .\" Copyright (c) 1983, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)bind.2	8.1 (Berkeley) 6/4/93
 .\"
-.Dd April 5, 2015
+.Dd March 27, 2021
 .Dt BIND 2
 .Os
 .Sh NAME
@@ -99,6 +99,8 @@ The socket is already bound to an addres
 the family of the socket and that requested in
 .Fa name->sa_family
 are not equivalent.
+.It Bq Er EINVAL
+The socket address length passed was outside the allowable range.
 .It Bq Er ENOTSOCK
 .Fa s
 is not a socket.

Index: src/lib/libc/sys/connect.2
diff -u src/lib/libc/sys/connect.2:1.28 src/lib/libc/sys/connect.2:1.29
--- src/lib/libc/sys/connect.2:1.28	Mon May 31 12:16:20 2010
+++ src/lib/libc/sys/connect.2	Sun Mar 28 03:29:31 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: connect.2,v 1.28 2010/05/31 12:16:20 njoly Exp $
+.\"	$NetBSD: connect.2,v 1.29 2021/03/28 03:29:31 dholland Exp $
 .\"
 .\" Copyright (c) 1983, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)connect.2	8.1 (Berkeley) 6/4/93
 .\"
-.Dd May 18, 2004
+.Dd March 27, 2021
 .Dt CONNECT 2
 .Os
 .Sh NAME
@@ -97,6 +97,8 @@ is not a valid descriptor.
 .It Bq Er ENOTSOCK
 .Fa s
 is a descriptor for a file, not a socket.
+.It Bq Er EINVAL
+The socket address length passed was outside the allowable range.
 .It Bq Er EADDRNOTAVAIL
 The specified address is not available on this machine.
 .It Bq Er EAFNOSUPPORT

Index: src/lib/libc/sys/send.2
diff -u src/lib/libc/sys/send.2:1.32 src/lib/libc/sys/send.2:1.33
--- src/lib/libc/sys/send.2:1.32	Sun Jun 11 17:01:26 2017
+++ src/lib/libc/sys/send.2	Sun Mar 28 03:29:31 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: send.2,v 1.32 2017/06/11 17:01:26 abhinav Exp $
+.\"	$NetBSD: send.2,v 1.33 2021/03/28 03:29:31 dholland Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)send.2	8.2 (Berkeley) 2/21/94
 .\"
-.Dd June 22, 2012
+.Dd March 27, 2021
 .Dt SEND 2
 .Os
 .Sh NAME
@@ -217,6 +217,8 @@ The destination for the message is unrea
 .It Bq Er EINVAL
 The total length of the I/O is more than can be expressed by the ssize_t
 return value.
+.It Bq Er EINVAL
+The socket address length passed was outside the allowable range.
 .It Bq Er EMSGSIZE
 The socket requires that message be sent atomically,
 and the size of the message to be sent made this impossible.



CVS commit: src/lib/libc/sys

2021-03-27 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Mar 27 23:35:37 UTC 2021

Modified Files:
src/lib/libc/sys: getvfsstat.2

Log Message:
In getvfsstat(2), clarify that the size argument is in bytes.

That the size argument is in bytes (not the count of structures) and
the return value is the count of structures (not bytes) is
counterintuitive.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/sys/getvfsstat.2

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/sys/getvfsstat.2
diff -u src/lib/libc/sys/getvfsstat.2:1.3 src/lib/libc/sys/getvfsstat.2:1.4
--- src/lib/libc/sys/getvfsstat.2:1.3	Fri May 19 17:59:28 2006
+++ src/lib/libc/sys/getvfsstat.2	Sat Mar 27 23:35:37 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: getvfsstat.2,v 1.3 2006/05/19 17:59:28 tsutsui Exp $
+.\"	$NetBSD: getvfsstat.2,v 1.4 2021/03/27 23:35:37 dholland Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)getvfsstat.2	8.3 (Berkeley) 5/25/95
 .\"
-.Dd May 19, 2006
+.Dd March 27, 2021
 .Dt GETVFSSTAT 2
 .Os
 .Sh NAME
@@ -79,6 +79,12 @@ Thus, some of the information will be ou
 .Fn getvfsstat
 will not block waiting for information from a file system that is
 unable to respond.
+.Pp
+Note that
+.Fa bufsize
+is the size of the buffer in bytes, not the count of structures that
+will fit in it, and the return value is the count of structures, not
+the size.
 .Sh RETURN VALUES
 Upon successful completion, the number of
 .Fa statvfs



CVS commit: src/lib/libc/sys

2021-03-17 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Mar 17 08:04:39 UTC 2021

Modified Files:
src/lib/libc/sys: open.2

Log Message:
Clarify use of open flags in open(2).

(Avoid using values of three that are equal to four.)


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/lib/libc/sys/open.2

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/sys/open.2
diff -u src/lib/libc/sys/open.2:1.63 src/lib/libc/sys/open.2:1.64
--- src/lib/libc/sys/open.2:1.63	Mon Nov 30 00:21:35 2020
+++ src/lib/libc/sys/open.2	Wed Mar 17 08:04:39 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: open.2,v 1.63 2020/11/30 00:21:35 riastradh Exp $
+.\"	$NetBSD: open.2,v 1.64 2021/03/17 08:04:39 dholland Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)open.2	8.2 (Berkeley) 11/16/93
 .\"
-.Dd September 16, 2019
+.Dd March 17, 2021
 .Dt OPEN 2
 .Os
 .Sh NAME
@@ -103,7 +103,7 @@ The
 are specified by
 .Em or Ns 'ing
 the values listed below.
-Applications must specify exactly one of the first three values
+Applications must specify exactly one of the these four values
 (file access methods):
 .Bl -tag -offset indent -width O_DIRECTORY
 .It Dv O_RDONLY
@@ -116,7 +116,7 @@ Open for execute only.
 Open for reading and writing.
 .El
 .Pp
-Any combination of the following may be used:
+Any combination of the following may be used as well:
 .Bl -tag -offset indent -width O_DIRECTORY
 .It Dv O_NONBLOCK
 Do not block on open or for data to become available.



CVS commit: src/lib/libc/gen

2021-02-17 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Feb 17 23:51:04 UTC 2021

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

Log Message:
Document that rewinddir(3) might either reopen or just lseek the dir.

(Currently it depends on the underlying directory, but documenting the
exact details seems inadvisable.)

Also, Someone(TM) should check if POSIX permits this or if we ought to
improve the implementation.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/lib/libc/gen/directory.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/directory.3
diff -u src/lib/libc/gen/directory.3:1.42 src/lib/libc/gen/directory.3:1.43
--- src/lib/libc/gen/directory.3:1.42	Wed Feb 17 23:39:46 2021
+++ src/lib/libc/gen/directory.3	Wed Feb 17 23:51:04 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: directory.3,v 1.42 2021/02/17 23:39:46 dholland Exp $
+.\"	$NetBSD: directory.3,v 1.43 2021/02/17 23:51:04 dholland Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)directory.3	8.1 (Berkeley) 6/4/93
 .\"
-.Dd January 22, 2016
+.Dd February 17, 2021
 .Dt DIRECTORY 3
 .Os
 .Sh NAME
@@ -225,6 +225,15 @@ It also causes the directory stream to r
 current state of the corresponding directory, as if a call to
 .Fn opendir
 was made.
+It is not specified whether this refers to the ``corresponding directory''
+by name or by underlying object.
+(These can differ if
+.Xr rename 2
+has been used.)
+.\" Note: currently the underlying fd is reopened if and only if
+.\" __DTF_READALL is in effect, which is true for union mounts and
+.\" nfs; documenting that exactly seems inadvisable since it might
+.\" change.  -- dholland 20210217
 .Pp
 If
 .Fa dirp



CVS commit: src/lib/libc/gen

2021-02-17 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Feb 17 23:39:46 UTC 2021

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

Log Message:
Fix some typos/malapropisms in directory(3).


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/lib/libc/gen/directory.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/directory.3
diff -u src/lib/libc/gen/directory.3:1.41 src/lib/libc/gen/directory.3:1.42
--- src/lib/libc/gen/directory.3:1.41	Mon Jul  3 21:32:49 2017
+++ src/lib/libc/gen/directory.3	Wed Feb 17 23:39:46 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: directory.3,v 1.41 2017/07/03 21:32:49 wiz Exp $
+.\"	$NetBSD: directory.3,v 1.42 2021/02/17 23:39:46 dholland Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -224,7 +224,7 @@ stream to the beginning of the directory
 It also causes the directory stream to refer to the
 current state of the corresponding directory, as if a call to
 .Fn opendir
-would have been made.
+was made.
 .Pp
 If
 .Fa dirp
@@ -281,7 +281,7 @@ return (NOT_FOUND);
 .Sh COMPATIBILITY
 The described directory operations have traditionally been problematic
 in terms of portability.
-A good example is the semantics around
+A good example is the semantics of
 .Sq \&.
 (dot) and
 .Sq \&..
@@ -313,7 +313,7 @@ When a file descriptor is used to implem
 function behaves as if the
 .Dv FD_CLOEXEC
 had been set for the file descriptor.
-In another words, it is mandatory that
+In other words, it is mandatory that
 .Fn closedir
 deallocates the file descriptor.
 .It
@@ -344,9 +344,9 @@ occurred between the calls to
 .Fn telldir
 and
 .Fn seekdir ,
-any subsequent call to
+the results of any subsequent call to
 .Fn readdir
-is unspecified, possibly resulting in undefined behavior.
+are unspecified, possibly resulting in undefined behavior.
 .It
 After a call to
 .Xr fork 2 ,



CVS commit: src/lib/libc/sys

2021-02-17 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Feb 17 17:43:09 UTC 2021

Modified Files:
src/lib/libc/sys: fsync.2

Log Message:
Document more EINVAL cases for fsync_range.

Corresponds to previous code fix.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/lib/libc/sys/fsync.2

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/sys/fsync.2
diff -u src/lib/libc/sys/fsync.2:1.19 src/lib/libc/sys/fsync.2:1.20
--- src/lib/libc/sys/fsync.2:1.19	Sat Feb 13 06:24:08 2021
+++ src/lib/libc/sys/fsync.2	Wed Feb 17 17:43:09 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: fsync.2,v 1.19 2021/02/13 06:24:08 dholland Exp $
+.\"	$NetBSD: fsync.2,v 1.20 2021/02/17 17:43:09 dholland Exp $
 .\"
 .\" Copyright (c) 1983, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)fsync.2	8.1 (Berkeley) 6/4/93
 .\"
-.Dd February 12, 2021
+.Dd February 17, 2021
 .Dt FSYNC 2
 .Os
 .Sh NAME
@@ -159,10 +159,13 @@ fails if:
 is not open for writing.
 .It Bq Er EINVAL
 .Fa start
+is less than zero, or
+.Fa start
 +
 .Fa length
 is less than
-.Fa start .
+.Fa start
+or triggers an integer overflow.
 .It Bq Er EINVAL
 .Fa how
 contains an invalid value.



CVS commit: src/sys/kern

2021-02-17 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Feb 17 17:39:08 UTC 2021

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

Log Message:
Don't allow callers of fsync_range() to trigger UB in the kernel.

(also prohibit syncing ranges at start offsets less than zero)


To generate a diff of this commit:
cvs rdiff -u -r1.548 -r1.549 src/sys/kern/vfs_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/kern/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.548 src/sys/kern/vfs_syscalls.c:1.549
--- src/sys/kern/vfs_syscalls.c:1.548	Sat May 16 18:31:50 2020
+++ src/sys/kern/vfs_syscalls.c	Wed Feb 17 17:39:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.548 2020/05/16 18:31:50 christos Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.549 2021/02/17 17:39:08 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009, 2019, 2020 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.548 2020/05/16 18:31:50 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.549 2021/02/17 17:39:08 dholland Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -4198,11 +4198,12 @@ sys_fsync_range(struct lwp *l, const str
 	/* If length == 0, we do the whole file, and s = e = 0 will do that */
 	if (len) {
 		s = SCARG(uap, start);
-		e = s + len;
-		if (e < s) {
+		if (s < 0 || len < 0 || len > OFF_T_MAX - s) {
 			error = EINVAL;
 			goto out;
 		}
+		e = s + len;
+		KASSERT(s <= e);
 	} else {
 		e = 0;
 		s = 0;



CVS commit: src/lib/libc/sys

2021-02-12 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Feb 13 06:24:08 UTC 2021

Modified Files:
src/lib/libc/sys: fsync.2

Log Message:
Document EINVAL for invalid flags given to fsync_range().


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/lib/libc/sys/fsync.2

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/sys/fsync.2
diff -u src/lib/libc/sys/fsync.2:1.18 src/lib/libc/sys/fsync.2:1.19
--- src/lib/libc/sys/fsync.2:1.18	Sun Sep 22 10:02:05 2013
+++ src/lib/libc/sys/fsync.2	Sat Feb 13 06:24:08 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: fsync.2,v 1.18 2013/09/22 10:02:05 apb Exp $
+.\"	$NetBSD: fsync.2,v 1.19 2021/02/13 06:24:08 dholland Exp $
 .\"
 .\" Copyright (c) 1983, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)fsync.2	8.1 (Berkeley) 6/4/93
 .\"
-.Dd September 22, 2013
+.Dd February 12, 2021
 .Dt FSYNC 2
 .Os
 .Sh NAME
@@ -163,6 +163,9 @@ is not open for writing.
 .Fa length
 is less than
 .Fa start .
+.It Bq Er EINVAL
+.Fa how
+contains an invalid value.
 .El
 .Sh NOTES
 For optimal efficiency, the



CVS commit: src/lib/libc/sys

2021-02-08 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Feb  9 01:12:01 UTC 2021

Modified Files:
src/lib/libc/sys: poll.2

Log Message:
Document in poll(2) that poll first appeared in NetBSD in NetBSD 1.3.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/lib/libc/sys/poll.2

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/sys/poll.2
diff -u src/lib/libc/sys/poll.2:1.35 src/lib/libc/sys/poll.2:1.36
--- src/lib/libc/sys/poll.2:1.35	Tue Feb  9 01:01:31 2021
+++ src/lib/libc/sys/poll.2	Tue Feb  9 01:12:01 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: poll.2,v 1.35 2021/02/09 01:01:31 dholland Exp $
+.\"	$NetBSD: poll.2,v 1.36 2021/02/09 01:12:01 dholland Exp $
 .\"
 .\" Copyright (c) 1998, 2005, 2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -272,7 +272,9 @@ file descriptor resource limit.
 The
 .Fn poll
 function appeared in
-.At V.3 .
+.At V.3 ,
+and was added to NetBSD in
+.Nx 1.3 .
 The
 .Fn pollts
 function first appeared in



CVS commit: src/lib/libc/sys

2021-02-08 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Feb  9 01:01:31 UTC 2021

Modified Files:
src/lib/libc/sys: poll.2

Log Message:
typo in previous.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/lib/libc/sys/poll.2

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/sys/poll.2
diff -u src/lib/libc/sys/poll.2:1.34 src/lib/libc/sys/poll.2:1.35
--- src/lib/libc/sys/poll.2:1.34	Tue Feb  9 00:50:47 2021
+++ src/lib/libc/sys/poll.2	Tue Feb  9 01:01:31 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: poll.2,v 1.34 2021/02/09 00:50:47 dholland Exp $
+.\"	$NetBSD: poll.2,v 1.35 2021/02/09 01:01:31 dholland Exp $
 .\"
 .\" Copyright (c) 1998, 2005, 2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -85,7 +85,7 @@ wait for any file descriptor to become r
 If
 .Fa timeout
 is INFTIM (\-1), then
-.Pn poll
+.Fn poll
 blocks indefinitely.
 If
 .Fa timeout



CVS commit: src/lib/libc/sys

2021-02-08 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Feb  9 00:50:48 UTC 2021

Modified Files:
src/lib/libc/sys: poll.2

Log Message:
Rework the text of poll(2) for clarity. Bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/lib/libc/sys/poll.2

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/sys/poll.2
diff -u src/lib/libc/sys/poll.2:1.33 src/lib/libc/sys/poll.2:1.34
--- src/lib/libc/sys/poll.2:1.33	Sun Feb  7 18:22:51 2021
+++ src/lib/libc/sys/poll.2	Tue Feb  9 00:50:47 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: poll.2,v 1.33 2021/02/07 18:22:51 rillig Exp $
+.\"	$NetBSD: poll.2,v 1.34 2021/02/09 00:50:47 dholland Exp $
 .\"
 .\" Copyright (c) 1998, 2005, 2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 25, 2020
+.Dd February 8, 2021
 .Dt POLL 2
 .Os
 .Sh NAME
@@ -56,95 +56,27 @@ and
 .Fn ppoll
 examine a set of file descriptors to see if some of them are ready for
 I/O.
+For each object inspected, the caller provides a list of conditions
+(called ``events'') to check for, and the kernel returns a list of 
+conditions that are true.
+The intent, as with
+.Xr select 2 ,
+is to check for whether I/O is possible before performing any, so as
+to permit a top-level event loop to process input from many sources
+(and output to many destinations)
+without blocking on any of them and thus becoming stuck.
+.Ss Arguments
 The
 .Fa fds
-argument is a pointer to an array of pollfd structures as defined in
+argument is a pointer to an array of pollfd structures, one per file
+to inspect, as defined in
 .In poll.h
 (shown below).
 The
 .Fa nfds
-argument determines the size of the
+argument gives the size of the
 .Fa fds
 array.
-.Bd -literal
-struct pollfd {
-intfd;   /* file descriptor */
-short  events;   /* events to look for */
-short  revents;  /* events returned */
-};
-.Ed
-.Pp
-The fields of
-.Fa struct pollfd
-are as follows:
-.Bl -tag -width XXXrevents
-.It fd
-File descriptor to poll.
-If the value in
-.Em fd
-is negative, the file descriptor is ignored and
-.Em revents
-is set to 0.
-.It events
-Events to poll for.
-(See below.)
-.It revents
-Events which may occur.
-(See below.)
-.El
-.Pp
-The event bitmasks in
-.Fa events
-and
-.Fa revents
-have the following bits:
-.Bl -tag -width XXXPOLLWRNORM
-.It POLLIN
-Data other than high priority data may be read without blocking.
-.It POLLRDNORM
-Normal data may be read without blocking.
-.It POLLRDBAND
-Data with a non-zero priority may be read without blocking.
-.It POLLPRI
-High priority data may be read without blocking.
-.It POLLOUT
-Normal data may be written without blocking.
-.It POLLWRNORM
-Equivalent to
-POLLOUT.
-.It POLLWRBAND
-Data with a non-zero priority may be written without blocking.
-.It POLLERR
-An exceptional condition has occurred on the device or socket.
-This flag is always checked, even if not present in the
-.Fa events
-bitmask.
-.It POLLHUP
-The device or socket has been disconnected.
-This flag is always
-checked, even if not present in the
-.Fa events
-bitmask.
-Note that
-POLLHUP
-and
-POLLOUT
-should never be present in the
-.Fa revents
-bitmask at the same time.
-If the remote end of a socket is closed,
-.Fn poll
-returns a
-POLLIN
-event, rather than a
-POLLHUP.
-.It POLLNVAL
-The file descriptor is not open.
-This flag is always checked, even
-if not present in the
-.Fa events
-bitmask.
-.El
 .Pp
 If
 .Fa timeout
@@ -152,14 +84,16 @@ is neither zero nor INFTIM (\-1), it spe
 wait for any file descriptor to become ready, in milliseconds.
 If
 .Fa timeout
-is INFTIM (\-1), the poll blocks indefinitely.
+is INFTIM (\-1), then
+.Pn poll
+blocks indefinitely.
 If
 .Fa timeout
 is zero, then
 .Fn poll
 will return without blocking.
 .Pp
-If
+Similarly, if
 .Fa ts
 is a non-null pointer, it references a timespec structure which specifies a
 maximum interval to wait for any file descriptor to become ready.
@@ -169,7 +103,7 @@ is a null pointer,
 .Fn pollts
 and
 .Fn ppoll
-blocks indefinitely.
+block indefinitely.
 If
 .Fa ts
 is a non-null pointer, referencing a zero-valued timespec structure, then
@@ -184,11 +118,97 @@ is a non-null pointer, then the
 .Fn pollts
 and
 .Fn ppoll
-function shall replace the signal mask of the caller by the set of
+functions replace the signal mask of the caller by the set of
 signals pointed to by
 .Fa sigmask
-before examining the descriptors, and shall restore the signal mask
-of the caller before returning.
+while the call is in progress, and restore the caller's original
+signal mask before returning.
+.Pp
+The
+.Vt pollfd
+structure:
+.Bd -literal
+struct pollfd {
+intfd;   /* file descriptor */
+short  events;   /* events to look for */
+short  revents;  /* events 

CVS commit: src/usr.bin/lam

2021-01-25 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan 25 20:07:55 UTC 2021

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

Log Message:
In the lam(1) example with a literal newline, use newish sh syntax.

Bump date (as of when I wrote the change and discussed it, in October;
forgot to commit since)


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/lam/lam.1

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

Modified files:

Index: src/usr.bin/lam/lam.1
diff -u src/usr.bin/lam/lam.1:1.14 src/usr.bin/lam/lam.1:1.15
--- src/usr.bin/lam/lam.1:1.14	Mon Oct 26 04:09:32 2020
+++ src/usr.bin/lam/lam.1	Mon Jan 25 20:07:55 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: lam.1,v 1.14 2020/10/26 04:09:32 dholland Exp $
+.\"	$NetBSD: lam.1,v 1.15 2021/01/25 20:07:55 dholland Exp $
 .\"
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)lam.1	8.1 (Berkeley) 6/6/93
 .\"
-.Dd October 25, 2020
+.Dd October 26, 2020
 .Dt LAM 1
 .Os
 .Sh NAME
@@ -109,12 +109,10 @@ lam file1 file2 file3 file4
 joins 4 files together along each line.
 To merge the lines from four different files use
 .Bd -literal -offset indent
-lam file1 \-S "
-" file2 file3 file4
+lam file1 \-S $'\en' file2 file3 file4
 .Ed
 .Pp
-(with a literal newline; the means for inserting one may depend on
-your shell.)
+(The means for inserting a newline may depend on your shell.)
 .Pp
 Every 2 lines of a file may be joined on one line with
 .Bd -literal -offset indent



CVS commit: src/sys

2021-01-25 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan 25 19:21:11 UTC 2021

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

Log Message:
Fix a thundering herd problem in pipes.

Wake only one waiter when data becomes available, not all of them.
Waking them all is not a usual case, but turns up with make's job
token pipes. (Probably make's job signalling scheme should also be
revised, assuming rillig hasn't already done that, but that's a
separate issue.)

This change will not do us much good for the moment because we don't
distinguish cv_signal from cv_broadcast for interruptible sleeps, but
that's also a separate problem.

Seen on FreeBSD; from mjg at freebsd a couple months ago. Patch was
mine (iirc) but the real work in this sort of thing is discovering the
problem.


To generate a diff of this commit:
cvs rdiff -u -r1.151 -r1.152 src/sys/kern/sys_pipe.c
cvs rdiff -u -r1.37 -r1.38 src/sys/sys/pipe.h

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

Modified files:

Index: src/sys/kern/sys_pipe.c
diff -u src/sys/kern/sys_pipe.c:1.151 src/sys/kern/sys_pipe.c:1.152
--- src/sys/kern/sys_pipe.c:1.151	Fri Dec 11 03:00:09 2020
+++ src/sys/kern/sys_pipe.c	Mon Jan 25 19:21:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_pipe.c,v 1.151 2020/12/11 03:00:09 thorpej Exp $	*/
+/*	$NetBSD: sys_pipe.c,v 1.152 2021/01/25 19:21:11 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.151 2020/12/11 03:00:09 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.152 2021/01/25 19:21:11 dholland Exp $");
 
 #include 
 #include 
@@ -344,13 +344,19 @@ pipelock(struct pipe *pipe, bool catch_p
 	KASSERT(mutex_owned(pipe->pipe_lock));
 
 	while (pipe->pipe_state & PIPE_LOCKFL) {
-		pipe->pipe_state |= PIPE_LWANT;
+		pipe->pipe_waiters++;
+		KASSERT(pipe->pipe_waiters != 0); /* just in case */
 		if (catch_p) {
 			error = cv_wait_sig(>pipe_lkcv, pipe->pipe_lock);
-			if (error != 0)
+			if (error != 0) {
+KASSERT(pipe->pipe_waiters > 0);
+pipe->pipe_waiters--;
 return error;
+			}
 		} else
 			cv_wait(>pipe_lkcv, pipe->pipe_lock);
+		KASSERT(pipe->pipe_waiters > 0);
+		pipe->pipe_waiters--;
 	}
 
 	pipe->pipe_state |= PIPE_LOCKFL;
@@ -368,9 +374,8 @@ pipeunlock(struct pipe *pipe)
 	KASSERT(pipe->pipe_state & PIPE_LOCKFL);
 
 	pipe->pipe_state &= ~PIPE_LOCKFL;
-	if (pipe->pipe_state & PIPE_LWANT) {
-		pipe->pipe_state &= ~PIPE_LWANT;
-		cv_broadcast(>pipe_lkcv);
+	if (pipe->pipe_waiters > 0) {
+		cv_signal(>pipe_lkcv);
 	}
 }
 

Index: src/sys/sys/pipe.h
diff -u src/sys/sys/pipe.h:1.37 src/sys/sys/pipe.h:1.38
--- src/sys/sys/pipe.h:1.37	Thu Jun 25 14:22:19 2020
+++ src/sys/sys/pipe.h	Mon Jan 25 19:21:11 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pipe.h,v 1.37 2020/06/25 14:22:19 jdolecek Exp $ */
+/* $NetBSD: pipe.h,v 1.38 2021/01/25 19:21:11 dholland Exp $ */
 
 /*
  * Copyright (c) 1996 John S. Dyson
@@ -80,8 +80,7 @@ struct pipebuf {
 #define PIPE_SIGNALR	0x020	/* Do selwakeup() on read(2) */
 #define	PIPE_LOCKFL	0x100	/* Process has exclusive access to
    pointers/data. */
-#define	PIPE_LWANT	0x200	/* Process wants exclusive access to
-   pointers/data. */
+/*	unused  	0x200	*/
 #define	PIPE_RESTART	0x400	/* Return ERESTART to blocked syscalls */
 
 /*
@@ -100,6 +99,7 @@ struct pipe {
 	struct	timespec pipe_mtime;	/* time of last modify */
 	struct	timespec pipe_btime;	/* time of creation */
 	pid_t	pipe_pgid;		/* process group for sigio */
+	u_int	pipe_waiters;		/* number of waiters pending */
 	struct	pipe *pipe_peer;	/* link with other direction */
 	u_int	pipe_state;		/* pipe status info */
 	int	pipe_busy;		/* busy flag, to handle rundown */



CVS commit: src/usr.bin/calendar

2020-12-24 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Fri Dec 25 07:00:52 UTC 2020

Modified Files:
src/usr.bin/calendar: Makefile

Log Message:
List calendar's known calendars explicitly, and only install those.

Prevents build failures caused by installing editor backups and other
such silliness.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/calendar/Makefile

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/calendar/Makefile
diff -u src/usr.bin/calendar/Makefile:1.14 src/usr.bin/calendar/Makefile:1.15
--- src/usr.bin/calendar/Makefile:1.14	Tue Apr 14 22:15:17 2009
+++ src/usr.bin/calendar/Makefile	Fri Dec 25 07:00:52 2020
@@ -1,12 +1,18 @@
-#	$NetBSD: Makefile,v 1.14 2009/04/14 22:15:17 lukem Exp $
+#	$NetBSD: Makefile,v 1.15 2020/12/25 07:00:52 dholland Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/6/93
 
 .include 
 
+CALENDARS=	birthday christian computer history holiday judaic \
+		lotr music netbsd usholiday
+
 PROG=	calendar
+
 .if ${MKSHARE} != "no"
 FILESDIR=/usr/share/calendar
-FILES!= echo ${.CURDIR}/calendars/calendar.*
+.for _C_ in ${CALENDARS}
+FILES+=${.CURDIR}/calendars/calendar.${_C_}
+.endfor
 .endif
 
 .include 



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

2020-12-11 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Fri Dec 11 09:14:19 UTC 2020

Modified Files:
src/sys/arch/arm/arm: bcopyinout.S

Log Message:
arm copyin/out: make copyin not use copyout's epilogue (typo in labels)

The epilogues are the same, so this is harmless, but if they ever
changed (e.g. after rearranging the register usage) it would be broken
in a very confusing way.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/arm/bcopyinout.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/arm/arm/bcopyinout.S
diff -u src/sys/arch/arm/arm/bcopyinout.S:1.21 src/sys/arch/arm/arm/bcopyinout.S:1.22
--- src/sys/arch/arm/arm/bcopyinout.S:1.21	Wed Jan 24 09:04:44 2018
+++ src/sys/arch/arm/arm/bcopyinout.S	Fri Dec 11 09:14:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcopyinout.S,v 1.21 2018/01/24 09:04:44 skrll Exp $	*/
+/*	$NetBSD: bcopyinout.S,v 1.22 2020/12/11 09:14:19 dholland Exp $	*/
 
 /*
  * Copyright (c) 2002 Wasabi Systems, Inc.
@@ -52,7 +52,7 @@
 #include "bcopyinout_xscale.S"
 #else
 
-RCSID("$NetBSD: bcopyinout.S,v 1.21 2018/01/24 09:04:44 skrll Exp $")	
+RCSID("$NetBSD: bcopyinout.S,v 1.22 2020/12/11 09:14:19 dholland Exp $")	
 
 	.text
 	.align	0
@@ -239,7 +239,7 @@ ENTRY(copyin)
 	 * If we're done, bail.
 	 */
 	cmp	r2, #0
-	beq	.Lout
+	beq	.Liout
 
 .Licleanup:
 	and	r6, r2, #0x3



CVS commit: src/common/lib/libc/arch/arm/gen

2020-12-11 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Fri Dec 11 09:02:33 UTC 2020

Modified Files:
src/common/lib/libc/arch/arm/gen: byte_swap_4.S

Log Message:
arm bswap32: fix fatal typo in thumb code (PR 55854)


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/common/lib/libc/arch/arm/gen/byte_swap_4.S

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

Modified files:

Index: src/common/lib/libc/arch/arm/gen/byte_swap_4.S
diff -u src/common/lib/libc/arch/arm/gen/byte_swap_4.S:1.8 src/common/lib/libc/arch/arm/gen/byte_swap_4.S:1.9
--- src/common/lib/libc/arch/arm/gen/byte_swap_4.S:1.8	Wed Dec  9 02:46:57 2020
+++ src/common/lib/libc/arch/arm/gen/byte_swap_4.S	Fri Dec 11 09:02:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: byte_swap_4.S,v 1.8 2020/12/09 02:46:57 dholland Exp $	*/
+/*	$NetBSD: byte_swap_4.S,v 1.9 2020/12/11 09:02:33 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -46,7 +46,7 @@ ENTRY(FUNC)
 	eor	r0, r0, r1, lsr #8	/* a.d.c.b ^ 0.db.0.db -> a.b.c.d */
 #else
 	movs	r3, #16
-	lsls	r1, r0, #8		/* d.c.b.a -> c.b.a.0 /*
+	lsls	r1, r0, #8		/* d.c.b.a -> c.b.a.0 */
 	lsrs	r0, r0, #8		/* d.c.b.a -> 0.d.c.b */
 	rors	r1, r3			/* c.b.a.0 -> a.0.c.b */
 	rors	r0, r3			/* 0.d.c.b -> c.b.0.d */



CVS commit: src/common/lib/libc/arch/arm/gen

2020-12-08 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Dec  9 02:46:57 UTC 2020

Modified Files:
src/common/lib/libc/arch/arm/gen: byte_swap_4.S

Log Message:
arm bswap32: Improve the comments showing the byte flow.

It's confusing to use 1-4 for bytes 1-4 and then 0 for literal zero,
so use a-d for bytes 1-4.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/common/lib/libc/arch/arm/gen/byte_swap_4.S

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

Modified files:

Index: src/common/lib/libc/arch/arm/gen/byte_swap_4.S
diff -u src/common/lib/libc/arch/arm/gen/byte_swap_4.S:1.7 src/common/lib/libc/arch/arm/gen/byte_swap_4.S:1.8
--- src/common/lib/libc/arch/arm/gen/byte_swap_4.S:1.7	Mon Aug 19 03:44:47 2013
+++ src/common/lib/libc/arch/arm/gen/byte_swap_4.S	Wed Dec  9 02:46:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: byte_swap_4.S,v 1.7 2013/08/19 03:44:47 matt Exp $	*/
+/*	$NetBSD: byte_swap_4.S,v 1.8 2020/12/09 02:46:57 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -40,21 +40,21 @@ ENTRY(FUNC)
 #ifdef _ARM_ARCH_6
 	rev	r0, r0
 #elif !defined(__thumb__)
-	eor	r1, r0, r0, ror #16	/* 4.3.2.1 -> 42.31.42.31 */
-	bic	r1, r1, #0x00FF	/* 42.31.42.31 -> 42.0.42.31 */
-	mov	r0, r0, ror #8		/* 4.3.2.1 -> 1.4.3.2 */
-	eor	r0, r0, r1, lsr #8	/* 1.4.3.2 ^ 0.42.0.42 -> 1.2.3.4 */
+	eor	r1, r0, r0, ror #16	/* d.c.b.a -> db.ca.db.ca */
+	bic	r1, r1, #0x00FF	/* db.ca.db.ca -> db.0.db.ca */
+	mov	r0, r0, ror #8		/* d.c.b.a -> a.d.c.b */
+	eor	r0, r0, r1, lsr #8	/* a.d.c.b ^ 0.db.0.db -> a.b.c.d */
 #else
 	movs	r3, #16
-	lsls	r1, r0, #8		/* 4.3.2.1 -> 3.2.1.0 /*
-	lsrs	r0, r0, #8		/* 4.3.2.1 -> 0.4.3.2 */
-	rors	r1, r3			/* 3.2.1.0 -> 1.0.3.2 */
-	rors	r0, r3			/* 0.4.3.2 -> 3.2.0.4 */
-	lsrs	r1, r1, #8		/* 1.0.3.2 -> 0.1.0.3 */
-	lsls	r1, r1, #8		/* 0.1.0.3 -> 1.0.3.0 */
-	lsls	r0, r0, #8		/* 3.2.0.4 -> 2.0.4.0 */
-	lsrs	r0, r0, #8		/* 2.0.4.0 -> 0.2.0.4 */
-	orrs	r0, r0, r1		/* 1.0.3.0 | 0.2.0.4 -> 1.2.3.4 */
+	lsls	r1, r0, #8		/* d.c.b.a -> c.b.a.0 /*
+	lsrs	r0, r0, #8		/* d.c.b.a -> 0.d.c.b */
+	rors	r1, r3			/* c.b.a.0 -> a.0.c.b */
+	rors	r0, r3			/* 0.d.c.b -> c.b.0.d */
+	lsrs	r1, r1, #8		/* a.0.c.b -> 0.a.0.c */
+	lsls	r1, r1, #8		/* 0.a.0.c -> a.0.c.0 */
+	lsls	r0, r0, #8		/* c.b.0.d -> b.0.d.0 */
+	lsrs	r0, r0, #8		/* b.0.d.0 -> 0.b.0.d */
+	orrs	r0, r0, r1		/* a.0.c.0 | 0.b.0.d -> a.b.c.d */
 #endif
 	RET
 END(FUNC)



CVS commit: src/games/backgammon/common_source

2020-12-06 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Dec  6 11:41:47 UTC 2020

Modified Files:
src/games/backgammon/common_source: back.h

Log Message:
speed limit 80


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/games/backgammon/common_source/back.h

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

Modified files:

Index: src/games/backgammon/common_source/back.h
diff -u src/games/backgammon/common_source/back.h:1.21 src/games/backgammon/common_source/back.h:1.22
--- src/games/backgammon/common_source/back.h:1.21	Wed Apr 22 23:36:26 2020
+++ src/games/backgammon/common_source/back.h	Sun Dec  6 11:41:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: back.h,v 1.21 2020/04/22 23:36:26 joerg Exp $	*/
+/*	$NetBSD: back.h,v 1.22 2020/12/06 11:41:47 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -46,7 +46,12 @@
 #define rnum(r)	(random()%r)
 #define D0	dice[0]
 #define D1	dice[1]
-#define mswap(m) {(m)->D0 ^= (m)->D1; (m)->D1 ^= (m)->D0; (m)->D0 ^= (m)->D1; (m)->d0 = 1-(m)->d0;}
+#define mswap(m) { \
+	(m)->D0 ^= (m)->D1;  \
+	(m)->D1 ^= (m)->D0;  \
+	(m)->D0 ^= (m)->D1;  \
+	(m)->d0 = 1-(m)->d0; \
+}
 
 struct move {
 	int	dice[2];	/* value of dice */
@@ -121,7 +126,7 @@ extern	char	cin[100];	/* input line of c
 extern	const char	*const color[];
 /* colors as strings */
 extern	const char	*const *colorptr;	/* color of current player */
-extern	const char	*const *Colorptr;	/* color of current player, capitalized */
+extern	const char	*const *Colorptr;	/* ditto, capitalized */
 extern	int	colen;		/* length of color of current player */
 
 extern int buffnum;



CVS commit: src/games/battlestar

2020-12-06 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Dec  6 11:35:27 UTC 2020

Modified Files:
src/games/battlestar: globals.c

Log Message:
speed limit 80


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/games/battlestar/globals.c

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

Modified files:

Index: src/games/battlestar/globals.c
diff -u src/games/battlestar/globals.c:1.19 src/games/battlestar/globals.c:1.20
--- src/games/battlestar/globals.c:1.19	Thu Aug  7 09:37:02 2003
+++ src/games/battlestar/globals.c	Sun Dec  6 11:35:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: globals.c,v 1.19 2003/08/07 09:37:02 agc Exp $	*/
+/*	$NetBSD: globals.c,v 1.20 2020/12/06 11:35:27 dholland Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)globals.c	8.2 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: globals.c,v 1.19 2003/08/07 09:37:02 agc Exp $");
+__RCSID("$NetBSD: globals.c,v 1.20 2020/12/06 11:35:27 dholland Exp $");
 #endif
 #endif/* not lint */
 
@@ -67,7 +67,8 @@ const char   *const objdes[NUMOFOBJECTS]
 	"A dead woodsman has fallen here. He was savagely murdered.",
 	"A heavy wooden mallet lies nearby.",
 	"There is a laser pistol here.",
-	"A flower-like young goddess is bathing in the hot mineral pools. She is \nwatching you, but continues to steep and sing softly.",
+	"A flower-like young goddess is bathing in the hot mineral pools. She "
+		"is \nwatching you, but continues to steep and sing softly.",
 	"The goddess is reclining on a bed of ferns and studying you intently.",
 	"There is a grenade here.",
 	"There is a length of heavy chain here.",
@@ -78,7 +79,8 @@ const char   *const objdes[NUMOFOBJECTS]
 	"A long, sharp halberd is propped up here.",
 	"There is a compass here.",
 	"Wreckage and smoldering debris from a crash litter the ground here.",
-	"A woodland Elf armed with a shield and deadly halberd lunges toward you!",
+	"A woodland Elf armed with a shield and deadly halberd lunges toward "
+		"you!",
 	"I think I hear footsteps behind us.",
 	"There are a few coins here.",
 	"There are some matches here.",
@@ -91,15 +93,28 @@ const char   *const objdes[NUMOFOBJECTS]
 	"There is a sparkling diamond ring here.",
 	"There is a colorful pink potion in a small crystal vial here.",
 	"A gold bracelet is on the ground here.",
-	"A swarthy woman with stern features pulls you aside from the crowd,\n'I must talk to you -- but not here.  Meet me at midnight in the gardens.'",
-	"The swarthy woman has been awaiting you anxiously. 'I must warn you that the\nIsland has anticipated your Quest.  You will not be welcomed. The Darkness is\nstrong where you must search.  Seek not the shadows save only at night, for\nthen are they the weakest.  In the mountains far from here a canyon winds\nwith ferns and streams and forgotten vines.  There you must go. Take this\nrope.'",
-	"Out from the shadows a figure leaps!  His black cape swirls around, and he\nholds a laser sword at your chest.  'So, you have come to fulfill the Quest.\nHa! Your weapons are no match for me!'",
-	"An old-timer with one eye missing and no money for a drink sits at the bar.",
+	"A swarthy woman with stern features pulls you aside from the crowd,\n"
+		"'I must talk to you -- but not here.  "
+		"Meet me at midnight in the gardens.'",
+	"The swarthy woman has been awaiting you anxiously. 'I must warn you "
+		"that the\nIsland has anticipated your Quest.  You will not be "
+		"welcomed. The Darkness is\nstrong where you must search.  Seek"
+		" not the shadows save only at night, for\nthen are they the "
+		"weakest.  In the mountains far from here a canyon winds\nwith "
+		"ferns and streams and forgotten vines.  There you must go. "
+		"Take this\nrope.'",
+	"Out from the shadows a figure leaps!  His black cape swirls around,"
+		" and he\nholds a laser sword at your chest.  'So, you have"
+		" come to fulfill the Quest.\nHa! Your weapons are no match for"
+		" me!'",
+	"An old-timer with one eye missing and no money for a drink sits at the"
+		" bar.",
 	"You are flying through an asteroid field!",
 	"A planet is nearby.",
 	"The ground is charred here.",
 	"There is a thermonuclear warhead here.",
-	"The fragile, beautiful young goddess lies here.  You murdered her horribly.",
+	"The fragile, beautiful young goddess lies here.  You murdered her "
+		"horribly.",
 	"The old-timer is lying here.  He is dead.",
 	"The native girl's body is lying here.",
 	"A native girl is sitting here.",



CVS commit: src/sbin/tunefs

2020-11-25 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Thu Nov 26 02:06:01 UTC 2020

Modified Files:
src/sbin/tunefs: tunefs.c

Log Message:
Add missing newlines to ACL prints in tunefs; from Jan Schaumann in PR 55824.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sbin/tunefs/tunefs.c

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

Modified files:

Index: src/sbin/tunefs/tunefs.c
diff -u src/sbin/tunefs/tunefs.c:1.53 src/sbin/tunefs/tunefs.c:1.54
--- src/sbin/tunefs/tunefs.c:1.53	Sat Aug  8 11:44:55 2020
+++ src/sbin/tunefs/tunefs.c	Thu Nov 26 02:06:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tunefs.c,v 1.53 2020/08/08 11:44:55 christos Exp $	*/
+/*	$NetBSD: tunefs.c,v 1.54 2020/11/26 02:06:01 dholland Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)tunefs.c	8.3 (Berkeley) 5/3/95";
 #else
-__RCSID("$NetBSD: tunefs.c,v 1.53 2020/08/08 11:44:55 christos Exp $");
+__RCSID("$NetBSD: tunefs.c,v 1.54 2020/11/26 02:06:01 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -391,7 +391,7 @@ main(int argc, char *argv[])
 "exclusive", name);
 			} else {
 sblock.fs_flags |= FS_POSIX1EACLS;
-printf("%s set", name);
+printf("%s set\n", name);
 			}
 		} else if (strcmp(pvalue, "disable") == 0) {
 			if ((~sblock.fs_flags & FS_POSIX1EACLS) ==
@@ -400,7 +400,7 @@ main(int argc, char *argv[])
 name);
 			} else {
 sblock.fs_flags &= ~FS_POSIX1EACLS;
-printf("%s cleared", name);
+printf("%s cleared\n", name);
 			}
 		}
 	}



CVS commit: src/games/fortune/datfiles

2020-11-08 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Nov  9 03:23:15 UTC 2020

Modified Files:
src/games/fortune/datfiles: fortunes

Log Message:
Restore the catman joke.

It needs the (8), or it fails to work for people who don't know or had
forgotten catman(8) was ever a thing.

as the de facto fortunes editor and also I think the person who added
that fortune in the first place, and given the discussion in
tech-userlevel, I think I get to do this.


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/games/fortune/datfiles/fortunes

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

Modified files:

Index: src/games/fortune/datfiles/fortunes
diff -u src/games/fortune/datfiles/fortunes:1.95 src/games/fortune/datfiles/fortunes:1.96
--- src/games/fortune/datfiles/fortunes:1.95	Mon Nov  9 00:46:00 2020
+++ src/games/fortune/datfiles/fortunes	Mon Nov  9 03:23:14 2020
@@ -16177,7 +16177,7 @@ be named Eustace Clarence Scrubb.
 %
 Never leave a macassar and an antimacassar in the same room together.
 %
-Why did the furry install Unix? Because it supports catman.
+Why did the furry install Unix? Because it supports catman(8).
 %
 Many people don't realize that trailhead doggerel is illegal -- but
 surely you've heard of "hike rhymes and misdemeanors"...



CVS commit: src/usr.sbin/syslogd

2020-11-07 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Nov  8 01:12:46 UTC 2020

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
syslogd: in die(), don't call die() again recursively.

Particularly not for something as immaterial as close failing.

PR 55795


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/usr.sbin/syslogd/syslogd.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.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.135 src/usr.sbin/syslogd/syslogd.c:1.136
--- src/usr.sbin/syslogd/syslogd.c:1.135	Sat Nov  7 17:46:56 2020
+++ src/usr.sbin/syslogd/syslogd.c	Sun Nov  8 01:12:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.135 2020/11/07 17:46:56 christos Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.136 2020/11/08 01:12:46 dholland Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)syslogd.c	8.3 (Berkeley) 4/4/94";
 #else
-__RCSID("$NetBSD: syslogd.c,v 1.135 2020/11/07 17:46:56 christos Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.136 2020/11/08 01:12:46 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -3012,10 +3012,7 @@ die(int fd, short event, void *ev)
 	 */
 	if (finet) {
 		for (i = 0; i < finet->fd; i++) {
-			if (close(finet[i+1].fd) < 0) {
-logerror("close() failed");
-die(0, 0, NULL);
-			}
+			(void)close(finet[i+1].fd);
 			DEL_EVENT(finet[i+1].ev);
 			FREEPTR(finet[i+1].ev);
 		}



CVS commit: src/share/misc

2020-11-05 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Thu Nov  5 18:05:06 UTC 2020

Modified Files:
src/share/misc: acronyms.comp

Log Message:
+SMR


To generate a diff of this commit:
cvs rdiff -u -r1.314 -r1.315 src/share/misc/acronyms.comp

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

Modified files:

Index: src/share/misc/acronyms.comp
diff -u src/share/misc/acronyms.comp:1.314 src/share/misc/acronyms.comp:1.315
--- src/share/misc/acronyms.comp:1.314	Sun Oct 18 10:17:09 2020
+++ src/share/misc/acronyms.comp	Thu Nov  5 18:05:06 2020
@@ -1,4 +1,4 @@
-$NetBSD: acronyms.comp,v 1.314 2020/10/18 10:17:09 leot Exp $
+$NetBSD: acronyms.comp,v 1.315 2020/11/05 18:05:06 dholland Exp $
 3WHS	three-way handshake
 8VSB	8-state vestigial side band modulation
 AA	anti-aliasing
@@ -1504,6 +1504,8 @@ SMI	system management interrupt
 SMM	system management mode
 SMP	serial management protocol
 SMP	symmetric multiprocessing
+SMR	shingled magnetic recording
+SMR	state machine replication
 SMT	simultaneous multithreading
 SMTP	Simple Mail Transfer Protocol
 SMU	system management unit



CVS commit: src/usr.bin/lam

2020-10-25 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Oct 26 04:09:32 UTC 2020

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

Log Message:
Clarify the behavior of -S further in lam(1).

Seems that "lam file1 -S sep file2" does not carry the -S over past
file2, even though you can also write "lam file1 file2 -[sS] sep" to
give a separator string after the last file.

Ride previous date bump.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/lam/lam.1

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

Modified files:

Index: src/usr.bin/lam/lam.1
diff -u src/usr.bin/lam/lam.1:1.13 src/usr.bin/lam/lam.1:1.14
--- src/usr.bin/lam/lam.1:1.13	Mon Oct 26 03:51:54 2020
+++ src/usr.bin/lam/lam.1	Mon Oct 26 04:09:32 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: lam.1,v 1.13 2020/10/26 03:51:54 dholland Exp $
+.\"	$NetBSD: lam.1,v 1.14 2020/10/26 04:09:32 dholland Exp $
 .\"
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -89,6 +89,8 @@ Print
 .Ar sepstring
 before printing line fragments from the next file.
 This option may appear after the last file.
+(A capitalized version appearing before the last file is not carried
+over past the last file.)
 .It Fl t Ar c
 The input line terminator is
 .Ar c



CVS commit: src/usr.bin/lam

2020-10-25 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Oct 26 03:51:54 UTC 2020

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

Log Message:
Improve previous lam(1) change.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/lam/lam.1

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

Modified files:

Index: src/usr.bin/lam/lam.1
diff -u src/usr.bin/lam/lam.1:1.12 src/usr.bin/lam/lam.1:1.13
--- src/usr.bin/lam/lam.1:1.12	Mon Oct 26 03:46:57 2020
+++ src/usr.bin/lam/lam.1	Mon Oct 26 03:51:54 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: lam.1,v 1.12 2020/10/26 03:46:57 dholland Exp $
+.\"	$NetBSD: lam.1,v 1.13 2020/10/26 03:51:54 dholland Exp $
 .\"
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -111,6 +111,9 @@ lam file1 \-S "
 " file2 file3 file4
 .Ed
 .Pp
+(with a literal newline; the means for inserting one may depend on
+your shell.)
+.Pp
 Every 2 lines of a file may be joined on one line with
 .Bd -literal -offset indent
 lam \- \- < file



CVS commit: src/usr.bin/lam

2020-10-25 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Oct 26 03:46:57 UTC 2020

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

Log Message:
Fix the second example in lam(1).

(a) revert -r1.8 (changing -s back to -S) as it was wrong;
(b) get rid of the backslash since it doesn't belong.
(c) bump date.

Noted by Robert Elz.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/lam/lam.1

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

Modified files:

Index: src/usr.bin/lam/lam.1
diff -u src/usr.bin/lam/lam.1:1.11 src/usr.bin/lam/lam.1:1.12
--- src/usr.bin/lam/lam.1:1.11	Mon Jul  3 21:34:19 2017
+++ src/usr.bin/lam/lam.1	Mon Oct 26 03:46:57 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: lam.1,v 1.11 2017/07/03 21:34:19 wiz Exp $
+.\"	$NetBSD: lam.1,v 1.12 2020/10/26 03:46:57 dholland Exp $
 .\"
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)lam.1	8.1 (Berkeley) 6/6/93
 .\"
-.Dd January 5, 2016
+.Dd October 25, 2020
 .Dt LAM 1
 .Os
 .Sh NAME
@@ -107,7 +107,7 @@ lam file1 file2 file3 file4
 joins 4 files together along each line.
 To merge the lines from four different files use
 .Bd -literal -offset indent
-lam file1 \-s "\e
+lam file1 \-S "
 " file2 file3 file4
 .Ed
 .Pp



CVS commit: src/usr.bin/renice

2020-10-22 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Thu Oct 22 20:13:02 UTC 2020

Modified Files:
src/usr.bin/renice: renice.8

Log Message:
Rework the description of process priorities in renice(8).

It is inherently confusing, thanks to historical practice and
standards, so let's be very explicit.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/renice/renice.8

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/renice/renice.8
diff -u src/usr.bin/renice/renice.8:1.16 src/usr.bin/renice/renice.8:1.17
--- src/usr.bin/renice/renice.8:1.16	Thu Oct 22 19:55:14 2020
+++ src/usr.bin/renice/renice.8	Thu Oct 22 20:13:02 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: renice.8,v 1.16 2020/10/22 19:55:14 dholland Exp $
+.\"	$NetBSD: renice.8,v 1.17 2020/10/22 20:13:02 dholland Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -110,26 +110,57 @@ If an
 is used, the increment is added to the process's previous priority.
 .El
 .Pp
-Users other than the super-user may only alter the priority of
-processes they own,
-and can only monotonically increase their ``nice value''
-within the range 0 to
-.Dv PRIO_MAX
-(20).
-(This prevents overriding administrative fiats.)
-The super-user
-may alter the priority of any process
-and set the priority to any value in the range
+In conventional terminology a
+.Dq high priority
+process receives a lot of CPU time and a
+.Dq low priority
+process receives relatively little.
+.Dq Niceness
+is the inverse concept: a process with a high niceness level receives
+relatively little CPU time.
+It is about the process being nice to the rest of the system, rather
+than the system being nice to the process.
+.Pp
+The numerical priority values accepted by
+.Nm
+are
+.Em called
+priorities but are actually nicenesses.
+They range from
 .Dv PRIO_MIN
 (\-20)
 to
-.Dv PRIO_MAX .
+.Dv PRIO_MAX
+(20).
+.Dv PRIO_MIN
+is the highest priority, lowest niceness, and receives the most CPU
+time.
+.Dv PRIO_MAX
+is the lowest priority, highest niceness, and receives the least CPU
+time.
+This is confusing but enshrined in historical practice and standards.
+If in doubt, check with
+.Xr ps 1 :
+processes running with elevated priority (getting more CPU time)
+include
+.Sq <
+in the FLAGS column; processes running with reduced priority
+(getting less CPU time) show
+.Sq N
+for
+.Dq nice
+in FLAGS.
+The default priority is 0.
+.Pp
+At priority 20, processes will specifically run only when nothing else
+wants to.
 .Pp
-Useful priorities are:
-0, the ``base'' scheduling priority;
-20, the affected processes will run only when nothing at the base priority
-wants to;
-anything negative, the processes will receive a scheduling preference.
+Users other than the super-user may only alter the priority of
+processes they own,
+and only by increasing the niceness.
+(This prevents overriding administrative fiats.)
+The super-user
+may alter the priority of any process to any legal value.
 .Sh FILES
 .Bl -tag -width /etc/passwd -compact
 .It Pa /etc/passwd
@@ -153,5 +184,5 @@ The
 command appeared in
 .Bx 4.0 .
 .Sh BUGS
-Non-super-users can not increase scheduling priorities of their own processes,
+Non-super-users cannot increase scheduling priorities of their own processes,
 even if they were the ones that decreased the priorities in the first place.



CVS commit: src/usr.bin/renice

2020-10-22 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Thu Oct 22 19:55:14 UTC 2020

Modified Files:
src/usr.bin/renice: renice.8

Log Message:
Rearrange the description of the renice arguments and options.

Don't refer to "who" parameters that aren't defined anywhere, make it
clear how the options are actually interpreted (since it's not and
can't be getopt-style), and also document the behavior when a named
collection of processes doesn't start out with uniform priority.

The dangling "who" parameters issue seems to date back to 4.4.

Prompted by Ottavio Caruso.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/renice/renice.8

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/renice/renice.8
diff -u src/usr.bin/renice/renice.8:1.15 src/usr.bin/renice/renice.8:1.16
--- src/usr.bin/renice/renice.8:1.15	Thu Dec  6 07:52:12 2012
+++ src/usr.bin/renice/renice.8	Thu Oct 22 19:55:14 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: renice.8,v 1.15 2012/12/06 07:52:12 wiz Exp $
+.\"	$NetBSD: renice.8,v 1.16 2020/10/22 19:55:14 dholland Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" from: @(#)renice.8	8.1 (Berkeley) 6/9/93
 .\"
-.Dd December 6, 2012
+.Dd October 22, 2020
 .Dt RENICE 8
 .Os
 .Sh NAME
@@ -39,77 +39,76 @@
 .Nm
 .Ar priority
 .Oo
-.Op Fl p
-.Ar pid ...
-.Oc
-.Oo
-.Fl g
-.Ar pgrp ...
-.Oc
-.Oo
-.Fl u
-.Ar user ...
+.Op Fl pgu
+.Ar who ...
 .Oc
+.Ar ...
 .Nm
 .Fl n
 .Ar increment
 .Oo
-.Op Fl p
-.Ar pid ...
-.Oc
-.Oo
-.Fl g
-.Ar pgrp ...
-.Oc
-.Oo
-.Fl u
-.Ar user ...
+.Op Fl pgu
+.Ar who ...
 .Oc
+.Ar ...
 .Sh DESCRIPTION
 .Nm
 alters the
 scheduling priority of one or more running processes.
+The first argument is the new priority to apply, or if
+.Fl n
+is given, the change to make (applied additively) to the priority.
+This argument may be negative.
+(The interpretation of priorities is discussed below.)
+.Pp
 The following
 .Ar who
-parameters are interpreted as process ID's, process group
-ID's, or user names.
-.Nm Ns 'ing
-a process group causes all processes in the process group
-to have their scheduling priority altered.
-.Nm Ns 'ing
-a user causes all processes owned by the user to have
-their scheduling priority altered.
-By default, the processes to be affected are specified by
-their process ID's.
-.Pp
-Options supported by
-.Nm :
+parameters name the target processes, as either process IDs, process
+group IDs, or user names.
+The
+.It pgf
+options control the interpretation as follows:
 .Bl -tag -width Ds
 .It Fl g
-Force
+Interpret
 .Ar who
-parameters to be interpreted as process group ID's.
-.It Fl n
-Instead of changing the specified processes to the given priority,
-interpret the following argument as an increment to be applied to
-the current priority of each process.
+parameters as process group ID's.
 .It Fl u
-Force the
+Interpret
 .Ar who
-parameters to be interpreted as user names.
+parameters as user names.
 .It Fl p
-Resets the
+Interpret
 .Ar who
-interpretation to be (the default) process ID's.
+parameters as process IDs.
+This is the default.
 .El
 .Pp
-For example,
-.Bd -literal -offset indent
-renice +1 987 -u daemon root -p 32
-.Ed
-.Pp
-would change the priority of process ID's 987 and 32, and
-all processes owned by users daemon and root.
+Each
+.Ar who
+parameter is processed separately and updates the priority of the
+processes it names as follows:
+.Bl -tag -width "with Ds"
+.It with Fl g
+All processes in the process group are updated to the selected
+priority.
+If an
+.Ar increment
+is used, the increment is added to the highest priority found among
+the members of the process group prior to the change.
+.It with Fl u
+All processes belonging to the specified user are updated to the
+selected priority.
+If an
+.Ar increment
+is used, the increment is added to the highest priority found among
+the processes belonging to the user prior to the change.
+.It with Fl p
+The named process is updated to the selected priority.
+If an
+.Ar increment
+is used, the increment is added to the process's previous priority.
+.El
 .Pp
 Users other than the super-user may only alter the priority of
 processes they own,
@@ -136,6 +135,13 @@ anything negative, the processes will re
 .It Pa /etc/passwd
 to map user names to user ID's
 .El
+.Sh EXAMPLES
+.Bd -literal -offset indent
+renice +1 987 -u daemon root -p 32
+.Ed
+.Pp
+changes the priority of process ID's 987 and 32, and
+all processes owned by users daemon and root.
 .Sh SEE ALSO
 .Xr nice 1 ,
 .Xr prenice 1 ,
@@ -147,5 +153,5 @@ The
 command appeared in
 .Bx 4.0 .
 .Sh BUGS
-Non super-users can not increase scheduling priorities of their own processes,
+Non-super-users can not increase scheduling priorities of their own processes,
 even if they were the ones that decreased the priorities in the first 

CVS commit: src/usr.bin/renice

2020-10-22 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Thu Oct 22 19:34:12 UTC 2020

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

Log Message:
Fix usage check; reject renice without any targets, whether or not -n given.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/renice/renice.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/renice/renice.c
diff -u src/usr.bin/renice/renice.c:1.18 src/usr.bin/renice/renice.c:1.19
--- src/usr.bin/renice/renice.c:1.18	Mon Jul 21 14:19:25 2008
+++ src/usr.bin/renice/renice.c	Thu Oct 22 19:34:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: renice.c,v 1.18 2008/07/21 14:19:25 lukem Exp $	*/
+/*	$NetBSD: renice.c,v 1.19 2020/10/22 19:34:12 dholland Exp $	*/
 
 /*
  * Copyright (c) 1983, 1989, 1993
@@ -37,7 +37,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 
 #ifndef lint
 /*static char sccsid[] = "from: @(#)renice.c	8.1 (Berkeley) 6/9/93";*/
-__RCSID("$NetBSD: renice.c,v 1.18 2008/07/21 14:19:25 lukem Exp $");
+__RCSID("$NetBSD: renice.c,v 1.19 2020/10/22 19:34:12 dholland Exp $");
 #endif /* not lint */
 
 #include 
@@ -73,7 +73,7 @@ main(int argc, char **argv)
 	if (strcmp(*argv, "-n") == 0) {
 		incr = 1;
 		argc--, argv++;
-		if (argc == 0)
+		if (argc < 2)
 			usage();
 	}
 	if (getnum("priority", *argv, ))



CVS commit: src/usr.bin/audiocfg

2020-10-19 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Oct 19 21:46:15 UTC 2020

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

Log Message:
Add missing HISTORY and AUTHORS. Bump date.

Noticed by qjsgkem on freenode.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/audiocfg/audiocfg.1

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

Modified files:

Index: src/usr.bin/audiocfg/audiocfg.1
diff -u src/usr.bin/audiocfg/audiocfg.1:1.6 src/usr.bin/audiocfg/audiocfg.1:1.7
--- src/usr.bin/audiocfg/audiocfg.1:1.6	Sat Aug 24 06:13:01 2019
+++ src/usr.bin/audiocfg/audiocfg.1	Mon Oct 19 21:46:15 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: audiocfg.1,v 1.6 2019/08/24 06:13:01 isaki Exp $
+.\"	$NetBSD: audiocfg.1,v 1.7 2020/10/19 21:46:15 dholland Exp $
 .\"
 .\" Copyright (c) 2010 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 8, 2019
+.Dd October 19, 2020
 .Dt AUDIOCFG 1
 .Os
 .Sh NAME
@@ -125,3 +125,16 @@ Available audio devices.
 .Xr audiorecord 1 ,
 .Xr audio 4 ,
 .Xr drvctl 8
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Nx 6.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+utility was originally written by
+.An Jared McNeill .
+This manual page was written by
+.An Thomas Klausner .



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

2020-08-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 30 11:16:17 UTC 2020

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

Log Message:
typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.577 -r1.578 src/sys/arch/amd64/conf/GENERIC

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/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.577 src/sys/arch/amd64/conf/GENERIC:1.578
--- src/sys/arch/amd64/conf/GENERIC:1.577	Mon Aug 17 20:43:13 2020
+++ src/sys/arch/amd64/conf/GENERIC	Sun Aug 30 11:16:17 2020
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.577 2020/08/17 20:43:13 christos Exp $
+# $NetBSD: GENERIC,v 1.578 2020/08/30 11:16:17 dholland Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.577 $"
+#ident		"GENERIC-$Revision: 1.578 $"
 
 maxusers	64		# estimated number of users
 
@@ -78,7 +78,7 @@ options 	USER_LDT	# User-settable LDT, u
 options 	SVS		# Separate Virtual Space
 options 	PCPU_IDT	# Per CPU IDTs
 
-# GCC Spectre variant 2 migitation
+# GCC Spectre variant 2 mitigation
 makeoptions	SPECTRE_V2_GCC_MITIGATION=1
 options 	SPECTRE_V2_GCC_MITIGATION
 



CVS commit: src/bin/csh

2020-08-08 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug  9 00:53:38 UTC 2020

Modified Files:
src/bin/csh: csh.c

Log Message:
Use the right size for several calloc calls.

When allocating for a Char **, it should use sizeof(Char *), not
sizeof(Char **). This doesn't actually affect the results except
on DS9000 though :-)

(part 2, the instance in this file was as far as I can tell
inexplicably missed by CVS on the first go...)


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/bin/csh/csh.c

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

Modified files:

Index: src/bin/csh/csh.c
diff -u src/bin/csh/csh.c:1.52 src/bin/csh/csh.c:1.53
--- src/bin/csh/csh.c:1.52	Sun Aug  9 00:51:12 2020
+++ src/bin/csh/csh.c	Sun Aug  9 00:53:38 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.c,v 1.52 2020/08/09 00:51:12 dholland Exp $ */
+/* $NetBSD: csh.c,v 1.53 2020/08/09 00:53:38 dholland Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)csh.c	8.2 (Berkeley) 10/12/93";
 #else
-__RCSID("$NetBSD: csh.c,v 1.52 2020/08/09 00:51:12 dholland Exp $");
+__RCSID("$NetBSD: csh.c,v 1.53 2020/08/09 00:53:38 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -697,7 +697,7 @@ importpath(Char *cp)
  * i+2 where i is the number of colons in the path. There are i+1
  * directories in the path plus we need room for a zero terminator.
  */
-pv = xcalloc((size_t) (i + 2), sizeof(Char **));
+pv = xcalloc((size_t) (i + 2), sizeof(*pv));
 dp = cp;
 i = 0;
 if (*dp)



CVS commit: src/bin/csh

2020-08-08 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug  9 00:51:13 UTC 2020

Modified Files:
src/bin/csh: csh.c

Log Message:
Clarify some comments.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/bin/csh/csh.c

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

Modified files:

Index: src/bin/csh/csh.c
diff -u src/bin/csh/csh.c:1.51 src/bin/csh/csh.c:1.52
--- src/bin/csh/csh.c:1.51	Sun Aug  9 00:22:53 2020
+++ src/bin/csh/csh.c	Sun Aug  9 00:51:12 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.c,v 1.51 2020/08/09 00:22:53 dholland Exp $ */
+/* $NetBSD: csh.c,v 1.52 2020/08/09 00:51:12 dholland Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)csh.c	8.2 (Berkeley) 10/12/93";
 #else
-__RCSID("$NetBSD: csh.c,v 1.51 2020/08/09 00:22:53 dholland Exp $");
+__RCSID("$NetBSD: csh.c,v 1.52 2020/08/09 00:51:12 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -845,13 +845,12 @@ srcunit(int unit, int onlyown, int hflg)
 	int i;
 
 	/* We made it to the new state... free up its storage */
-	/* This code could get run twice but free doesn't care */
-	/* XXX yes it does */
 	for (i = 0; i < fblocks; i++)
 	free(fbuf[i]);
 	free(fbuf);
 
 	/* Reset input arena */
+	/* (note that this clears fbuf and fblocks) */
 	(void)memcpy(, , sizeof(B));
 
 	(void)close(SHIN), SHIN = oSHIN;



CVS commit: src/bin/csh

2020-08-08 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug  9 00:34:21 UTC 2020

Modified Files:
src/bin/csh: dir.c lex.c parse.c

Log Message:
Use the right size for several calloc calls.

When allocating for a Char **, it should use sizeof(Char *), not
sizeof(Char **). This doesn't actually affect the results except
on DS9000 though :-)


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/bin/csh/dir.c
cvs rdiff -u -r1.35 -r1.36 src/bin/csh/lex.c
cvs rdiff -u -r1.20 -r1.21 src/bin/csh/parse.c

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

Modified files:

Index: src/bin/csh/dir.c
diff -u src/bin/csh/dir.c:1.34 src/bin/csh/dir.c:1.35
--- src/bin/csh/dir.c:1.34	Sun Aug  9 00:22:53 2020
+++ src/bin/csh/dir.c	Sun Aug  9 00:34:21 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.34 2020/08/09 00:22:53 dholland Exp $ */
+/* $NetBSD: dir.c,v 1.35 2020/08/09 00:34:21 dholland Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)dir.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: dir.c,v 1.34 2020/08/09 00:22:53 dholland Exp $");
+__RCSID("$NetBSD: dir.c,v 1.35 2020/08/09 00:34:21 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -147,7 +147,7 @@ dset(Char *dp)
  * other junk characters glob will fail.
  */
 
-vec = xmalloc((size_t)(2 * sizeof(Char **)));
+vec = xmalloc(2 * sizeof(*vec));
 vec[0] = Strsave(dp);
 vec[1] = 0;
 setq(STRcwd, vec, );

Index: src/bin/csh/lex.c
diff -u src/bin/csh/lex.c:1.35 src/bin/csh/lex.c:1.36
--- src/bin/csh/lex.c:1.35	Sun Aug  9 00:22:53 2020
+++ src/bin/csh/lex.c	Sun Aug  9 00:34:21 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.35 2020/08/09 00:22:53 dholland Exp $ */
+/* $NetBSD: lex.c,v 1.36 2020/08/09 00:34:21 dholland Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)lex.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: lex.c,v 1.35 2020/08/09 00:22:53 dholland Exp $");
+__RCSID("$NetBSD: lex.c,v 1.36 2020/08/09 00:34:21 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -1453,7 +1453,8 @@ again:
 if (buf >= fblocks) {
 	Char **nfbuf;
 
-	nfbuf = xcalloc((size_t) (fblocks + 2), sizeof(char **));
+	/* XXX the cast is needed because fblocks is signed */
+	nfbuf = xcalloc((size_t)(fblocks + 2), sizeof(*nfbuf));
 	if (fbuf) {
 	(void)blkcpy(nfbuf, fbuf);
 	free(fbuf);
@@ -1623,7 +1624,7 @@ settell(void)
 	return;
 if (lseek(SHIN, (off_t) 0, SEEK_CUR) < 0 || errno == ESPIPE)
 	return;
-fbuf = xcalloc(2, sizeof(Char **));
+fbuf = xcalloc(2, sizeof(*fbuf));
 fblocks = 1;
 fbuf[0] = xcalloc(BUFSIZE, sizeof(Char));
 fseekp = fbobp = feobp = lseek(SHIN, (off_t) 0, SEEK_CUR);

Index: src/bin/csh/parse.c
diff -u src/bin/csh/parse.c:1.20 src/bin/csh/parse.c:1.21
--- src/bin/csh/parse.c:1.20	Sun Aug  9 00:22:53 2020
+++ src/bin/csh/parse.c	Sun Aug  9 00:34:21 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.20 2020/08/09 00:22:53 dholland Exp $ */
+/* $NetBSD: parse.c,v 1.21 2020/08/09 00:34:21 dholland Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)parse.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: parse.c,v 1.20 2020/08/09 00:22:53 dholland Exp $");
+__RCSID("$NetBSD: parse.c,v 1.21 2020/08/09 00:34:21 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -509,7 +509,8 @@ again:
 if (n < 0)
 	n = 0;
 t = xcalloc(1, sizeof(*t));
-av = xcalloc((size_t)(n + 1), sizeof(Char **));
+/* XXX the cast is needed because n is signed */
+av = xcalloc((size_t)(n + 1), sizeof(*av));
 t->t_dcom = av;
 n = 0;
 if (p2->word[0] == ')')



CVS commit: src/bin/csh

2020-08-08 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug  9 00:22:53 UTC 2020

Modified Files:
src/bin/csh: csh.c dir.c func.c lex.c parse.c proc.c

Log Message:
Don't cast the value returned from *malloc. No change to compiler output.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/bin/csh/csh.c
cvs rdiff -u -r1.33 -r1.34 src/bin/csh/dir.c
cvs rdiff -u -r1.43 -r1.44 src/bin/csh/func.c
cvs rdiff -u -r1.34 -r1.35 src/bin/csh/lex.c
cvs rdiff -u -r1.19 -r1.20 src/bin/csh/parse.c
cvs rdiff -u -r1.39 -r1.40 src/bin/csh/proc.c

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

Modified files:

Index: src/bin/csh/csh.c
diff -u src/bin/csh/csh.c:1.50 src/bin/csh/csh.c:1.51
--- src/bin/csh/csh.c:1.50	Fri Apr  3 18:11:29 2020
+++ src/bin/csh/csh.c	Sun Aug  9 00:22:53 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.c,v 1.50 2020/04/03 18:11:29 joerg Exp $ */
+/* $NetBSD: csh.c,v 1.51 2020/08/09 00:22:53 dholland Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)csh.c	8.2 (Berkeley) 10/12/93";
 #else
-__RCSID("$NetBSD: csh.c,v 1.50 2020/04/03 18:11:29 joerg Exp $");
+__RCSID("$NetBSD: csh.c,v 1.51 2020/08/09 00:22:53 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -697,7 +697,7 @@ importpath(Char *cp)
  * i+2 where i is the number of colons in the path. There are i+1
  * directories in the path plus we need room for a zero terminator.
  */
-pv = (Char **)xcalloc((size_t) (i + 2), sizeof(Char **));
+pv = xcalloc((size_t) (i + 2), sizeof(Char **));
 dp = cp;
 i = 0;
 if (*dp)
@@ -1211,7 +1211,7 @@ process(int catch)
 	 * Made it!
 	 */
 	freelex();
-	freesyn((struct command *) savet), savet = NULL;
+	freesyn(savet), savet = NULL;
 }
 resexit(osetexit);
 savet = t;

Index: src/bin/csh/dir.c
diff -u src/bin/csh/dir.c:1.33 src/bin/csh/dir.c:1.34
--- src/bin/csh/dir.c:1.33	Fri Apr  3 18:11:29 2020
+++ src/bin/csh/dir.c	Sun Aug  9 00:22:53 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.33 2020/04/03 18:11:29 joerg Exp $ */
+/* $NetBSD: dir.c,v 1.34 2020/08/09 00:22:53 dholland Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)dir.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: dir.c,v 1.33 2020/04/03 18:11:29 joerg Exp $");
+__RCSID("$NetBSD: dir.c,v 1.34 2020/08/09 00:22:53 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -128,7 +128,7 @@ dinit(Char *hp)
 	}
 }
 
-dp = (struct directory *)xcalloc(1, sizeof(struct directory));
+dp = xcalloc(1, sizeof(*dp));
 dp->di_name = cp;
 dp->di_count = 0;
 dhead.di_next = dhead.di_prev = dp;
@@ -363,7 +363,7 @@ dochngd(Char **v, struct command *t)
 }
 else
 	cp = dfollow(*v);
-dp = (struct directory *)xcalloc(1, sizeof(struct directory));
+dp = xcalloc(1, sizeof(*dp));
 dp->di_name = cp;
 dp->di_count = 0;
 dp->di_next = dcwd->di_next;
@@ -510,7 +510,7 @@ dopushd(Char **v, struct command *t)
 	Char *ccp;
 
 	ccp = dfollow(*v);
-	dp = (struct directory *)xcalloc(1, sizeof(struct directory));
+	dp = xcalloc(1, sizeof(*dp));
 	dp->di_name = ccp;
 	dp->di_count = 0;
 	dp->di_prev = dcwd;

Index: src/bin/csh/func.c
diff -u src/bin/csh/func.c:1.43 src/bin/csh/func.c:1.44
--- src/bin/csh/func.c:1.43	Sun Jan  6 01:22:50 2019
+++ src/bin/csh/func.c	Sun Aug  9 00:22:53 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: func.c,v 1.43 2019/01/06 01:22:50 christos Exp $ */
+/* $NetBSD: func.c,v 1.44 2020/08/09 00:22:53 dholland Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)func.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: func.c,v 1.43 2019/01/06 01:22:50 christos Exp $");
+__RCSID("$NetBSD: func.c,v 1.44 2020/08/09 00:22:53 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -414,7 +414,7 @@ doforeach(Char **v, struct command *t)
 v = globall(v);
 if (v == 0)
 	stderror(ERR_NAME | ERR_NOMATCH);
-nwp = (struct whyle *) xcalloc(1, sizeof *nwp);
+nwp = xcalloc(1, sizeof *nwp);
 nwp->w_fe = nwp->w_fe0 = v;
 gargv = 0;
 btell(>w_start);
@@ -452,7 +452,7 @@ dowhile(Char **v, struct command *t)
 	stderror(ERR_NAME | ERR_EXPRESSION);
 if (!again) {
 	struct whyle *nwp =
-	(struct whyle *)xcalloc(1, sizeof(*nwp));
+		xcalloc(1, sizeof(*nwp));
 
 	nwp->w_start = lineloc;
 	nwp->w_end.type = F_SEEK;

Index: src/bin/csh/lex.c
diff -u src/bin/csh/lex.c:1.34 src/bin/csh/lex.c:1.35
--- src/bin/csh/lex.c:1.34	Fri Feb  1 08:29:03 2019
+++ src/bin/csh/lex.c	Sun Aug  9 00:22:53 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.34 2019/02/01 08:29:03 mrg Exp $ */
+/* $NetBSD: lex.c,v 1.35 2020/08/09 00:22:53 dholland Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)lex.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: lex.c,v 1.34 

CVS commit: src/usr.bin/make

2020-08-05 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Aug  5 08:50:42 UTC 2020

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

Log Message:
Also mention that make dependency operators must be uniform.

This wasn't previously documented, I think.


To generate a diff of this commit:
cvs rdiff -u -r1.285 -r1.286 src/usr.bin/make/make.1

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

Modified files:

Index: src/usr.bin/make/make.1
diff -u src/usr.bin/make/make.1:1.285 src/usr.bin/make/make.1:1.286
--- src/usr.bin/make/make.1:1.285	Wed Aug  5 08:43:24 2020
+++ src/usr.bin/make/make.1	Wed Aug  5 08:50:42 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: make.1,v 1.285 2020/08/05 08:43:24 dholland Exp $
+.\"	$NetBSD: make.1,v 1.286 2020/08/05 08:50:42 dholland Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -455,6 +455,8 @@ the target will not be removed if
 .Nm
 is interrupted.
 .El
+All dependency lines mentioning a particular target must use the same
+operator.
 .Pp
 Targets and sources may contain the shell wildcard values
 .Ql \&? ,



CVS commit: src/usr.bin/make

2020-08-05 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Aug  5 08:43:24 UTC 2020

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

Log Message:
Rework the description of the :, !, and :: dependence operators to make sense.

Bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.284 -r1.285 src/usr.bin/make/make.1

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

Modified files:

Index: src/usr.bin/make/make.1
diff -u src/usr.bin/make/make.1:1.284 src/usr.bin/make/make.1:1.285
--- src/usr.bin/make/make.1:1.284	Fri Jul 31 20:22:10 2020
+++ src/usr.bin/make/make.1	Wed Aug  5 08:43:24 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: make.1,v 1.284 2020/07/31 20:22:10 sjg Exp $
+.\"	$NetBSD: make.1,v 1.285 2020/08/05 08:43:24 dholland Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	from: @(#)make.1	8.4 (Berkeley) 3/19/94
 .\"
-.Dd July 31, 2020
+.Dd August 5, 2020
 .Dt MAKE 1
 .Os
 .Sh NAME
@@ -419,34 +419,39 @@ or more sources.
 This creates a relationship where the targets
 .Dq depend
 on the sources
-and are usually created from them.
-The exact relationship between the target and the source is determined
-by the operator that separates them.
-The three operators are as follows:
+and are customarily created from them.
+A target is considered out-of-date if it does not exist, or if its
+modification time is less than that of any of its sources.
+An out-of-date target will be re-created, but not until all sources
+have been examined and themselves re-created as needed.
+Three operators may be used:
 .Bl -tag -width flag
 .It Ic \&:
-A target is considered out-of-date if its modification time is less than
-those of any of its sources.
-Sources for a target accumulate over dependency lines when this operator
-is used.
-The target is removed if
+Many dependency lines may name this target but only one may have
+attached shell commands.
+All sources named in all dependency lines are considered together,
+and if needed the attached shell commands are run to create or
+re-create the target.
+If
 .Nm
-is interrupted.
+is interrupted, the target is removed.
 .It Ic \&!
-Targets are always re-created, but not until all sources have been
-examined and re-created as necessary.
-Sources for a target accumulate over dependency lines when this operator
-is used.
-The target is removed if
-.Nm
-is interrupted.
+The same, but the target is always re-created whether or not it is out
+of date.
 .It Ic \&::
-If no sources are specified, the target is always re-created.
-Otherwise, a target is considered out-of-date if any of its sources has
-been modified more recently than the target.
-Sources for a target do not accumulate over dependency lines when this
-operator is used.
-The target will not be removed if
+Any dependency line may have attached shell commands, but each one
+is handled independently: its sources are considered and the attached
+shell commands are run if the target is out of date with respect to
+(only) those sources.
+Thus, different groups of the attached shell commands may be run
+depending on the circumstances.
+Furthermore, unlike
+.Ic \&:,
+for dependency lines with no sources, the attached shell
+commands are always run.
+Also unlike
+.Ic \&:,
+the target will not be removed if
 .Nm
 is interrupted.
 .El



CVS commit: src/share/dict

2020-07-15 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Thu Jul 16 03:08:58 UTC 2020

Modified Files:
src/share/dict: web2

Log Message:
+craptacular

(originally suggested by pgoyette)


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/share/dict/web2

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

Modified files:

Index: src/share/dict/web2
diff -u src/share/dict/web2:1.53 src/share/dict/web2:1.54
--- src/share/dict/web2:1.53	Mon Jul 13 23:56:41 2020
+++ src/share/dict/web2	Thu Jul 16 03:08:58 2020
@@ -45097,6 +45097,7 @@ crapple
 crappo
 craps
 crapshooter
+craptacular
 crapulate
 crapulence
 crapulent



CVS commit: src/share/dict

2020-07-13 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jul 13 23:56:42 UTC 2020

Modified Files:
src/share/dict: web2

Log Message:
+corvid

This file already has "covid" somehow, and while that's fine now my
best guess is that it was originally an OCR blooper for "corvid",
which is missing.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/share/dict/web2

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

Modified files:

Index: src/share/dict/web2
diff -u src/share/dict/web2:1.52 src/share/dict/web2:1.53
--- src/share/dict/web2:1.52	Sun Jul 15 06:40:39 2018
+++ src/share/dict/web2	Mon Jul 13 23:56:41 2020
@@ -43571,6 +43571,7 @@ coruscation
 corver
 corvette
 corvetto
+corvid
 Corvidae
 corviform
 corvillosum



CVS commit: src/games/hangman

2020-07-11 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jul 12 02:34:54 UTC 2020

Modified Files:
src/games/hangman: prdata.c

Log Message:
Avoid messing up the display when too many letters are guessed at once.

The field to put them in was made 26 characters wide... but includes
the string "Guessed: ". So if you get to 17 it wraps to the next line
and clreol()'s it. Instead, when reaching this point step on the
"Guessed:" string instead.

Reported by phil@.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/games/hangman/prdata.c

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

Modified files:

Index: src/games/hangman/prdata.c
diff -u src/games/hangman/prdata.c:1.7 src/games/hangman/prdata.c:1.8
--- src/games/hangman/prdata.c:1.7	Sat Oct 13 21:03:09 2012
+++ src/games/hangman/prdata.c	Sun Jul 12 02:34:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: prdata.c,v 1.7 2012/10/13 21:03:09 dholland Exp $	*/
+/*	$NetBSD: prdata.c,v 1.8 2020/07/12 02:34:54 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)prdata.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: prdata.c,v 1.7 2012/10/13 21:03:09 dholland Exp $");
+__RCSID("$NetBSD: prdata.c,v 1.8 2020/07/12 02:34:54 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -47,9 +47,17 @@ __RCSID("$NetBSD: prdata.c,v 1.7 2012/10
 void
 prdata(void)
 {
-	int i;
+	int i, n, l;
 
-	move(GUESSY, GUESSX + sizeof "Guessed: ");
+	for (i = n = 0; i < 26; i++)
+		if (Guessed[i])
+			n++;
+
+	move(GUESSY, GUESSX);
+	l = sizeof "Guessed: ";
+	if (GUESSX + l + n < COLS) {
+		addstr("Guessed: ");
+	}
 	for (i = 0; i < 26; i++)
 		if (Guessed[i])
 			addch(i + 'a');



CVS commit: src/sys/compat/sunos

2020-06-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Thu Jun 11 03:47:05 UTC 2020

Modified Files:
src/sys/compat/sunos: sunos_syscall.h sunos_syscallargs.h
sunos_syscalls.c sunos_sysent.c

Log Message:
Regen after -r1.82 of compat_sunos syscalls.master last September.

(Apparently forgotten.)

"Treat valsize as unsigned"


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/compat/sunos/sunos_syscall.h
cvs rdiff -u -r1.82 -r1.83 src/sys/compat/sunos/sunos_syscallargs.h
cvs rdiff -u -r1.97 -r1.98 src/sys/compat/sunos/sunos_syscalls.c
cvs rdiff -u -r1.93 -r1.94 src/sys/compat/sunos/sunos_sysent.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/sunos/sunos_syscall.h
diff -u src/sys/compat/sunos/sunos_syscall.h:1.98 src/sys/compat/sunos/sunos_syscall.h:1.99
--- src/sys/compat/sunos/sunos_syscall.h:1.98	Sun Jan 27 02:08:40 2019
+++ src/sys/compat/sunos/sunos_syscall.h	Thu Jun 11 03:47:05 2020
@@ -1,10 +1,10 @@
-/* $NetBSD: sunos_syscall.h,v 1.98 2019/01/27 02:08:40 pgoyette Exp $ */
+/* $NetBSD: sunos_syscall.h,v 1.99 2020/06/11 03:47:05 dholland Exp $ */
 
 /*
  * System call numbers.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.80.2.2 2018/09/29 02:29:42 pgoyette Exp
+ * created from	NetBSD: syscalls.master,v 1.82 2019/09/23 20:42:29 christos Exp
  */
 
 #ifndef _SUNOS_SYS_SYSCALL_H_
@@ -245,7 +245,7 @@
 /* syscall: "bind" ret: "int" args: "int" "void *" "int" */
 #define	SUNOS_SYS_bind	104
 
-/* syscall: "setsockopt" ret: "int" args: "int" "int" "int" "void *" "int" */
+/* syscall: "setsockopt" ret: "int" args: "int" "int" "int" "void *" "u_int" */
 #define	SUNOS_SYS_setsockopt	105
 
 /* syscall: "listen" ret: "int" args: "int" "int" */

Index: src/sys/compat/sunos/sunos_syscallargs.h
diff -u src/sys/compat/sunos/sunos_syscallargs.h:1.82 src/sys/compat/sunos/sunos_syscallargs.h:1.83
--- src/sys/compat/sunos/sunos_syscallargs.h:1.82	Sun Jan 27 02:08:40 2019
+++ src/sys/compat/sunos/sunos_syscallargs.h	Thu Jun 11 03:47:05 2020
@@ -1,10 +1,10 @@
-/* $NetBSD: sunos_syscallargs.h,v 1.82 2019/01/27 02:08:40 pgoyette Exp $ */
+/* $NetBSD: sunos_syscallargs.h,v 1.83 2020/06/11 03:47:05 dholland Exp $ */
 
 /*
  * System call argument lists.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.80.2.2 2018/09/29 02:29:42 pgoyette Exp
+ * created from	NetBSD: syscalls.master,v 1.82 2019/09/23 20:42:29 christos Exp
  */
 
 #ifndef _SUNOS_SYS_SYSCALLARGS_H_
@@ -246,7 +246,7 @@ struct sunos_sys_setsockopt_args {
 	syscallarg(int) level;
 	syscallarg(int) name;
 	syscallarg(void *) val;
-	syscallarg(int) valsize;
+	syscallarg(u_int) valsize;
 };
 check_syscall_args(sunos_sys_setsockopt)
 

Index: src/sys/compat/sunos/sunos_syscalls.c
diff -u src/sys/compat/sunos/sunos_syscalls.c:1.97 src/sys/compat/sunos/sunos_syscalls.c:1.98
--- src/sys/compat/sunos/sunos_syscalls.c:1.97	Sun Jan 27 02:08:40 2019
+++ src/sys/compat/sunos/sunos_syscalls.c	Thu Jun 11 03:47:05 2020
@@ -1,14 +1,14 @@
-/* $NetBSD: sunos_syscalls.c,v 1.97 2019/01/27 02:08:40 pgoyette Exp $ */
+/* $NetBSD: sunos_syscalls.c,v 1.98 2020/06/11 03:47:05 dholland Exp $ */
 
 /*
  * System call names.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.80.2.2 2018/09/29 02:29:42 pgoyette Exp
+ * created from	NetBSD: syscalls.master,v 1.82 2019/09/23 20:42:29 christos Exp
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunos_syscalls.c,v 1.97 2019/01/27 02:08:40 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunos_syscalls.c,v 1.98 2020/06/11 03:47:05 dholland Exp $");
 
 #if defined(_KERNEL_OPT)
 #if defined(_KERNEL_OPT)

Index: src/sys/compat/sunos/sunos_sysent.c
diff -u src/sys/compat/sunos/sunos_sysent.c:1.93 src/sys/compat/sunos/sunos_sysent.c:1.94
--- src/sys/compat/sunos/sunos_sysent.c:1.93	Sun Jan 27 02:08:40 2019
+++ src/sys/compat/sunos/sunos_sysent.c	Thu Jun 11 03:47:05 2020
@@ -1,14 +1,14 @@
-/* $NetBSD: sunos_sysent.c,v 1.93 2019/01/27 02:08:40 pgoyette Exp $ */
+/* $NetBSD: sunos_sysent.c,v 1.94 2020/06/11 03:47:05 dholland Exp $ */
 
 /*
  * System call switch table.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.80.2.2 2018/09/29 02:29:42 pgoyette Exp
+ * created from	NetBSD: syscalls.master,v 1.82 2019/09/23 20:42:29 christos Exp
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunos_sysent.c,v 1.93 2019/01/27 02:08:40 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunos_sysent.c,v 1.94 2020/06/11 03:47:05 dholland Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_sysv.h"



CVS commit: src/sys

2020-06-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Thu Jun 11 03:45:31 UTC 2020

Modified Files:
src/sys/kern: init_sysent.c syscalls.c syscalls_autoload.c
systrace_args.c
src/sys/rump/include/rump: rump_syscalls.h
src/sys/rump/librump/rumpkern: rump_syscalls.c
src/sys/sys: syscall.h syscallargs.h

Log Message:
Regen with new makesyscalls.

(the large diff of rump_syscalls.h has been checked and was the point
of the makesyscalls change)


To generate a diff of this commit:
cvs rdiff -u -r1.334 -r1.335 src/sys/kern/init_sysent.c
cvs rdiff -u -r1.322 -r1.323 src/sys/kern/syscalls.c
cvs rdiff -u -r1.39 -r1.40 src/sys/kern/syscalls_autoload.c
cvs rdiff -u -r1.41 -r1.42 src/sys/kern/systrace_args.c
cvs rdiff -u -r1.121 -r1.122 src/sys/rump/include/rump/rump_syscalls.h
cvs rdiff -u -r1.152 -r1.153 src/sys/rump/librump/rumpkern/rump_syscalls.c
cvs rdiff -u -r1.316 -r1.317 src/sys/sys/syscall.h
cvs rdiff -u -r1.300 -r1.301 src/sys/sys/syscallargs.h

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

Modified files:

Index: src/sys/kern/init_sysent.c
diff -u src/sys/kern/init_sysent.c:1.334 src/sys/kern/init_sysent.c:1.335
--- src/sys/kern/init_sysent.c:1.334	Tue Jun  2 17:23:21 2020
+++ src/sys/kern/init_sysent.c	Thu Jun 11 03:45:30 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: init_sysent.c,v 1.334 2020/06/02 17:23:21 kamil Exp $ */
+/* $NetBSD: init_sysent.c,v 1.335 2020/06/11 03:45:30 dholland Exp $ */
 
 /*
  * System call switch table.
@@ -8,7 +8,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: init_sysent.c,v 1.334 2020/06/02 17:23:21 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_sysent.c,v 1.335 2020/06/11 03:45:30 dholland Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_modular.h"

Index: src/sys/kern/syscalls.c
diff -u src/sys/kern/syscalls.c:1.322 src/sys/kern/syscalls.c:1.323
--- src/sys/kern/syscalls.c:1.322	Tue Jun  2 17:23:21 2020
+++ src/sys/kern/syscalls.c	Thu Jun 11 03:45:30 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: syscalls.c,v 1.322 2020/06/02 17:23:21 kamil Exp $ */
+/* $NetBSD: syscalls.c,v 1.323 2020/06/11 03:45:30 dholland Exp $ */
 
 /*
  * System call names.
@@ -8,7 +8,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: syscalls.c,v 1.322 2020/06/02 17:23:21 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscalls.c,v 1.323 2020/06/11 03:45:30 dholland Exp $");
 
 #if defined(_KERNEL_OPT)
 #ifdef _KERNEL_OPT

Index: src/sys/kern/syscalls_autoload.c
diff -u src/sys/kern/syscalls_autoload.c:1.39 src/sys/kern/syscalls_autoload.c:1.40
--- src/sys/kern/syscalls_autoload.c:1.39	Tue Jun  2 17:23:21 2020
+++ src/sys/kern/syscalls_autoload.c	Thu Jun 11 03:45:30 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: syscalls_autoload.c,v 1.39 2020/06/02 17:23:21 kamil Exp $ */
+/* $NetBSD: syscalls_autoload.c,v 1.40 2020/06/11 03:45:30 dholland Exp $ */
 
 /*
  * System call autoload table.
@@ -8,7 +8,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: syscalls_autoload.c,v 1.39 2020/06/02 17:23:21 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscalls_autoload.c,v 1.40 2020/06/11 03:45:30 dholland Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_modular.h"

Index: src/sys/kern/systrace_args.c
diff -u src/sys/kern/systrace_args.c:1.41 src/sys/kern/systrace_args.c:1.42
--- src/sys/kern/systrace_args.c:1.41	Tue Jun  2 17:23:21 2020
+++ src/sys/kern/systrace_args.c	Thu Jun 11 03:45:30 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: systrace_args.c,v 1.41 2020/06/02 17:23:21 kamil Exp $ */
+/* $NetBSD: systrace_args.c,v 1.42 2020/06/11 03:45:30 dholland Exp $ */
 
 /*
  * System call argument to DTrace register array converstion.

Index: src/sys/rump/include/rump/rump_syscalls.h
diff -u src/sys/rump/include/rump/rump_syscalls.h:1.121 src/sys/rump/include/rump/rump_syscalls.h:1.122
--- src/sys/rump/include/rump/rump_syscalls.h:1.121	Tue Jun  2 17:23:22 2020
+++ src/sys/rump/include/rump/rump_syscalls.h	Thu Jun 11 03:45:30 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: rump_syscalls.h,v 1.121 2020/06/02 17:23:22 kamil Exp $ */
+/* $NetBSD: rump_syscalls.h,v 1.122 2020/06/11 03:45:30 dholland Exp $ */
 
 /*
  * System call protos in rump namespace.
@@ -16,832 +16,832 @@
 
 #include 
 
-#ifndef RUMP_SYS_RENAME_FKTRACE
-#define RUMP_SYS_RENAME_FKTRACE rump___sysimpl_fktrace
+#ifndef RUMP_SYS_RENAME___GETCWD
+#define RUMP_SYS_RENAME___GETCWD rump___sysimpl___getcwd
 #endif
 
-#ifndef RUMP_SYS_RENAME_GETSID
-#define RUMP_SYS_RENAME_GETSID rump___sysimpl_getsid
+#ifndef RUMP_SYS_RENAME___GETLOGIN
+#define RUMP_SYS_RENAME___GETLOGIN rump___sysimpl___getlogin
 #endif
 
-#ifndef RUMP_SYS_RENAME_RECVMMSG
-#define RUMP_SYS_RENAME_RECVMMSG rump___sysimpl_recvmmsg
+#ifndef RUMP_SYS_RENAME___POSIX_CHOWN
+#define RUMP_SYS_RENAME___POSIX_CHOWN rump___sysimpl___posix_chown
 #endif
 
-#ifndef RUMP_SYS_RENAME_UTIMENSAT
-#define RUMP_SYS_RENAME_UTIMENSAT rump___sysimpl_utimensat
+#ifndef RUMP_SYS_RENAME___POSIX_FCHOWN
+#define RUMP_SYS_RENAME___POSIX_FCHOWN 

CVS commit: src/sys/kern

2020-06-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Thu Jun 11 03:25:35 UTC 2020

Modified Files:
src/sys/kern: makesyscalls.sh

Log Message:
Don't output things in awk hash order. Sort first.


To generate a diff of this commit:
cvs rdiff -u -r1.180 -r1.181 src/sys/kern/makesyscalls.sh

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/makesyscalls.sh
diff -u src/sys/kern/makesyscalls.sh:1.180 src/sys/kern/makesyscalls.sh:1.181
--- src/sys/kern/makesyscalls.sh:1.180	Thu Jun 11 02:21:26 2020
+++ src/sys/kern/makesyscalls.sh	Thu Jun 11 03:25:35 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: makesyscalls.sh,v 1.180 2020/06/11 02:21:26 dholland Exp $
+#	$NetBSD: makesyscalls.sh,v 1.181 2020/06/11 03:25:35 dholland Exp $
 #
 # Copyright (c) 1994, 1996, 2000 Christopher G. Demetriou
 # All rights reserved.
@@ -,6 +,24 @@ $2 == "EXTERN" {
 	printf("%s: line %d: unrecognized keyword %s\n", infile, NR, $2)
 	exit 1
 }
+
+function sort(arr, n,i, j, t) {
+	# this is going to be bubble sort because I cannot be bothered to
+	# write a real sort, this whole script is hopefully going to be
+	# deprecated before much longer, and performance of a few hundred
+	# things (even interpreted in awk) should be adequate.
+	for (i = 1; i <= n; i++) {
+		for (j = i + 1; j <= n; j++) {
+			if (arr[j] < arr[i]) {
+t = arr[i];
+arr[i] = arr[j];
+arr[j] = t;
+			}
+		}
+	}
+	return 0;
+}
+
 END {
 	# output pipe() syscall with its special retval[2] handling
 	if (rumphaspipe) {
@@ -1134,7 +1152,15 @@ END {
 	}
 
 	# print default rump syscall interfaces
+	# be sure to generate them in a deterministic order, not awk
+	# hash order as would happen with a plain "for (var in funcseen)"
+	numfuncseenvars = 0;
 	for (var in funcseen) {
+		funcseenvars[++numfuncseenvars] = var;
+	}
+	sort(funcseenvars, numfuncseenvars)
+	for (i = 1; i <= numfuncseenvars; i++) {
+		var = funcseenvars[i];
 		printf("#ifndef RUMP_SYS_RENAME_%s\n", \
 		toupper(var)) > rumpcallshdr
 		printf("#define RUMP_SYS_RENAME_%s rump___sysimpl_%s\n", \



CVS commit: src/sys/kern

2020-06-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Thu Jun 11 02:21:26 UTC 2020

Modified Files:
src/sys/kern: makesyscalls.sh

Log Message:
fix awk-induced bug (using wrong variable, getting away with it by luck)


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/sys/kern/makesyscalls.sh

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/makesyscalls.sh
diff -u src/sys/kern/makesyscalls.sh:1.179 src/sys/kern/makesyscalls.sh:1.180
--- src/sys/kern/makesyscalls.sh:1.179	Tue Jun  9 04:48:45 2020
+++ src/sys/kern/makesyscalls.sh	Thu Jun 11 02:21:26 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: makesyscalls.sh,v 1.179 2020/06/09 04:48:45 dholland Exp $
+#	$NetBSD: makesyscalls.sh,v 1.180 2020/06/11 02:21:26 dholland Exp $
 #
 # Copyright (c) 1994, 1996, 2000 Christopher G. Demetriou
 # All rights reserved.
@@ -756,7 +756,7 @@ function printproto(wrap) {
 	}
 }
 
-function printrumpsysent(insysent, compatwrap) {
+function printrumpsysent(insysent, compatwrap_) {
 	if (modular) {
 		fn = rumpnomodule
 		flags = rumpnoflags
@@ -941,7 +941,7 @@ function putent(type, compatwrap) {
 	} else {
 		insysent = 1
 	}
-	printrumpsysent(insysent, compatwrap)
+	printrumpsysent(insysent, compatwrap_)
 
 	# output rump marshalling code if necessary
 	if (!rumpable) {



CVS commit: src/sys/kern

2020-06-08 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Jun  9 04:48:45 UTC 2020

Modified Files:
src/sys/kern: makesyscalls.sh

Log Message:
Update wrong and obsolete comments.

... when you change the set of syscalls.conf keywords this thing
recognizes, updating the documentation too (which AFAIK is limited to
the comment in here) is always helpful ...


To generate a diff of this commit:
cvs rdiff -u -r1.178 -r1.179 src/sys/kern/makesyscalls.sh

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/makesyscalls.sh
diff -u src/sys/kern/makesyscalls.sh:1.178 src/sys/kern/makesyscalls.sh:1.179
--- src/sys/kern/makesyscalls.sh:1.178	Tue Jun  2 16:45:42 2020
+++ src/sys/kern/makesyscalls.sh	Tue Jun  9 04:48:45 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: makesyscalls.sh,v 1.178 2020/06/02 16:45:42 kamil Exp $
+#	$NetBSD: makesyscalls.sh,v 1.179 2020/06/09 04:48:45 dholland Exp $
 #
 # Copyright (c) 1994, 1996, 2000 Christopher G. Demetriou
 # All rights reserved.
@@ -47,6 +47,8 @@ esac
 #	syssw		the syscall switch file
 #	sysautoload	the syscall autoload definitions file
 #	sysarghdr	the syscall argument struct definitions
+#	sysarghdrextra	extra stuff dumped into sysarghdr
+#	systrace	the dtrace definitions
 #	compatopts	those syscall types that are for 'compat' syscalls
 #	switchname	the name for the 'struct sysent' we define
 #	namesname	the name for the 'const char *[]' we define
@@ -57,6 +59,9 @@ esac
 #	sys_nosys	[optional] name of function called for unsupported
 #			syscalls, if not sys_nosys()
 #   maxsysargs	[optiona] the maximum number or arguments
+#	rumpcalls	???
+#	rumpcallshdr	???
+#	rumpsysmap	???
 #
 # NOTE THAT THIS makesyscalls.sh DOES NOT SUPPORT 'SYSLIBCOMPAT'.
 
@@ -143,7 +148,7 @@ function toupper(str) {
 fi
 
 # before handing it off to awk, make a few adjustments:
-#	(1) insert spaces around {, }, (, ), *, and commas.
+#	(1) insert spaces around {, }, (, ), *, |, and commas.
 #	(2) get rid of any and all dollar signs (so that rcs id use safe)
 #
 # The awk script will deal with blank lines and lines that



CVS commit: src/lib/libc/string

2020-04-04 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Apr  4 21:29:54 UTC 2020

Modified Files:
src/lib/libc/string: strerror.3

Log Message:
Move the note about sys_errlist[] users to COMPATIBILITY, and strengthen it.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/lib/libc/string/strerror.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/string/strerror.3
diff -u src/lib/libc/string/strerror.3:1.23 src/lib/libc/string/strerror.3:1.24
--- src/lib/libc/string/strerror.3:1.23	Sat Apr  4 21:26:44 2020
+++ src/lib/libc/string/strerror.3	Sat Apr  4 21:29:54 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: strerror.3,v 1.23 2020/04/04 21:26:44 dholland Exp $
+.\" $NetBSD: strerror.3,v 1.24 2020/04/04 21:29:54 dholland Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -209,6 +209,13 @@ The use of these variables is deprecated
 one of the
 .Fn strerror
 family of functions should be used instead.
+.Sh COMPATIBILITY
+Programs that attempt to use the deprecated
+.Va sys_errlist
+variable often fail to compile because they provide their own,
+inconsistent, declaration of it.
+Such programs should be updated to use
+.Fn strerror .
 .Sh ERRORS
 These functions may fail if:
 .Bl -tag -width Er
@@ -280,8 +287,3 @@ and
 .Fn strerror_l
 use the same thread local storage; a call to either will destroy
 the result from an earlier call by the same thread of either of them.
-.Pp
-Programs that use the deprecated
-.Va sys_errlist
-variable often fail to compile because they declare it
-inconsistently.



CVS commit: src/lib/libc/string

2020-04-04 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Apr  4 21:26:44 UTC 2020

Modified Files:
src/lib/libc/string: strerror.3

Log Message:
Add missing ERRORS section.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/lib/libc/string/strerror.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/string/strerror.3
diff -u src/lib/libc/string/strerror.3:1.22 src/lib/libc/string/strerror.3:1.23
--- src/lib/libc/string/strerror.3:1.22	Sat Apr  4 21:20:39 2020
+++ src/lib/libc/string/strerror.3	Sat Apr  4 21:26:44 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: strerror.3,v 1.22 2020/04/04 21:20:39 dholland Exp $
+.\" $NetBSD: strerror.3,v 1.23 2020/04/04 21:26:44 dholland Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -209,6 +209,15 @@ The use of these variables is deprecated
 one of the
 .Fn strerror
 family of functions should be used instead.
+.Sh ERRORS
+These functions may fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The error number was out of range.
+.It Bq Er ERANGE
+The string buffer supplied was not large enough to hold the complete
+error message.
+.El
 .Sh SEE ALSO
 .Xr intro 2 ,
 .Xr err 3 ,



CVS commit: src/lib/libc/string

2020-04-04 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Apr  4 21:20:39 UTC 2020

Modified Files:
src/lib/libc/string: strerror.3

Log Message:
Minor clarification. And a typo. Bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/lib/libc/string/strerror.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/string/strerror.3
diff -u src/lib/libc/string/strerror.3:1.21 src/lib/libc/string/strerror.3:1.22
--- src/lib/libc/string/strerror.3:1.21	Wed Mar 25 18:50:47 2020
+++ src/lib/libc/string/strerror.3	Sat Apr  4 21:20:39 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: strerror.3,v 1.21 2020/03/25 18:50:47 kre Exp $
+.\" $NetBSD: strerror.3,v 1.22 2020/04/04 21:20:39 dholland Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\" @(#)strerror.3	8.1 (Berkeley) 6/9/93
-.Dd March 24, 2020
+.Dd April 4, 2020
 .Dt STRERROR 3
 .Os
 .Sh NAME
@@ -88,7 +88,7 @@ function renders the same result into
 .Fa strerrbuf
 for a maximum of
 .Fa buflen
-characters and returns 0 upon success.
+characters (including terminator) and returns 0 upon success.
 .Pp
 The
 .Fn strerror_l
@@ -269,7 +269,7 @@ Both
 .Fn strerror
 and
 .Fn strerror_l
-use the same thread local storage, a call to either will destroy
+use the same thread local storage; a call to either will destroy
 the result from an earlier call by the same thread of either of them.
 .Pp
 Programs that use the deprecated



CVS commit: src/games/fortune/datfiles

2020-02-16 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Feb 16 23:14:19 UTC 2020

Modified Files:
src/games/fortune/datfiles: fortunes

Log Message:
something I apparently forgot to commit months or years ago


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/games/fortune/datfiles/fortunes

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

Modified files:

Index: src/games/fortune/datfiles/fortunes
diff -u src/games/fortune/datfiles/fortunes:1.86 src/games/fortune/datfiles/fortunes:1.87
--- src/games/fortune/datfiles/fortunes:1.86	Tue Dec  3 22:42:29 2019
+++ src/games/fortune/datfiles/fortunes	Sun Feb 16 23:14:19 2020
@@ -16289,3 +16289,6 @@ I wonder why I wonder.
 I wonder why I wonder why
 I wonder why I wonder!
 		-- Richard P. Feynman, "Always Trying to Escape"
+%
+Fanfare, n.:
+The food available for consumption at a con.



CVS commit: src/usr.bin/quota

2020-01-20 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan 20 21:38:30 UTC 2020

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

Log Message:
...and it seems that -d is no longer restricted to root.

(No particular reason it should be; I suspect this changed when we got
real quota plumbing as historically -d would have been a special case
of asking about another user.)


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/quota/quota.1

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

Modified files:

Index: src/usr.bin/quota/quota.1
diff -u src/usr.bin/quota/quota.1:1.21 src/usr.bin/quota/quota.1:1.22
--- src/usr.bin/quota/quota.1:1.21	Mon Jan 20 21:35:41 2020
+++ src/usr.bin/quota/quota.1	Mon Jan 20 21:38:29 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: quota.1,v 1.21 2020/01/20 21:35:41 dholland Exp $
+.\"	$NetBSD: quota.1,v 1.22 2020/01/20 21:38:29 dholland Exp $
 .\"
 .\" Copyright (c) 1983, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -99,10 +99,6 @@ argument with the
 .Fl g
 flag to view only the limits of groups they belong to.
 .Pp
-Only the super-user may use the
-.Fl d
-flag.
-.Pp
 The
 .Fl q
 flag takes precedence over the



CVS commit: src/usr.bin/quota

2020-01-20 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan 20 21:35:41 UTC 2020

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

Log Message:
Document the actual behavior of -g; clarify the optional user/group args.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/quota/quota.1

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

Modified files:

Index: src/usr.bin/quota/quota.1
diff -u src/usr.bin/quota/quota.1:1.20 src/usr.bin/quota/quota.1:1.21
--- src/usr.bin/quota/quota.1:1.20	Mon Jan 20 21:30:41 2020
+++ src/usr.bin/quota/quota.1	Mon Jan 20 21:35:41 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: quota.1,v 1.20 2020/01/20 21:30:41 dholland Exp $
+.\"	$NetBSD: quota.1,v 1.21 2020/01/20 21:35:41 dholland Exp $
 .\"
 .\" Copyright (c) 1983, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -66,7 +66,8 @@ Options:
 Query the kernel for default user or group quota instead of a specific
 user or group.
 .It Fl g
-Print group quotas for the group of which the user is a member.
+Print group quotas.
+By default, print group quotas for all groups the user belongs to.
 .It Fl h
 Numbers are displayed in a human readable format.
 .It Fl q
@@ -87,16 +88,16 @@ and
 displays both the user quotas and the group quotas (for
 the user).
 .Pp
-Only the super-user may use the
-.Fl u
-flag and the optional
+Only the super-user may use the optional
 .Ar user
-argument to view the limits of other users.
-Non-super-users can use the
-.Fl g
-flag and optional
+argument with the
+.Fl u
+flag to view quotas for other users.
+Non-super-users can use the optional
 .Ar group
-argument to view only the limits of groups of which they are members.
+argument with the
+.Fl g
+flag to view only the limits of groups they belong to.
 .Pp
 Only the super-user may use the
 .Fl d



CVS commit: src/usr.bin/quota

2020-01-20 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan 20 21:30:41 UTC 2020

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

Log Message:
Clarify -u.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/quota/quota.1

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

Modified files:

Index: src/usr.bin/quota/quota.1
diff -u src/usr.bin/quota/quota.1:1.19 src/usr.bin/quota/quota.1:1.20
--- src/usr.bin/quota/quota.1:1.19	Sat May 12 21:43:09 2012
+++ src/usr.bin/quota/quota.1	Mon Jan 20 21:30:41 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: quota.1,v 1.19 2012/05/12 21:43:09 wiz Exp $
+.\"	$NetBSD: quota.1,v 1.20 2020/01/20 21:30:41 dholland Exp $
 .\"
 .\" Copyright (c) 1983, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\"	from: @(#)quota.1	8.1 (Berkeley) 6/6/93
 .\"
-.Dd May 12, 2012
+.Dd Jan 20, 2020
 .Dt QUOTA 1
 .Os
 .Sh NAME
@@ -67,14 +67,14 @@ Query the kernel for default user or gro
 user or group.
 .It Fl g
 Print group quotas for the group of which the user is a member.
-The optional
-.Fl u
-flag is equivalent to the default.
 .It Fl h
 Numbers are displayed in a human readable format.
 .It Fl q
 Print a more terse message, containing only information
 on file systems where usage is over quota.
+.It Fl u
+Print user quotas.
+This is the default.
 .It Fl v
 .Nm
 will display quotas on file systems where no storage is allocated.



CVS commit: src/usr.sbin/arp

2019-02-27 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Feb 27 23:29:50 UTC 2019

Modified Files:
src/usr.sbin/arp: arp.c arp_hostops.c arp_rumpops.c prog_ops.h

Log Message:
Teach arp that it's okay to close sockets after using them.
(this requires adding a close op to the rump turds)

Fixes PR 53974 reporting too many open files.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/usr.sbin/arp/arp.c
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/arp/arp_hostops.c \
src/usr.sbin/arp/arp_rumpops.c src/usr.sbin/arp/prog_ops.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/arp/arp.c
diff -u src/usr.sbin/arp/arp.c:1.63 src/usr.sbin/arp/arp.c:1.64
--- src/usr.sbin/arp/arp.c:1.63	Tue Jul 31 09:45:52 2018
+++ src/usr.sbin/arp/arp.c	Wed Feb 27 23:29:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: arp.c,v 1.63 2018/07/31 09:45:52 nonaka Exp $ */
+/*	$NetBSD: arp.c,v 1.64 2019/02/27 23:29:50 dholland Exp $ */
 
 /*
  * Copyright (c) 1984, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1984, 19
 #if 0
 static char sccsid[] = "@(#)arp.c	8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: arp.c,v 1.63 2018/07/31 09:45:52 nonaka Exp $");
+__RCSID("$NetBSD: arp.c,v 1.64 2019/02/27 23:29:50 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -276,8 +276,10 @@ set(int argc, char **argv)
 	argc -= 2;
 	argv += 2;
 
-	if (getinetaddr(host, _m.sin_addr) == -1)
+	if (getinetaddr(host, _m.sin_addr) == -1) {
+		prog_close(s);
 		return (1);
+	}
 	if (strcmp(eaddr, "auto") != 0 && atosdl(eaddr, _m))
 		warnx("invalid link-level address '%s'", eaddr);
 	doing_proxy = flags = export_only = expire_time = 0;
@@ -310,13 +312,16 @@ set(int argc, char **argv)
 
 	}
 	if (doing_proxy && strcmp(eaddr, "auto") == 0) {
-		if (getetheraddr(sin_m.sin_addr, _m) == -1)
+		if (getetheraddr(sin_m.sin_addr, _m) == -1) {
+			prog_close(s);
 			return 1;
+		}
 	}
 tryagain:
 	rtm = rtmsg(s, RTM_GET, NULL, _m, _m);
 	if (rtm == NULL) {
 		warn("%s", host);
+		prog_close(s);
 		return (1);
 	}
 	sina = (struct sockaddr_inarp *)(void *)(rtm + 1);
@@ -327,10 +332,12 @@ tryagain:
 			goto overwrite;
 		if (doing_proxy == 0) {
 			warnx("set: can only proxy for %s", host);
+			prog_close(s);
 			return (1);
 		}
 		if (sin_m.sin_other & SIN_PROXY) {
 			warnx("set: proxy entry exists for non 802 device");
+			prog_close(s);
 			return (1);
 		}
 		sin_m.sin_other = SIN_PROXY;
@@ -341,6 +348,7 @@ overwrite:
 	if (sdl->sdl_family != AF_LINK) {
 		warnx("cannot intuit interface index and type for %s",
 		host);
+		prog_close(s);
 		return (1);
 	}
 	sdl_m.sdl_type = sdl->sdl_type;
@@ -351,6 +359,7 @@ overwrite:
 	rtm = rtmsg(s, RTM_ADD, NULL, _m, _m);
 	if (vflag)
 		(void)printf("%s (%s) added\n", host, eaddr);
+	prog_close(s);
 	return (rtm == NULL) ? 1 : 0;
 }
 
@@ -407,6 +416,7 @@ delete_one(struct rt_msghdr *rtm)
 	if (sdl->sdl_family != AF_LINK)
 		return (1);
 	rtm = rtmsg(s, RTM_DELETE, rtm, sina, sdl);
+	prog_close(s);
 	if (rtm == NULL)
 		return (1);
 	return (0);

Index: src/usr.sbin/arp/arp_hostops.c
diff -u src/usr.sbin/arp/arp_hostops.c:1.1 src/usr.sbin/arp/arp_hostops.c:1.2
--- src/usr.sbin/arp/arp_hostops.c:1.1	Wed Jul 29 06:07:35 2015
+++ src/usr.sbin/arp/arp_hostops.c	Wed Feb 27 23:29:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: arp_hostops.c,v 1.1 2015/07/29 06:07:35 ozaki-r Exp $	*/
+/*	$NetBSD: arp_hostops.c,v 1.2 2019/02/27 23:29:50 dholland Exp $	*/
 
 /*
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: arp_hostops.c,v 1.1 2015/07/29 06:07:35 ozaki-r Exp $");
+__RCSID("$NetBSD: arp_hostops.c,v 1.2 2019/02/27 23:29:50 dholland Exp $");
 #endif /* !lint */
 
 #include 
@@ -47,6 +47,7 @@ const struct prog_ops prog_ops = {
 
 	.op_read = read,
 	.op_write = write,
+	.op_close = close,
 
 	.op_sysctl = sysctl,
 };
Index: src/usr.sbin/arp/arp_rumpops.c
diff -u src/usr.sbin/arp/arp_rumpops.c:1.1 src/usr.sbin/arp/arp_rumpops.c:1.2
--- src/usr.sbin/arp/arp_rumpops.c:1.1	Wed Jul 29 06:07:35 2015
+++ src/usr.sbin/arp/arp_rumpops.c	Wed Feb 27 23:29:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: arp_rumpops.c,v 1.1 2015/07/29 06:07:35 ozaki-r Exp $	*/
+/*	$NetBSD: arp_rumpops.c,v 1.2 2019/02/27 23:29:50 dholland Exp $	*/
 
 /*
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: arp_rumpops.c,v 1.1 2015/07/29 06:07:35 ozaki-r Exp $");
+__RCSID("$NetBSD: arp_rumpops.c,v 1.2 2019/02/27 23:29:50 dholland Exp $");
 #endif /* !lint */
 
 #include 
@@ -51,6 +51,7 @@ const struct prog_ops prog_ops = {
 
 	.op_read =	rump_sys_read,
 	.op_write =	rump_sys_write,
+	.op_close =	rump_sys_close,
 
 	.op_sysctl =	rump_sys___sysctl,
 };
Index: src/usr.sbin/arp/prog_ops.h
diff -u src/usr.sbin/arp/prog_ops.h:1.1 src/usr.sbin/arp/prog_ops.h:1.2
--- src/usr.sbin/arp/prog_ops.h:1.1	Wed Jul 29 06:07:35 2015
+++ 

CVS commit: src/sys/ufs/ufs

2019-02-24 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Feb 25 06:00:40 UTC 2019

Modified Files:
src/sys/ufs/ufs: ufs_vnops.c

Log Message:
Revert -r1.244-245 of ufs_vnops.c; they are wrong.
Fix the mistake in -r1.243 that made them look like reasonable changes.

(this does not affect whether the -r1.243 change works with the union
mount path in libc, but fixes an immediate hazard)


To generate a diff of this commit:
cvs rdiff -u -r1.245 -r1.246 src/sys/ufs/ufs/ufs_vnops.c

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

Modified files:

Index: src/sys/ufs/ufs/ufs_vnops.c
diff -u src/sys/ufs/ufs/ufs_vnops.c:1.245 src/sys/ufs/ufs/ufs_vnops.c:1.246
--- src/sys/ufs/ufs/ufs_vnops.c:1.245	Mon Feb 25 00:51:24 2019
+++ src/sys/ufs/ufs/ufs_vnops.c	Mon Feb 25 06:00:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_vnops.c,v 1.245 2019/02/25 00:51:24 christos Exp $	*/
+/*	$NetBSD: ufs_vnops.c,v 1.246 2019/02/25 06:00:40 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.245 2019/02/25 00:51:24 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.246 2019/02/25 06:00:40 dholland Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -1246,7 +1246,7 @@ ufs_readdir(void *v)
 	size_t		numcookies, maxcookies;
 	/* disk buffer */
 	off_t		physstart, physend;
-	size_t		skipstart;
+	size_t		skipstart, dropend;
 	char		*rawbuf;
 	size_t		rawbufmax, rawbytes;
 	struct uio	rawuio;
@@ -1277,11 +1277,13 @@ ufs_readdir(void *v)
 	}
 
 	skipstart = startoffset - physstart;
+	dropend = endoffset - physend;
 
 	/* how much to actually read */
 	rawbufmax = callerbytes + skipstart;
 	if (rawbufmax < callerbytes)
 		return EINVAL;
+	rawbufmax -= dropend;
 
 	if (rawbufmax < _DIRENT_MINSIZE(rawdp)) {
 		/* no room for even one struct direct */



CVS commit: src/sys/dev/usb

2019-02-02 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Feb  2 19:02:59 UTC 2019

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

Log Message:
PR kern/53930 from "sc dying": uninitialized condvar in usmsc(4)


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/usb/if_smsc.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_smsc.c
diff -u src/sys/dev/usb/if_smsc.c:1.41 src/sys/dev/usb/if_smsc.c:1.42
--- src/sys/dev/usb/if_smsc.c:1.41	Sun Jan 27 02:08:42 2019
+++ src/sys/dev/usb/if_smsc.c	Sat Feb  2 19:02:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smsc.c,v 1.41 2019/01/27 02:08:42 pgoyette Exp $	*/
+/*	$NetBSD: if_smsc.c,v 1.42 2019/02/02 19:02:59 dholland Exp $	*/
 
 /*	$OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.41 2019/01/27 02:08:42 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.42 2019/02/02 19:02:59 dholland Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1091,7 +1091,9 @@ smsc_attach(device_t parent, device_t se
 
 	sc->sc_dev = self;
 	sc->sc_udev = dev;
+	sc->sc_dying = false;
 	sc->sc_stopping = false;
+	sc->sc_ttpending = false;
 
 	aprint_naive("\n");
 	aprint_normal("\n");
@@ -1146,6 +1148,7 @@ smsc_attach(device_t parent, device_t se
 	mutex_init(>sc_txlock, MUTEX_DEFAULT, IPL_SOFTUSB);
 	mutex_init(>sc_rxlock, MUTEX_DEFAULT, IPL_SOFTUSB);
 	mutex_init(>sc_mii_lock, MUTEX_DEFAULT, IPL_NONE);
+	cv_init(>sc_detachcv, "smsc_det");
 
 	ifp = >sc_ec.ec_if;
 	ifp->if_softc = sc;



CVS commit: src/sys/arch

2019-01-27 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan 28 02:29:01 UTC 2019

Modified Files:
src/sys/arch/aarch64/conf: majors.aarch64
src/sys/arch/acorn32/conf: majors.acorn32
src/sys/arch/algor/conf: majors.algor
src/sys/arch/alpha/conf: majors.alpha
src/sys/arch/amd64/conf: majors.amd64
src/sys/arch/amiga/conf: majors.amiga
src/sys/arch/amigappc/conf: majors.amigappc
src/sys/arch/arc/conf: majors.arc
src/sys/arch/arm/conf: majors.arm32
src/sys/arch/atari/conf: majors.atari
src/sys/arch/bebox/conf: majors.bebox
src/sys/arch/cesfic/conf: majors.cesfic
src/sys/arch/cobalt/conf: majors.cobalt
src/sys/arch/dreamcast/conf: majors.dreamcast
src/sys/arch/epoc32/conf: majors.epoc32
src/sys/arch/evbcf/conf: majors.evbcf
src/sys/arch/evbmips/conf: majors.evbmips
src/sys/arch/evbppc/conf: majors.evbppc
src/sys/arch/evbsh3/conf: majors.evbsh3
src/sys/arch/ews4800mips/conf: majors.ews4800mips
src/sys/arch/hp300/conf: majors.hp300
src/sys/arch/hpcarm/conf: majors.hpcarm
src/sys/arch/hpcmips/conf: majors.hpcmips
src/sys/arch/hpcsh/conf: majors.hpcsh
src/sys/arch/i386/conf: majors.i386
src/sys/arch/ia64/conf: majors.ia64
src/sys/arch/ibmnws/conf: majors.ibmnws
src/sys/arch/landisk/conf: majors.landisk
src/sys/arch/luna68k/conf: majors.luna68k
src/sys/arch/mac68k/conf: majors.mac68k
src/sys/arch/mipsco/conf: majors.mipsco
src/sys/arch/mmeye/conf: majors.mmeye
src/sys/arch/mvme68k/conf: majors.mvme68k
src/sys/arch/mvmeppc/conf: majors.mvmeppc
src/sys/arch/news68k/conf: majors.news68k
src/sys/arch/newsmips/conf: majors.newsmips
src/sys/arch/next68k/conf: majors.next68k
src/sys/arch/playstation2/conf: majors.playstation2
src/sys/arch/pmax/conf: majors.pmax
src/sys/arch/powerpc/conf: majors.powerpc
src/sys/arch/prep/conf: majors.prep
src/sys/arch/riscv/conf: majors.riscv
src/sys/arch/sgimips/conf: majors.sgimips
src/sys/arch/shark/conf: majors.shark
src/sys/arch/sparc/conf: majors.sparc
src/sys/arch/sparc64/conf: majors.sparc64
src/sys/arch/sun2/conf: majors.sun2
src/sys/arch/sun3/conf: majors.sun3
src/sys/arch/vax/conf: majors.vax
src/sys/arch/x68k/conf: majors.x68k
src/sys/arch/zaurus/conf: majors.zaurus

Log Message:
Systematize handling of removed drivers.

 - Every driver that was removed and whose number hasn't already been
   reused is now listed with a commented-out "obsolete" line.
 - The format of these has been systematized. Future format changes can
   probably be safely done with a script.
 - This does not include a few cases of assignments that only lasted a
   couple days, or stuff from before major reorgs. Some of these may
   be included nonetheless, because there was a lot of ground to cover
   and therefore not a lot of time to dig into history in detail.

Note that the obsolete listings do not mean the major numbers can
never be reused; that's up to portmasters and/or core. It does mean
that they won't be reused by accident, however, which in some cases
(depending on the driver, how widely used it was, its family of device
nodes, their default permissions, etc.) can be quite dangerous.

Note that some of the things now explicitly listed as obsolete are
really ancient history. My scan went back as far as when the majors
files were added. (But not before that.)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/aarch64/conf/majors.aarch64
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/acorn32/conf/majors.acorn32
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/algor/conf/majors.algor
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/alpha/conf/majors.alpha
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/amd64/conf/majors.amd64
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/amiga/conf/majors.amiga
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/amigappc/conf/majors.amigappc
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arc/conf/majors.arc
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/arm/conf/majors.arm32
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/atari/conf/majors.atari
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/bebox/conf/majors.bebox
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/cesfic/conf/majors.cesfic
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/cobalt/conf/majors.cobalt
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/dreamcast/conf/majors.dreamcast
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/epoc32/conf/majors.epoc32
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbcf/conf/majors.evbcf
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/evbmips/conf/majors.evbmips
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/evbppc/conf/majors.evbppc
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/evbsh3/conf/majors.evbsh3
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/ews4800mips/conf/majors.ews4800mips
cvs 

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

2019-01-27 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 27 18:00:06 UTC 2019

Modified Files:
src/sys/arch/riscv/conf: majors.riscv

Log Message:
This may have been cutpasted from evbmips, but we don't need to say so.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/riscv/conf/majors.riscv

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/riscv/conf/majors.riscv
diff -u src/sys/arch/riscv/conf/majors.riscv:1.5 src/sys/arch/riscv/conf/majors.riscv:1.6
--- src/sys/arch/riscv/conf/majors.riscv:1.5	Sun Jan 27 17:59:23 2019
+++ src/sys/arch/riscv/conf/majors.riscv	Sun Jan 27 18:00:06 2019
@@ -1,6 +1,6 @@
-#	$NetBSD: majors.riscv,v 1.5 2019/01/27 17:59:23 dholland Exp $
+#	$NetBSD: majors.riscv,v 1.6 2019/01/27 18:00:06 dholland Exp $
 #
-# Device majors for evbmips
+# Device majors for riscv
 #
 
 device-major	tun		char 7			tun



CVS commit: src/sys/arch

2019-01-27 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 27 17:59:23 UTC 2019

Modified Files:
src/sys/arch/algor/conf: majors.algor
src/sys/arch/alpha/conf: majors.alpha
src/sys/arch/amd64/conf: majors.amd64
src/sys/arch/bebox/conf: majors.bebox
src/sys/arch/evbmips/conf: majors.evbmips
src/sys/arch/i386/conf: majors.i386
src/sys/arch/ia64/conf: majors.ia64
src/sys/arch/ibmnws/conf: majors.ibmnws
src/sys/arch/mvmeppc/conf: majors.mvmeppc
src/sys/arch/powerpc/conf: majors.powerpc
src/sys/arch/prep/conf: majors.prep
src/sys/arch/riscv/conf: majors.riscv

Log Message:
Restore satlink's majors entries commented out and marked obsolete.
Otherwise they might accidentally get reused later and cause a
security problem.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/algor/conf/majors.algor
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/alpha/conf/majors.alpha
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/amd64/conf/majors.amd64
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/bebox/conf/majors.bebox
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/evbmips/conf/majors.evbmips
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/i386/conf/majors.i386
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/ia64/conf/majors.ia64
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/ibmnws/conf/majors.ibmnws
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/mvmeppc/conf/majors.mvmeppc
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/powerpc/conf/majors.powerpc
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/prep/conf/majors.prep
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/riscv/conf/majors.riscv

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/algor/conf/majors.algor
diff -u src/sys/arch/algor/conf/majors.algor:1.25 src/sys/arch/algor/conf/majors.algor:1.26
--- src/sys/arch/algor/conf/majors.algor:1.25	Sun Jan 27 08:53:29 2019
+++ src/sys/arch/algor/conf/majors.algor	Sun Jan 27 17:59:22 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: majors.algor,v 1.25 2019/01/27 08:53:29 maxv Exp $
+#	$NetBSD: majors.algor,v 1.26 2019/01/27 17:59:22 dholland Exp $
 #
 # Device majors for algor
 #
@@ -34,6 +34,7 @@ device-major	fd		char 34  block 0	fdc
 device-major	ipl		char 35			ipfilter
 device-major	wd		char 36  block 4	wd
 device-major	se		char 37			se
+#device-major	obsolete	char 38			obsolete (satlink)
 device-major	rnd		char 39			rnd
 
 device-major	scsibus		char 42			scsibus

Index: src/sys/arch/alpha/conf/majors.alpha
diff -u src/sys/arch/alpha/conf/majors.alpha:1.32 src/sys/arch/alpha/conf/majors.alpha:1.33
--- src/sys/arch/alpha/conf/majors.alpha:1.32	Sun Jan 27 08:53:29 2019
+++ src/sys/arch/alpha/conf/majors.alpha	Sun Jan 27 17:59:22 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: majors.alpha,v 1.32 2019/01/27 08:53:29 maxv Exp $
+#	$NetBSD: majors.alpha,v 1.33 2019/01/27 17:59:22 dholland Exp $
 #
 # Device majors for alpha
 #
@@ -35,6 +35,7 @@ device-major	fd		char 34  block 0	fdc
 device-major	ipl		char 35			ipfilter
 device-major	wd		char 36  block 4	wd
 device-major	se		char 37			se
+#device-major	obsolete	char 38			obsolete (satlink)
 device-major	rnd		char 39			rnd
 #device-major	obsolete	char 40			obsolete
 device-major	scsibus		char 42			scsibus

Index: src/sys/arch/amd64/conf/majors.amd64
diff -u src/sys/arch/amd64/conf/majors.amd64:1.30 src/sys/arch/amd64/conf/majors.amd64:1.31
--- src/sys/arch/amd64/conf/majors.amd64:1.30	Sun Jan 27 08:53:29 2019
+++ src/sys/arch/amd64/conf/majors.amd64	Sun Jan 27 17:59:22 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: majors.amd64,v 1.30 2019/01/27 08:53:29 maxv Exp $
+#	$NetBSD: majors.amd64,v 1.31 2019/01/27 17:59:22 dholland Exp $
 #
 # Device majors for amd64
 #
@@ -35,6 +35,7 @@ device-major	tun		char 40			tun
 device-major	vnd		char 41  block 14	vnd
 device-major	audio		char 42			audio
 device-major	ipl		char 44			ipfilter
+#device-major	obsolete	char 45			obsolete (satlink)
 device-major	rnd		char 46			rnd
 device-major	wsdisplay	char 47			wsdisplay
 device-major	wskbd		char 48			wskbd

Index: src/sys/arch/bebox/conf/majors.bebox
diff -u src/sys/arch/bebox/conf/majors.bebox:1.29 src/sys/arch/bebox/conf/majors.bebox:1.30
--- src/sys/arch/bebox/conf/majors.bebox:1.29	Sun Jan 27 08:53:29 2019
+++ src/sys/arch/bebox/conf/majors.bebox	Sun Jan 27 17:59:23 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: majors.bebox,v 1.29 2019/01/27 08:53:29 maxv Exp $
+#	$NetBSD: majors.bebox,v 1.30 2019/01/27 17:59:23 dholland Exp $
 #
 # Device majors for bebox
 #
@@ -40,6 +40,7 @@ device-major	tun		char 40			tun
 device-major	vnd		char 41  block 14	vnd
 device-major	audio		char 42			audio
 device-major	ipl		char 44			ipfilter
+#device-major	obsolete	char 45			obsolete (satlink)
 device-major	rnd		char 46			rnd
 device-major	wsdisplay	char 47			wsdisplay
 device-major	wskbd		char 48			wskbd

Index: src/sys/arch/evbmips/conf/majors.evbmips
diff -u src/sys/arch/evbmips/conf/majors.evbmips:1.32 

CVS commit: src/tools/m68k-elf2aout

2019-01-26 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 27 05:16:38 UTC 2019

Modified Files:
src/tools/m68k-elf2aout: Makefile

Log Message:
fix duplicated chunk from merge


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tools/m68k-elf2aout/Makefile

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

Modified files:

Index: src/tools/m68k-elf2aout/Makefile
diff -u src/tools/m68k-elf2aout/Makefile:1.4 src/tools/m68k-elf2aout/Makefile:1.5
--- src/tools/m68k-elf2aout/Makefile:1.4	Sun Jan 27 02:08:50 2019
+++ src/tools/m68k-elf2aout/Makefile	Sun Jan 27 05:16:38 2019
@@ -1,6 +1,4 @@
-#	$NetBSD: Makefile,v 1.4 2019/01/27 02:08:50 pgoyette Exp $
-
-.include 
+#	$NetBSD: Makefile,v 1.5 2019/01/27 05:16:38 dholland Exp $
 
 .include 
 



  1   2   3   4   5   6   7   8   9   10   >