CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2024-05-04 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat May  4 18:22:59 UTC 2024

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctfmerge.c

Log Message:
ctfmerge: obey CTFMERGE_TERMINATE_NO_UNLINK as a tool too


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.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/tools/ctf/cvt/ctfmerge.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.19 src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.20
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.19	Fri May  3 15:50:42 2024
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c	Sat May  4 18:22:59 2024
@@ -682,7 +682,7 @@ terminate_cleanup(void)
 	if (outfile == NULL)
 		return;
 
-#if !defined (__FreeBSD__) && !defined(__NetBSD__)
+#if !defined (__FreeBSD__) && !(defined(__NetBSD__) || HAVE_NBTOOL_CONFIG_H)
 	if (dounlink) {
 		fprintf(stderr, "Removing %s\n", outfile);
 		unlink(outfile);



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2024-05-04 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat May  4 18:22:59 UTC 2024

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctfmerge.c

Log Message:
ctfmerge: obey CTFMERGE_TERMINATE_NO_UNLINK as a tool too


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c

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



CVS commit: src/external/cddl/osnet/usr.bin/ctfmerge

2024-05-04 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat May  4 18:20:44 UTC 2024

Modified Files:
src/external/cddl/osnet/usr.bin/ctfmerge: ctfmerge.1

Log Message:
ctfmerge(1): brush up markup


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/usr.bin/ctfmerge/ctfmerge.1

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/usr.bin/ctfmerge/ctfmerge.1
diff -u src/external/cddl/osnet/usr.bin/ctfmerge/ctfmerge.1:1.4 src/external/cddl/osnet/usr.bin/ctfmerge/ctfmerge.1:1.5
--- src/external/cddl/osnet/usr.bin/ctfmerge/ctfmerge.1:1.4	Sat May  4 13:11:41 2024
+++ src/external/cddl/osnet/usr.bin/ctfmerge/ctfmerge.1	Sat May  4 18:20:44 2024
@@ -1,4 +1,4 @@
-.\" $NetBSD: ctfmerge.1,v 1.4 2024/05/04 13:11:41 christos Exp $
+.\" $NetBSD: ctfmerge.1,v 1.5 2024/05/04 18:20:44 uwe Exp $
 .\"
 .\" Copyright (c) 2010 The FreeBSD Foundation 
 .\" All rights reserved. 
@@ -41,7 +41,7 @@
 .Fl l Ar label
 .Fl L Ar labelenv
 .Fl o Ar outfile
-file ...
+.Ar
 .Nm
 .Op Fl fgstv
 .Fl l Ar label
@@ -50,14 +50,14 @@ file ...
 .Fl d Ar uniqfile
 .Op Fl g
 .Op Fl D Ar uniqlabel
-file ...
+.Ar
 .Nm
 .Op Fl fgstv
 .Fl l Ar label
 .Fl L Ar labelenv
 .Fl o Ar outfile
 .Fl w Ar withfile
-file ...
+.Ar
 .Nm
 .Op Fl g
 .Fl c Ar srcfile
@@ -69,13 +69,17 @@ utility merges several CTF data sections
 output file, unifying common data.
 .Pp
 The following options are available:
-.Bl -tag -width indent
+.Bl -tag -width Fl
 .It Fl f
 Match global symbols to global CTF data.
 .It Fl g
 Don't delete the original debugging sections.
 .It Fl s
-Use the .dynsym ELF section instead of the .symtab ELF section.
+Use the
+.Ql .dynsym
+ELF section instead of the
+.Ql .symtab
+ELF section.
 .It Fl t
 Make sure that all object files have a CTF section.
 .It Fl v
@@ -110,24 +114,32 @@ into
 .Sh ENVIRONMENT VARIABLES
 The following environment variables are used in
 .Nm :
-.Bl -tag -width x
-.It CTFMERGE_TERMINATE_NO_UNLINK
+.Bl -tag -width Ev
+.It Ev CTFMERGE_TERMINATE_NO_UNLINK
 Don't remove temporary files on exit, so that they can be examined
 for debugging.
-.It CTFMERGE_MAX_SLOTS
+.It Ev CTFMERGE_MAX_SLOTS
 Number of round-robin slots in the input queue that it is processed by
 worker threads.
-Each slot represents a file batch (default 5).
-.It CTFMERGE_PHASE1_BATCH_SIZE
-Number of files in a slot that are needed before processing starts (default 8).
-.It CTFMERGE_NUM_THREADS
+Each slot represents a file batch
+.Pq default 5 .
+.It Ev CTFMERGE_PHASE1_BATCH_SIZE
+Number of files in a slot that are needed before processing starts
+.Pq default 8 .
+.It Ev CTFMERGE_NUM_THREADS
 Set the number of worker threads.
 If the number of processors can be determined it defaults to
-min(processors * 3 / 2, nslots), if not it defaults to 2.
-.It CTFMERGE_INPUT_THROTTLE
-Max queue size to queue (defaults to 10).
-.It CTFMERGE_DEBUG_LEVEL
-Increase debugging verbosity (maximum is 3).
+.Fo min
+.Fa "processors\|*\|3\|/\|2"
+.Fa "nslots"
+.Fc
+if not it defaults to 2.
+.It Ev CTFMERGE_INPUT_THROTTLE
+Max queue size to queue
+.Pq defaults to 10 .
+.It Ev CTFMERGE_DEBUG_LEVEL
+Increase debugging verbosity
+.Pq maximum is 3 .
 .El
 .Sh EXIT STATUS
 .Ex -std



CVS commit: src/external/cddl/osnet/usr.bin/ctfmerge

2024-05-04 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat May  4 18:20:44 UTC 2024

Modified Files:
src/external/cddl/osnet/usr.bin/ctfmerge: ctfmerge.1

Log Message:
ctfmerge(1): brush up markup


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/usr.bin/ctfmerge/ctfmerge.1

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



CVS commit: src/external/cddl/osnet/usr.bin/ctfmerge

2024-05-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May  4 13:11:41 UTC 2024

Modified Files:
src/external/cddl/osnet/usr.bin/ctfmerge: ctfmerge.1

Log Message:
Document environment variable use.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/usr.bin/ctfmerge/ctfmerge.1

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/usr.bin/ctfmerge/ctfmerge.1
diff -u src/external/cddl/osnet/usr.bin/ctfmerge/ctfmerge.1:1.3 src/external/cddl/osnet/usr.bin/ctfmerge/ctfmerge.1:1.4
--- src/external/cddl/osnet/usr.bin/ctfmerge/ctfmerge.1:1.3	Mon May 28 17:05:11 2018
+++ src/external/cddl/osnet/usr.bin/ctfmerge/ctfmerge.1	Sat May  4 09:11:41 2024
@@ -1,3 +1,4 @@
+.\" $NetBSD: ctfmerge.1,v 1.4 2024/05/04 13:11:41 christos Exp $
 .\"
 .\" Copyright (c) 2010 The FreeBSD Foundation 
 .\" All rights reserved. 
@@ -28,7 +29,7 @@
 .\"
 .\" $FreeBSD: head/cddl/usr.bin/ctfmerge/ctfmerge.1 239969 2012-09-01 06:23:13Z joel $
 .\"
-.Dd July 7, 2010
+.Dd May 4, 2024
 .Dt CTFMERGE 1
 .Os
 .Sh NAME
@@ -106,6 +107,28 @@ Copy CTF data from
 into
 .Ar destfile .
 .El
+.Sh ENVIRONMENT VARIABLES
+The following environment variables are used in
+.Nm :
+.Bl -tag -width x
+.It CTFMERGE_TERMINATE_NO_UNLINK
+Don't remove temporary files on exit, so that they can be examined
+for debugging.
+.It CTFMERGE_MAX_SLOTS
+Number of round-robin slots in the input queue that it is processed by
+worker threads.
+Each slot represents a file batch (default 5).
+.It CTFMERGE_PHASE1_BATCH_SIZE
+Number of files in a slot that are needed before processing starts (default 8).
+.It CTFMERGE_NUM_THREADS
+Set the number of worker threads.
+If the number of processors can be determined it defaults to
+min(processors * 3 / 2, nslots), if not it defaults to 2.
+.It CTFMERGE_INPUT_THROTTLE
+Max queue size to queue (defaults to 10).
+.It CTFMERGE_DEBUG_LEVEL
+Increase debugging verbosity (maximum is 3).
+.El
 .Sh EXIT STATUS
 .Ex -std
 .Sh SEE ALSO



CVS commit: src/external/cddl/osnet/usr.bin/ctfmerge

2024-05-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May  4 13:11:41 UTC 2024

Modified Files:
src/external/cddl/osnet/usr.bin/ctfmerge: ctfmerge.1

Log Message:
Document environment variable use.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/usr.bin/ctfmerge/ctfmerge.1

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



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2024-05-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  3 15:50:42 UTC 2024

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctfmerge.c

Log Message:
add an environment variable to override the number ot threads.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.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/tools/ctf/cvt/ctfmerge.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.18 src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.19
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.18	Tue May 23 14:54:58 2023
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c	Fri May  3 11:50:42 2024
@@ -712,6 +712,7 @@ static void
 wq_init(workqueue_t *wq, int nfiles)
 {
 	int throttle, nslots, i;
+	const char *e;
 
 	if (getenv("CTFMERGE_MAX_SLOTS"))
 		nslots = atoi(getenv("CTFMERGE_MAX_SLOTS"));
@@ -728,17 +729,21 @@ wq_init(workqueue_t *wq, int nfiles)
 
 	wq->wq_wip = xcalloc(sizeof (wip_t) * nslots);
 	wq->wq_nwipslots = nslots;
+	e = getenv("CTFMERGE_NUM_THREADS");
+	if (e) {
+		wq->wq_nthreads = atoi(e);
+	} else {
 #ifdef _SC_NPROCESSORS_ONLN
-	wq->wq_nthreads = MIN(sysconf(_SC_NPROCESSORS_ONLN) * 3 / 2, nslots);
+		wq->wq_nthreads = MIN(sysconf(_SC_NPROCESSORS_ONLN) * 3 / 2,
+		nslots);
 #else
-	wq->wq_nthreads = 2;
+		wq->wq_nthreads = 2;
 #endif
+	}
 	wq->wq_thread = xmalloc(sizeof (pthread_t) * wq->wq_nthreads);
 
-	if (getenv("CTFMERGE_INPUT_THROTTLE"))
-		throttle = atoi(getenv("CTFMERGE_INPUT_THROTTLE"));
-	else
-		throttle = MERGE_INPUT_THROTTLE_LEN;
+	e = getenv("CTFMERGE_INPUT_THROTTLE");
+	throttle = e ? atoi(e) : MERGE_INPUT_THROTTLE_LEN;
 	wq->wq_ithrottle = throttle * wq->wq_nthreads;
 
 	debug(1, "Using %d slots, %d threads\n", wq->wq_nwipslots,



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2024-05-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  3 15:50:42 UTC 2024

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctfmerge.c

Log Message:
add an environment variable to override the number ot threads.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c

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



CVS commit: src/external/cddl/osnet/sys/sys

2024-04-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr 16 14:29:33 UTC 2024

Modified Files:
src/external/cddl/osnet/sys/sys: elf.h

Log Message:
opensolaris/sys/sys/elf.h: Omit needless __ELF_WORD_SIZE.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/cddl/osnet/sys/sys/elf.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/sys/sys/elf.h
diff -u src/external/cddl/osnet/sys/sys/elf.h:1.7 src/external/cddl/osnet/sys/sys/elf.h:1.8
--- src/external/cddl/osnet/sys/sys/elf.h:1.7	Mon Apr  1 18:33:23 2024
+++ src/external/cddl/osnet/sys/sys/elf.h	Tue Apr 16 14:29:33 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf.h,v 1.7 2024/04/01 18:33:23 riastradh Exp $	*/
+/*	$NetBSD: elf.h,v 1.8 2024/04/16 14:29:33 riastradh Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -51,6 +51,4 @@
 
 #define	EM_AMD64		EM_X86_64
 
-#define __ELF_WORD_SIZE ELFSIZE
-
 #endif /* !_SYS__ELF_SOLARIS_H_ */



CVS commit: src/external/cddl/osnet/sys/sys

2024-04-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr 16 14:29:33 UTC 2024

Modified Files:
src/external/cddl/osnet/sys/sys: elf.h

Log Message:
opensolaris/sys/sys/elf.h: Omit needless __ELF_WORD_SIZE.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/cddl/osnet/sys/sys/elf.h

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



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

2024-04-15 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Apr 15 08:06:36 UTC 2024

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

Log Message:
Add a newline to a printf message.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev.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/vdev.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev.c:1.6 src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev.c:1.7
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev.c:1.6	Thu Nov 15 04:55:06 2018
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev.c	Mon Apr 15 08:06:36 2024
@@ -3619,7 +3619,7 @@ vdev_deadman(vdev_t *vd)
 vq->vq_io_complete_ts);
 
 printf("SLOW IO: zio timestamp %lluns, "
-"delta %"PRIu64"ns, last io %lluns",
+"delta %"PRIu64"ns, last io %lluns\n",
 fio->io_timestamp, delta,
 vq->vq_io_complete_ts);
 



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

2024-04-15 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Apr 15 08:06:36 UTC 2024

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

Log Message:
Add a newline to a printf message.


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

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



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

2024-04-05 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri Apr  5 11:20:34 UTC 2024

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

Log Message:
Apply FreeBSD svn r373278 fix for ZFS corruption.  Fix for NetBSD
PR kern/58111 .

It would be extremely unlikely to trip this bug on NetBSD, as we don't
expose SEEK_DATA and SEEK_HOLE and you need to call ioctl(2) with
FIOSEEKDATA and FIOSEEKHOLE directly which no currently known code does,
and even then be unlucky enough to trip a race condition.

With a reproducer based on that in https://www.illumos.org/issues/16087,
I saw 11 groups of failures over 8 hours.  With this patch, no
failures in 10 hours.  The repro for NetBSD will be attached to
https://gnats.netbsd.org/58111 .

Original FreeBSD commit message:

dnode_is_dirty: check dnode and its data for dirtiness

Over its history this the dirty dnode test has been changed between
checking for a dnodes being on `os_dirty_dnodes` (`dn_dirty_link`) and
`dn_dirty_record`.

It turns out both are actually required.

In the case of appending data to a newly created file, the dnode proper
is dirtied (at least to change the blocksize) and dirty records are
added.  Thus, a single logical operation is represented by separate
dirty indicators, and must not be separated.

The incorrect dirty check becomes a problem when the first block of a
file is being appended to while another process is calling lseek to skip
holes. There is a small window where the dnode part is undirtied while
there are still dirty records. In this case, `lseek(fd, 0, SEEK_DATA)`
would not know that the file is dirty, and would go to
`dnode_next_offset()`. Since the object has no data blocks yet, it
returns `ESRCH`, indicating no data found, which results in `ENXIO`
being returned to `lseek()`'s caller.

This change simply updates the dirty check to check both types of dirty.
If there's anything dirty at all, we immediately go to the "wait for
sync" stage, It doesn't really matter after that; both changes are on
disk, so the dirty fields should be correct.

Sponsored by:   Klara, Inc.
Sponsored by:   Wasabi Technology, Inc.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu.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/dmu.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu.c:1.6 src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu.c:1.7
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu.c:1.6	Mon May 28 21:05:07 2018
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu.c	Fri Apr  5 11:20:34 2024
@@ -2145,7 +2145,8 @@ dmu_object_wait_synced(objset_t *os, uin
 	}
 
 	for (i = 0; i < TXG_SIZE; i++) {
-		if (list_link_active(>dn_dirty_link[i])) {
+		if (list_link_active(>dn_dirty_link[i]) ||
+		!list_is_empty(>dn_dirty_records[i])) {
 			break;
 		}
 	}



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

2024-04-05 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri Apr  5 11:20:34 UTC 2024

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

Log Message:
Apply FreeBSD svn r373278 fix for ZFS corruption.  Fix for NetBSD
PR kern/58111 .

It would be extremely unlikely to trip this bug on NetBSD, as we don't
expose SEEK_DATA and SEEK_HOLE and you need to call ioctl(2) with
FIOSEEKDATA and FIOSEEKHOLE directly which no currently known code does,
and even then be unlucky enough to trip a race condition.

With a reproducer based on that in https://www.illumos.org/issues/16087,
I saw 11 groups of failures over 8 hours.  With this patch, no
failures in 10 hours.  The repro for NetBSD will be attached to
https://gnats.netbsd.org/58111 .

Original FreeBSD commit message:

dnode_is_dirty: check dnode and its data for dirtiness

Over its history this the dirty dnode test has been changed between
checking for a dnodes being on `os_dirty_dnodes` (`dn_dirty_link`) and
`dn_dirty_record`.

It turns out both are actually required.

In the case of appending data to a newly created file, the dnode proper
is dirtied (at least to change the blocksize) and dirty records are
added.  Thus, a single logical operation is represented by separate
dirty indicators, and must not be separated.

The incorrect dirty check becomes a problem when the first block of a
file is being appended to while another process is calling lseek to skip
holes. There is a small window where the dnode part is undirtied while
there are still dirty records. In this case, `lseek(fd, 0, SEEK_DATA)`
would not know that the file is dirty, and would go to
`dnode_next_offset()`. Since the object has no data blocks yet, it
returns `ESRCH`, indicating no data found, which results in `ENXIO`
being returned to `lseek()`'s caller.

This change simply updates the dirty check to check both types of dirty.
If there's anything dirty at all, we immediately go to the "wait for
sync" stage, It doesn't really matter after that; both changes are on
disk, so the dirty fields should be correct.

Sponsored by:   Klara, Inc.
Sponsored by:   Wasabi Technology, Inc.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu.c

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



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

2023-09-10 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep 10 12:50:38 UTC 2023

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

Log Message:
Revert "Teach zfs bdevsw to do b_psize."

This is used only by dump and swap, which won't work safely on zvols
anyway.  We should make swap work eventually, but right now it's
leading unwary ussers into deadlock scenarios, so let's make it fail
early instead.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.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_ioctl.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.25 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.26
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.25	Mon Oct 31 10:32:28 2022
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c	Sun Sep 10 12:50:38 2023
@@ -7062,29 +7062,6 @@ nb_zvol_strategy(struct buf *bp)
 	(void) zvol_strategy(bp);
 }
 
-static int
-nb_zvol_psize(dev_t dev)
-{
-	minor_t minor = getminor(dev);
-	off_t nbytes;
-	unsigned bytespersector;
-
-	if (minor == 0)		/* /dev/zfs */
-		return -1;
-
-	if (zvol_ioctl(dev, DIOCGMEDIASIZE, (intptr_t), 0,
-		NOCRED, NULL))
-		return -1;
-	if (zvol_ioctl(dev, DIOCGSECTORSIZE, (intptr_t), 0,
-		NOCRED, NULL))
-		return -1;
-	if (bytespersector == 0) /* paranoia */
-		return -1;
-	if (nbytes/bytespersector > INT_MAX) /* paranoia */
-		return -1;
-	return nbytes/bytespersector;
-}
-
 static const struct fileops zfs_fileops = {
 	.fo_name = "zfs",
 	.fo_read = fbadop_read,
@@ -7104,7 +7081,7 @@ const struct bdevsw zfs_bdevsw = {
 	.d_strategy = nb_zvol_strategy,
 	.d_ioctl = nb_zfsdev_ioctl,
 	.d_dump = nodump,
-	.d_psize = nb_zvol_psize,
+	.d_psize = nosize,
 	.d_flag = D_DISK | D_MPSAFE
 };
 



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

2023-09-10 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep 10 12:50:38 UTC 2023

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

Log Message:
Revert "Teach zfs bdevsw to do b_psize."

This is used only by dump and swap, which won't work safely on zvols
anyway.  We should make swap work eventually, but right now it's
leading unwary ussers into deadlock scenarios, so let's make it fail
early instead.


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

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



CVS commit: src/external/cddl/osnet/sys/kern

2023-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Sep  9 00:14:16 UTC 2023

Modified Files:
src/external/cddl/osnet/sys/kern: kmem.c

Log Message:
solaris: Use pool_cache_reclaim, not pool_cache_invalidate.

pool_cache_invalidate invalidates cached objects, but doesn't return
any backing pages to the underlying page allocator.

pool_cache_reclaim does pool_cache_invalidate _and_ reutrns backing
pages to the underlying page alloator, so it is actually useful for
the page daemon to do when trying to free memory.

PR kern/57558

XXX pullup-10
XXX pullup-9
XXX pullup-8 (by patch to kmem.h instead of kmem.c)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/sys/kern/kmem.c

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

Modified files:

Index: src/external/cddl/osnet/sys/kern/kmem.c
diff -u src/external/cddl/osnet/sys/kern/kmem.c:1.3 src/external/cddl/osnet/sys/kern/kmem.c:1.4
--- src/external/cddl/osnet/sys/kern/kmem.c:1.3	Wed Nov 11 03:31:04 2020
+++ src/external/cddl/osnet/sys/kern/kmem.c	Sat Sep  9 00:14:16 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: kmem.c,v 1.3 2020/11/11 03:31:04 chs Exp $	*/
+/*	$NetBSD: kmem.c,v 1.4 2023/09/09 00:14:16 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -123,7 +123,7 @@ void
 kmem_cache_reap_now(kmem_cache_t *km)
 {
 
-	pool_cache_invalidate(km->km_pool);
+	pool_cache_reclaim(km->km_pool);
 }
 
 #undef kmem_alloc



CVS commit: src/external/cddl/osnet/sys/kern

2023-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Sep  9 00:14:16 UTC 2023

Modified Files:
src/external/cddl/osnet/sys/kern: kmem.c

Log Message:
solaris: Use pool_cache_reclaim, not pool_cache_invalidate.

pool_cache_invalidate invalidates cached objects, but doesn't return
any backing pages to the underlying page allocator.

pool_cache_reclaim does pool_cache_invalidate _and_ reutrns backing
pages to the underlying page alloator, so it is actually useful for
the page daemon to do when trying to free memory.

PR kern/57558

XXX pullup-10
XXX pullup-9
XXX pullup-8 (by patch to kmem.h instead of kmem.c)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/sys/kern/kmem.c

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



CVS commit: src/external/cddl/osnet/dist/uts/common/dtrace

2023-08-03 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Aug  3 08:04:07 UTC 2023

Modified Files:
src/external/cddl/osnet/dist/uts/common/dtrace: dtrace.c

Log Message:
fix uninitialised variable usage.

found by GCC 12.


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

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c
diff -u src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c:1.41 src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c:1.42
--- src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c:1.41	Tue Nov 17 03:20:33 2020
+++ src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c	Thu Aug  3 08:04:07 2023
@@ -7577,7 +7577,7 @@ dtrace_probe(dtrace_id_t id, uintptr_t a
 	}
 
 	now = mstate.dtms_timestamp = dtrace_gethrtime();
-	mstate.dtms_present |= DTRACE_MSTATE_TIMESTAMP;
+	mstate.dtms_present = DTRACE_MSTATE_TIMESTAMP;
 	vtime = dtrace_vtime_references != 0;
 
 	if (vtime && curthread->t_dtrace_start)



CVS commit: src/external/cddl/osnet/dist/uts/common/dtrace

2023-08-03 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Aug  3 08:04:07 UTC 2023

Modified Files:
src/external/cddl/osnet/dist/uts/common/dtrace: dtrace.c

Log Message:
fix uninitialised variable usage.

found by GCC 12.


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

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



CVS commit: src/external/cddl/osnet/sys/sys

2023-07-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 11 17:03:16 UTC 2023

Modified Files:
src/external/cddl/osnet/sys/sys: kcondvar.h

Log Message:
Replace kmutex_t * (which may be undefined here) with struct kmutex *,
suggested by Taylor.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/cddl/osnet/sys/sys/kcondvar.h

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



CVS commit: src/external/cddl/osnet/sys/sys

2023-07-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 11 17:03:16 UTC 2023

Modified Files:
src/external/cddl/osnet/sys/sys: kcondvar.h

Log Message:
Replace kmutex_t * (which may be undefined here) with struct kmutex *,
suggested by Taylor.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/cddl/osnet/sys/sys/kcondvar.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/sys/sys/kcondvar.h
diff -u src/external/cddl/osnet/sys/sys/kcondvar.h:1.5 src/external/cddl/osnet/sys/sys/kcondvar.h:1.6
--- src/external/cddl/osnet/sys/sys/kcondvar.h:1.5	Sat Jul 30 12:59:31 2022
+++ src/external/cddl/osnet/sys/sys/kcondvar.h	Tue Jul 11 17:03:16 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: kcondvar.h,v 1.5 2022/07/30 12:59:31 riastradh Exp $	*/
+/*	$NetBSD: kcondvar.h,v 1.6 2023/07/11 17:03:16 martin Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@ typedef enum {
 #define	cv_init(a, b, c, d)	cv_init(a, #a)
 
 static inline clock_t
-cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, hrtime_t res,
+cv_timedwait_hires(kcondvar_t *cvp, struct kmutex *mp, hrtime_t tim, hrtime_t res,
 int flag)
 {
 	extern int hz;
@@ -58,7 +58,7 @@ cv_timedwait_hires(kcondvar_t *cvp, kmut
 }
 
 static inline clock_t
-cv_reltimedwait(kcondvar_t *cvp, kmutex_t *mp, clock_t delta, time_res_t res)
+cv_reltimedwait(kcondvar_t *cvp, struct kmutex *mp, clock_t delta, time_res_t res)
 {
 
 	cv_wait(cvp, mp);
@@ -67,7 +67,7 @@ cv_reltimedwait(kcondvar_t *cvp, kmutex_
 
 #else
 
-extern	clock_t cv_timedwait_hires(kcondvar_t *, kmutex_t *, hrtime_t, hrtime_t,
+extern	clock_t cv_timedwait_hires(kcondvar_t *, struct kmutex *, hrtime_t, hrtime_t,
 int);
 
 #endif	/* _KERNEL */



CVS commit: src/external/cddl/osnet/sys/sys

2023-05-25 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Thu May 25 13:18:44 UTC 2023

Modified Files:
src/external/cddl/osnet/sys/sys: opentypes.h

Log Message:
osnet: on macOS, use  for boolean_t

macOS/x86_64 defines boolean_t as 'unsigned int' not 'int',
which causes a build issue with tools/ctfmerge on that host
after my recent fixes for macOS semaphores.
So use the  instead of a local typedef ifdef __APPLE__.

May fix a macOS/x86_64 build issue reported by cjep@.
Builds fine on NetBSD/amd64 or macOS/arm.

Note: this compat stuff is clunky, and based on the commit log,
annoyingly error prone. A newer sync of osnet from upstream /may/
improve a lot of these compat typedef workarounds for solaris types...


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/cddl/osnet/sys/sys/opentypes.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/sys/sys/opentypes.h
diff -u src/external/cddl/osnet/sys/sys/opentypes.h:1.6 src/external/cddl/osnet/sys/sys/opentypes.h:1.7
--- src/external/cddl/osnet/sys/sys/opentypes.h:1.6	Thu Apr 15 07:00:50 2021
+++ src/external/cddl/osnet/sys/sys/opentypes.h	Thu May 25 13:18:44 2023
@@ -37,8 +37,12 @@ typedef id_t		ctid_t;
 #define	B_FALSE	0
 #define	B_TRUE	1
 #ifndef _KERNEL
+#if defined(__APPLE__)
+#include 
+#else
 typedef int		boolean_t;
 #endif
+#endif
 
 #ifndef __defined_hr_t
 #define __defined_hr_t



CVS commit: src/external/cddl/osnet/sys/sys

2023-05-25 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Thu May 25 13:18:44 UTC 2023

Modified Files:
src/external/cddl/osnet/sys/sys: opentypes.h

Log Message:
osnet: on macOS, use  for boolean_t

macOS/x86_64 defines boolean_t as 'unsigned int' not 'int',
which causes a build issue with tools/ctfmerge on that host
after my recent fixes for macOS semaphores.
So use the  instead of a local typedef ifdef __APPLE__.

May fix a macOS/x86_64 build issue reported by cjep@.
Builds fine on NetBSD/amd64 or macOS/arm.

Note: this compat stuff is clunky, and based on the commit log,
annoyingly error prone. A newer sync of osnet from upstream /may/
improve a lot of these compat typedef workarounds for solaris types...


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/cddl/osnet/sys/sys/opentypes.h

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



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2023-05-25 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Thu May 25 12:53:56 UTC 2023

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: barrier.c

Log Message:
ctfmerge: fix macOS semaphore implementation, part 2

dispatch_semaphore_signal() doesn't return an error, just an
indicator of whether a thread was woken or not, so there's
no need to fail on non-zero return.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c

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



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2023-05-25 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Thu May 25 12:53:56 UTC 2023

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: barrier.c

Log Message:
ctfmerge: fix macOS semaphore implementation, part 2

dispatch_semaphore_signal() doesn't return an error, just an
indicator of whether a thread was woken or not, so there's
no need to fail on non-zero return.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.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/tools/ctf/cvt/barrier.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c:1.7 src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c:1.8
--- src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c:1.7	Tue May 23 19:53:24 2023
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c	Thu May 25 12:53:56 2023
@@ -109,9 +109,8 @@ barrier_wait(barrier_t *bar)
 			if ((errno = sema_post(>bar_sem)) != 0)
 terminate("%s: sema_post(bar_sem)", __func__);
 #elif defined(HAVE_DISPATCH_SEMAPHORE_CREATE)
-			if ((error = dispatch_semaphore_signal(bar->bar_sem)) != 0)
-terminate("%s: dispatch_semaphore_signal(bar_sem) = %ld\n",
-__func__, error);
+			/* return value doesn't matter */
+			dispatch_semaphore_signal(bar->bar_sem);
 #else
 			if (sem_post(>bar_sem) == -1)
 terminate("%s: sem_post(bar_sem)", __func__);



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2023-05-23 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Tue May 23 18:54:58 UTC 2023

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: barrier.c ctfmerge.c
tdata.c

Log Message:
ctfmerge: error check sem_*() and pthread_*() APIs

terminate() if sem_*() returns -1 or pthread_*() returns != 0.
(Set errno from pthread_*() so terminate() prints the strerror message).

Note: Failing on errors instead of ignoring them helps identify
reasons for intermittent failures, such as those on macOS host builds:
  ERROR: nbctfmerge: barrier_init: sem_init(bar_sem): Function not implemented


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c
cvs rdiff -u -r1.17 -r1.18 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c
cvs rdiff -u -r1.9 -r1.10 src/external/cddl/osnet/dist/tools/ctf/cvt/tdata.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/tools/ctf/cvt/barrier.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c:1.5 src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c:1.6
--- src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c:1.5	Thu Jun 20 14:33:04 2019
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c	Tue May 23 18:54:58 2023
@@ -42,6 +42,7 @@
  * get a return code of 0.
  */
 
+#include 
 #include 
 #ifdef illumos
 #include 
@@ -49,15 +50,19 @@
 #include 
 
 #include "barrier.h"
+#include "ctftools.h"
 
 void
 barrier_init(barrier_t *bar, int nthreads)
 {
-	pthread_mutex_init(>bar_lock, NULL);
+	if ((errno = pthread_mutex_init(>bar_lock, NULL)) != 0)
+		terminate("%s: pthread_mutex_init(bar_lock)", __func__);
 #ifdef illumos
-	sema_init(>bar_sem, 0, USYNC_THREAD, NULL);
+	if ((errno = sema_init(>bar_sem, 0, USYNC_THREAD, NULL)) != 0)
+		terminate("%s: sema_init(bar_sem)", __func__);
 #else
-	sem_init(>bar_sem, 0, 0);
+	if (sem_init(>bar_sem, 0, 0) == -1)
+		terminate("%s: sem_init(bar_sem)", __func__);
 #endif
 
 	bar->bar_numin = 0;
@@ -67,14 +72,19 @@ barrier_init(barrier_t *bar, int nthread
 int
 barrier_wait(barrier_t *bar)
 {
-	pthread_mutex_lock(>bar_lock);
+	if ((errno = pthread_mutex_lock(>bar_lock)) != 0)
+		terminate("%s: pthread_mutex_lock(bar_lock)", __func__);
 
 	if (++bar->bar_numin < bar->bar_nthr) {
-		pthread_mutex_unlock(>bar_lock);
+		if ((errno = pthread_mutex_unlock(>bar_lock)) != 0)
+			terminate("%s: pthread_mutex_unlock(bar_lock)",
+			__func__);
 #ifdef illumos
-		sema_wait(>bar_sem);
+		if ((errno = sema_wait(>bar_sem)) != 0)
+			terminate("%s: sema_wait(bar_sem)", __func__);
 #else
-		sem_wait(>bar_sem);
+		if (sem_wait(>bar_sem) == -1)
+			terminate("%s: sem_wait(bar_sem)", __func__);
 #endif
 
 		return (0);
@@ -86,11 +96,15 @@ barrier_wait(barrier_t *bar)
 		bar->bar_numin = 0;
 		for (i = 1; i < bar->bar_nthr; i++)
 #ifdef illumos
-			sema_post(>bar_sem);
+			if ((errno = sema_post(>bar_sem)) != 0)
+terminate("%s: sema_post(bar_sem)", __func__);
 #else
-			sem_post(>bar_sem);
+			if (sem_post(>bar_sem) == -1)
+terminate("%s: sem_post(bar_sem)", __func__);
 #endif
-		pthread_mutex_unlock(>bar_lock);
+		if ((errno = pthread_mutex_unlock(>bar_lock)) != 0)
+			terminate("%s: pthread_mutex_unlock(bar_lock)",
+			__func__);
 
 		return (1);
 	}

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.17 src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.18
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.17	Sun Oct 13 21:32:07 2019
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c	Tue May 23 18:54:58 2023
@@ -373,22 +373,31 @@ init_phase_two(workqueue_t *wq)
 static void
 wip_save_work(workqueue_t *wq, wip_t *slot, int slotnum)
 {
-	pthread_mutex_lock(>wq_donequeue_lock);
-
-	while (wq->wq_lastdonebatch + 1 < slot->wip_batchid)
-		pthread_cond_wait(>wip_cv, >wq_donequeue_lock);
+	if ((errno = pthread_mutex_lock(>wq_donequeue_lock)) != 0)
+		terminate("%s: pthread_mutex_lock(wq_donequeue_lock)",
+		__func__);
+
+	while (wq->wq_lastdonebatch + 1 < slot->wip_batchid) {
+		if ((errno = pthread_cond_wait(>wip_cv, >wq_donequeue_lock)) != 0)
+			terminate("%s: pthread_cond_wait(wip_cv,wq_donequeue_lock)",
+			__func__);
+	}
 	assert(wq->wq_lastdonebatch + 1 == slot->wip_batchid);
 
 	fifo_add(wq->wq_donequeue, slot->wip_td);
 	wq->wq_lastdonebatch++;
-	pthread_cond_signal(>wq_wip[(slotnum + 1) %
-	wq->wq_nwipslots].wip_cv);
+	const int nextslot = (slotnum + 1) % wq->wq_nwipslots;
+	if ((errno = pthread_cond_signal(>wq_wip[nextslot].wip_cv)) != 0)
+		terminate("%s: pthread_cond_signal(wq_wip[%d].wip_cv)",
+		__func__, nextslot);
 
 	/* reset the slot for next use */
 	slot->wip_td = NULL;
 	slot->wip_batchid = wq->wq_next_batchid++;
 
-	pthread_mutex_unlock(>wq_donequeue_lock);
+	if ((errno = pthread_mutex_unlock(>wq_donequeue_lock)) != 0)

CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2023-05-23 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Tue May 23 18:54:58 UTC 2023

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: barrier.c ctfmerge.c
tdata.c

Log Message:
ctfmerge: error check sem_*() and pthread_*() APIs

terminate() if sem_*() returns -1 or pthread_*() returns != 0.
(Set errno from pthread_*() so terminate() prints the strerror message).

Note: Failing on errors instead of ignoring them helps identify
reasons for intermittent failures, such as those on macOS host builds:
  ERROR: nbctfmerge: barrier_init: sem_init(bar_sem): Function not implemented


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c
cvs rdiff -u -r1.17 -r1.18 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c
cvs rdiff -u -r1.9 -r1.10 src/external/cddl/osnet/dist/tools/ctf/cvt/tdata.c

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



CVS commit: src/external/cddl/osnet/dev/fbt/arm

2023-05-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon May 22 15:12:54 UTC 2023

Modified Files:
src/external/cddl/osnet/dev/fbt/arm: fbt_isa.c

Log Message:
dtrace_fbt: Read and write instructions appropriately-endian on arm.

arm is a little more complicated because it has three cases:
- big-endian data, big-endian instructions
- big-endian data, little-endian instructions
- little-endian data, little-endian instructions


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/dev/fbt/arm/fbt_isa.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/dev/fbt/arm/fbt_isa.c
diff -u src/external/cddl/osnet/dev/fbt/arm/fbt_isa.c:1.1 src/external/cddl/osnet/dev/fbt/arm/fbt_isa.c:1.2
--- src/external/cddl/osnet/dev/fbt/arm/fbt_isa.c:1.1	Mon May 28 23:47:39 2018
+++ src/external/cddl/osnet/dev/fbt/arm/fbt_isa.c	Mon May 22 15:12:54 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: fbt_isa.c,v 1.1 2018/05/28 23:47:39 chs Exp $	*/
+/*	$NetBSD: fbt_isa.c,v 1.2 2023/05/22 15:12:54 riastradh Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -56,6 +56,26 @@
 #define	FBT_ENTRY	"entry"
 #define	FBT_RETURN	"return"
 
+static uint32_t
+ldinstr(const uint32_t *instr)
+{
+#ifdef _ARM_ARCH_BE8		/* big-endian data, big-endian instructions */
+	return *instr;
+#else/* little-endian instructions */
+	return le32toh(*instr);
+#endif
+}
+
+static void
+stinstr(uint32_t *instr, uint32_t val)
+{
+
+#ifdef _ARM_ARCH_BE8		/* big-endian data, big-endian instructions */
+	val = bswap32(val);
+#endif
+	ktext_write(instr, , sizeof(val)); /* write little-endian */
+}
+
 int
 fbt_invop(uintptr_t addr, struct trapframe *frame, uintptr_t rval)
 {
@@ -98,9 +118,7 @@ fbt_patch_tracepoint(fbt_probe_t *fbt, f
 	dtrace_icookie_t c;
 
 	c = dtrace_interrupt_disable();
-
-	ktext_write(fbt->fbtp_patchpoint, , sizeof (val));
-
+	stinstr(fbt->fbtp_patchpoint, val);
 	dtrace_interrupt_enable(c);
 }
 
@@ -126,14 +144,14 @@ fbt_provide_module_function(linker_file_
 	 * va_arg functions has first instruction of
 	 * sub sp, sp, #?
 	 */
-	if ((*instr & 0xf000) == FBT_SUBSP)
+	if ((ldinstr(instr) & 0xf000) == FBT_SUBSP)
 		instr++;
 
 	/*
 	 * check if insn is a pushm with LR
 	 */
-	if ((*instr & 0x) != FBT_PUSHM ||
-	(*instr & (1 << LR)) == 0)
+	if ((ldinstr(instr) & 0x) != FBT_PUSHM ||
+	(ldinstr(instr) & (1 << LR)) == 0)
 		return (0);
 
 	fbt = kmem_zalloc(sizeof (fbt_probe_t), KM_SLEEP);
@@ -143,7 +161,7 @@ fbt_provide_module_function(linker_file_
 	fbt->fbtp_patchpoint = instr;
 	fbt->fbtp_ctl = lf;
 	fbt->fbtp_loadcnt = lf->loadcnt;
-	fbt->fbtp_savedval = *instr;
+	fbt->fbtp_savedval = ldinstr(instr);
 	fbt->fbtp_patchval = FBT_BREAKPOINT;
 	fbt->fbtp_rval = DTRACE_INVOP_PUSHM;
 	fbt->fbtp_symindx = symindx;
@@ -153,18 +171,18 @@ fbt_provide_module_function(linker_file_
 
 	lf->fbt_nentries++;
 
-	popm = FBT_POPM | ((*instr) & 0x3FFF) | 0x8000;
+	popm = FBT_POPM | (ldinstr(instr) & 0x3FFF) | 0x8000;
 
 	retfbt = NULL;
 again:
 	for (; instr < limit; instr++) {
-		if (*instr == popm)
+		if (ldinstr(instr) == popm)
 			break;
-		else if ((*instr & 0xff00) == FBT_JUMP) {
+		else if ((ldinstr(instr) & 0xff00) == FBT_JUMP) {
 			uint32_t *target, *start;
 			int offset;
 
-			offset = (*instr & 0xff);
+			offset = (ldinstr(instr) & 0xff);
 			offset <<= 8;
 			offset /= 64;
 			target = instr + (2 + offset);
@@ -195,11 +213,11 @@ again:
 	fbt->fbtp_ctl = lf;
 	fbt->fbtp_loadcnt = lf->loadcnt;
 	fbt->fbtp_symindx = symindx;
-	if ((*instr & 0xff00) == FBT_JUMP)
+	if ((ldinstr(instr) & 0xff00) == FBT_JUMP)
 		fbt->fbtp_rval = DTRACE_INVOP_B;
 	else
 		fbt->fbtp_rval = DTRACE_INVOP_POPM;
-	fbt->fbtp_savedval = *instr;
+	fbt->fbtp_savedval = ldinstr(instr);
 	fbt->fbtp_patchval = FBT_BREAKPOINT;
 	fbt->fbtp_hashnext = fbt_probetab[FBT_ADDR2NDX(instr)];
 	fbt_probetab[FBT_ADDR2NDX(instr)] = fbt;
@@ -279,14 +297,14 @@ fbt_provide_module_cb(const char *name, 
 	instr = (uint32_t *) value;
 	limit = (uint32_t *)((uintptr_t)value + symsize);
 
-	if (!FBT_MOV_IP_SP_P(*instr)
-	&& !FBT_BX_LR_P(*instr)
-	&& !FBT_MOVW_P(*instr)
-	&& !FBT_MOV_IMM_P(*instr)
-	&& !FBT_B_LABEL_P(*instr)
-	&& !FBT_LDR_IMM_P(*instr)
-	&& !FBT_CMP_IMM_P(*instr)
-	&& !FBT_PUSH_P(*instr)
+	if (!FBT_MOV_IP_SP_P(ldinstr(instr))
+	&& !FBT_BX_LR_P(ldinstr(instr))
+	&& !FBT_MOVW_P(ldinstr(instr))
+	&& !FBT_MOV_IMM_P(ldinstr(instr))
+	&& !FBT_B_LABEL_P(ldinstr(instr))
+	&& !FBT_LDR_IMM_P(ldinstr(instr))
+	&& !FBT_CMP_IMM_P(ldinstr(instr))
+	&& !FBT_PUSH_P(ldinstr(instr))
 	) {
 		return 0;
 	}
@@ -298,31 +316,39 @@ fbt_provide_module_cb(const char *name, 
 	fbt->fbtp_patchpoint = instr;
 	fbt->fbtp_ctl = mod;
 	/* fbt->fbtp_loadcnt = lf->loadcnt; */
-	if (FBT_MOV_IP_SP_P(*instr))
-		fbt->fbtp_rval = BUILD_RVAL(*instr, DTRACE_INVOP_MOV_IP_SP);
-	else if 

CVS commit: src/external/cddl/osnet/dev/fbt/arm

2023-05-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon May 22 15:12:54 UTC 2023

Modified Files:
src/external/cddl/osnet/dev/fbt/arm: fbt_isa.c

Log Message:
dtrace_fbt: Read and write instructions appropriately-endian on arm.

arm is a little more complicated because it has three cases:
- big-endian data, big-endian instructions
- big-endian data, little-endian instructions
- little-endian data, little-endian instructions


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/dev/fbt/arm/fbt_isa.c

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



CVS commit: src/external/cddl/osnet/dev/fbt/aarch64

2023-05-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue May  9 21:29:07 UTC 2023

Modified Files:
src/external/cddl/osnet/dev/fbt/aarch64: fbt_isa.c

Log Message:
dtrace_fbt: Read and write instruction words in little-endian.

Step toward making this work on aarch64eb.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/cddl/osnet/dev/fbt/aarch64/fbt_isa.c

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



CVS commit: src/external/cddl/osnet/dev/fbt/aarch64

2023-05-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue May  9 21:29:07 UTC 2023

Modified Files:
src/external/cddl/osnet/dev/fbt/aarch64: fbt_isa.c

Log Message:
dtrace_fbt: Read and write instruction words in little-endian.

Step toward making this work on aarch64eb.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/cddl/osnet/dev/fbt/aarch64/fbt_isa.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/dev/fbt/aarch64/fbt_isa.c
diff -u src/external/cddl/osnet/dev/fbt/aarch64/fbt_isa.c:1.7 src/external/cddl/osnet/dev/fbt/aarch64/fbt_isa.c:1.8
--- src/external/cddl/osnet/dev/fbt/aarch64/fbt_isa.c:1.7	Wed Mar 24 04:46:41 2021
+++ src/external/cddl/osnet/dev/fbt/aarch64/fbt_isa.c	Tue May  9 21:29:07 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: fbt_isa.c,v 1.7 2021/03/24 04:46:41 simonb Exp $	*/
+/*	$NetBSD: fbt_isa.c,v 1.8 2023/05/09 21:29:07 riastradh Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -103,7 +103,7 @@ fbt_patch_tracepoint(fbt_probe_t *fbt, f
 		return;
 	if (!mm_md_direct_mapped_phys(pa, ))
 		return;
-	*(fbt_patchval_t *)va = val;
+	*(fbt_patchval_t *)va = htole32(val);
 	cpu_icache_sync_range((vm_offset_t)fbt->fbtp_patchpoint, sizeof(val));
 }
 
@@ -157,7 +157,7 @@ fbt_provide_module_cb(const char *name, 
 
 	/* Look for stp (pre-indexed) operation */
 	for (; instr < limit; instr++) {
-		if ((*instr & LDP_STP_MASK) == STP_64)
+		if ((le32toh(*instr) & LDP_STP_MASK) == STP_64)
 			break;
 	}
 
@@ -181,7 +181,7 @@ fbt_provide_module_cb(const char *name, 
 #ifdef __NetBSD__
 	fbt->fbtp_ctl = mod;
 #endif
-	fbt->fbtp_savedval = *instr;
+	fbt->fbtp_savedval = le32toh(*instr);
 	fbt->fbtp_patchval = FBT_PATCHVAL;
 	fbt->fbtp_symindx = symindx;
 
@@ -195,10 +195,10 @@ fbt_provide_module_cb(const char *name, 
 	retfbt = NULL;
 again:
 	for (; instr < limit; instr++) {
-		if (*instr == RET_INSTR)
+		if (le32toh(*instr) == RET_INSTR)
 			break;
-		else if ((*instr & B_MASK) == B_INSTR) {
-			offs = (*instr & B_DATA_MASK);
+		else if ((le32toh(*instr) & B_MASK) == B_INSTR) {
+			offs = (le32toh(*instr) & B_DATA_MASK);
 			offs *= 4;
 			target = (instr + offs);
 #ifdef __FreeBSD__
@@ -241,7 +241,7 @@ again:
 #ifdef __NetBSD__
 	fbt->fbtp_ctl = mod;
 #endif
-	fbt->fbtp_savedval = *instr;
+	fbt->fbtp_savedval = le32toh(*instr);
 	fbt->fbtp_patchval = FBT_PATCHVAL;
 	fbt->fbtp_symindx = symindx;
 



CVS commit: src/external/cddl/osnet/dev/dtrace/aarch64

2023-04-17 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Apr 17 06:57:02 UTC 2023

Modified Files:
src/external/cddl/osnet/dev/dtrace/aarch64: dtrace_subr.c

Log Message:
(missed in pervious commit)

Rename VM_KERNEL_IO_ADDRESS to VM_KERNEL_IO_BASE to match RISC-V

It's less letters, matches other similar variables and will help with
sharing code between the two architectures.

NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.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/dev/dtrace/aarch64/dtrace_subr.c
diff -u src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.c:1.5 src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.c:1.6
--- src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.c:1.5	Tue Apr  6 12:48:36 2021
+++ src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.c	Mon Apr 17 06:57:02 2023
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dtrace_subr.c,v 1.5 2021/04/06 12:48:36 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dtrace_subr.c,v 1.6 2023/04/17 06:57:02 skrll Exp $");
 
 #include 
 #include 
@@ -129,7 +129,7 @@ dtrace_toxic_ranges(void (*func)(uintptr
 {
 
 	(*func)(0, (uintptr_t)AARCH64_DIRECTMAP_START);
-	(*func)((uintptr_t)VM_KERNEL_IO_ADDRESS, ~(uintptr_t)0);
+	(*func)((uintptr_t)VM_KERNEL_IO_BASE, ~(uintptr_t)0);
 }
 
 static void



CVS commit: src/external/cddl/osnet/dev/dtrace/aarch64

2023-04-17 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Apr 17 06:57:02 UTC 2023

Modified Files:
src/external/cddl/osnet/dev/dtrace/aarch64: dtrace_subr.c

Log Message:
(missed in pervious commit)

Rename VM_KERNEL_IO_ADDRESS to VM_KERNEL_IO_BASE to match RISC-V

It's less letters, matches other similar variables and will help with
sharing code between the two architectures.

NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.c

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



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

2023-03-03 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Mar  3 10:01:31 UTC 2023

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

Log Message:
Adapt zfs_netbsd_access() to ACL support.  As ZFS itself only
handles VREAD, VWRITE, VEXEC and VAPPEND we use kauth_authorize_vnode()
to handle VADMIN.

>From FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 \
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.



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

2023-03-03 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Mar  3 10:01:31 UTC 2023

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

Log Message:
Adapt zfs_netbsd_access() to ACL support.  As ZFS itself only
handles VREAD, VWRITE, VEXEC and VAPPEND we use kauth_authorize_vnode()
to handle VADMIN.

>From FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 \
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.80 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.81
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.80	Mon Oct  3 16:04:19 2022
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Fri Mar  3 10:01:31 2023
@@ -5169,33 +5169,47 @@ zfs_netbsd_access(void *v)
 		accmode_t a_accmode;
 		kauth_cred_t a_cred;
 	} */ *ap = v;
-	struct vnode *vp = ap->a_vp;
-	accmode_t accmode = ap->a_accmode;
-	mode_t zfs_mode = 0;
+	vnode_t *vp = ap->a_vp;
+	znode_t *zp = VTOZ(vp);
+	accmode_t accmode;
 	kauth_cred_t cred = ap->a_cred;
-	int error;
+	int error = 0;
 
 	/*
-	 * XXX This is really random, especially the left shift by six,
-	 * and it exists only because of randomness in zfs_unix_to_v4
-	 * and zfs_zaccess_rwx in zfs_acl.c.
+	 * ZFS itself only knowns about VREAD, VWRITE, VEXEC and VAPPEND,
 	 */
-	if (accmode & VREAD)
-		zfs_mode |= S_IROTH;
-	if (accmode & VWRITE)
-		zfs_mode |= S_IWOTH;
-	if (accmode & VEXEC)
-		zfs_mode |= S_IXOTH;
-	zfs_mode <<= 6;
+	accmode = ap->a_accmode & (VREAD|VWRITE|VEXEC|VAPPEND);
+	if (accmode != 0)
+		error = zfs_access(vp, accmode, 0, cred, NULL);
 
-	KASSERT(VOP_ISLOCKED(vp));
-	error = zfs_access(vp, zfs_mode, 0, cred, NULL);
+	/*
+	 * VADMIN has to be handled by kauth_authorize_vnode().
+	 */
+	if (error == 0) {
+		accmode = ap->a_accmode & ~(VREAD|VWRITE|VEXEC|VAPPEND);
+		if (accmode != 0) {
+			error = kauth_authorize_vnode(cred,
+			KAUTH_ACCESS_ACTION(accmode, vp->v_type,
+			zp->z_mode & ALLPERMS), vp, NULL,
+			genfs_can_access(vp, cred, zp->z_uid,
+			zp->z_gid, zp->z_mode & ALLPERMS, NULL, accmode));
+		}
+	}
+
+	/*
+	 * For VEXEC, ensure that at least one execute bit is set for
+	 * non-directories.
+	 */
+	if (error == 0 && (ap->a_accmode & VEXEC) != 0 && vp->v_type != VDIR &&
+	(zp->z_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) == 0) {
+		error = EACCES;
+	}
 
 	/* We expect EACCES as common error. */
 	if (error == EPERM)
 		error = EACCES;
 
-	return (error);
+	return error;
 }
 
 static int



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

2023-02-17 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Fri Feb 17 21:50:14 UTC 2023

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

Log Message:
provide pathconf for .zfs control directory. avoids errors on
ls -l ../.zfs.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.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_ctldir.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c:1.14 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c:1.15
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c:1.14	Fri Nov  4 11:20:39 2022
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c	Fri Feb 17 21:50:13 2023
@@ -1842,6 +1842,7 @@ const struct vnodeopv_entry_desc zfs_sfs
 	{ _putpages_desc,		genfs_null_putpages },
 	{ _islocked_desc,		genfs_islocked },
 	{ _print_desc,		sfs_print },
+	{ _pathconf_desc,		genfs_pathconf },
 	{ NULL, NULL }
 };
 



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

2023-02-17 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Fri Feb 17 21:50:14 UTC 2023

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

Log Message:
provide pathconf for .zfs control directory. avoids errors on
ls -l ../.zfs.


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

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



CVS commit: src/external/cddl/osnet/dist/lib/libdtrace/common

2023-02-07 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Tue Feb  7 22:54:02 UTC 2023

Modified Files:
src/external/cddl/osnet/dist/lib/libdtrace/common: dt_subr.c

Log Message:
dtrace: remove unnecessary fflush()

Apply this commit from FreeBSD:

  commit f339a3ef6369b368f3a2455792a7a3a4c28f92c4
  Author: Chuck Silvers 
  Date:   Wed Feb 9 17:09:26 2022 -0800

  dtrace: remove unnecessary fflush()

  This call was added back in the early days of dtrace porting and
  no one knows why anymore.  The extra flushing causes lots of
  unnecessary CPU overhead when a script produces lots of output,
  as well as easily losing output because the command can't keep up.

  Sponsored by: Netflix
  Reviewed by:  imp, markj
  Differential Revision:https://reviews.freebsd.org/D34216


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 \
src/external/cddl/osnet/dist/lib/libdtrace/common/dt_subr.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/lib/libdtrace/common/dt_subr.c
diff -u src/external/cddl/osnet/dist/lib/libdtrace/common/dt_subr.c:1.15 src/external/cddl/osnet/dist/lib/libdtrace/common/dt_subr.c:1.16
--- src/external/cddl/osnet/dist/lib/libdtrace/common/dt_subr.c:1.15	Mon Feb  6 22:22:12 2023
+++ src/external/cddl/osnet/dist/lib/libdtrace/common/dt_subr.c	Tue Feb  7 22:54:02 2023
@@ -725,7 +725,6 @@ dt_printf(dtrace_hdl_t *dtp, FILE *fp, c
 
 	va_copy(ap2, ap);
 	n = vfprintf(fp, format, ap2);
-	fflush(fp);
 	va_end(ap2);
 	va_end(ap);
 



CVS commit: src/external/cddl/osnet/dist/lib/libdtrace/common

2023-02-07 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Tue Feb  7 22:54:02 UTC 2023

Modified Files:
src/external/cddl/osnet/dist/lib/libdtrace/common: dt_subr.c

Log Message:
dtrace: remove unnecessary fflush()

Apply this commit from FreeBSD:

  commit f339a3ef6369b368f3a2455792a7a3a4c28f92c4
  Author: Chuck Silvers 
  Date:   Wed Feb 9 17:09:26 2022 -0800

  dtrace: remove unnecessary fflush()

  This call was added back in the early days of dtrace porting and
  no one knows why anymore.  The extra flushing causes lots of
  unnecessary CPU overhead when a script produces lots of output,
  as well as easily losing output because the command can't keep up.

  Sponsored by: Netflix
  Reviewed by:  imp, markj
  Differential Revision:https://reviews.freebsd.org/D34216


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 \
src/external/cddl/osnet/dist/lib/libdtrace/common/dt_subr.c

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



CVS commit: src/external/cddl/osnet/dist/lib/libdtrace/common

2023-02-06 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Feb  6 22:22:12 UTC 2023

Modified Files:
src/external/cddl/osnet/dist/lib/libdtrace/common: dt_subr.c

Log Message:
dtrace: re-fix aggregations to report from all online CPUs

Reapply the fix to dt_status() from rev 1.10
("Don't return success when the target CPU is offline")
which was lost in rev 1.12 ("sync with FreeBSD").
The FreeBSD version that we have been using since then does run on NetBSD
but always reports that CPU 0 is online and all other CPUs are offline,
because the sysctl that it uses does not exist on NetBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 \
src/external/cddl/osnet/dist/lib/libdtrace/common/dt_subr.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/lib/libdtrace/common/dt_subr.c
diff -u src/external/cddl/osnet/dist/lib/libdtrace/common/dt_subr.c:1.14 src/external/cddl/osnet/dist/lib/libdtrace/common/dt_subr.c:1.15
--- src/external/cddl/osnet/dist/lib/libdtrace/common/dt_subr.c:1.14	Sun Sep  6 21:49:32 2020
+++ src/external/cddl/osnet/dist/lib/libdtrace/common/dt_subr.c	Mon Feb  6 22:22:12 2023
@@ -49,6 +49,11 @@
 #include 
 #include 
 #include 
+#ifdef __NetBSD__
+#include 
+#include 
+#include 
+#endif
 
 #include 
 
@@ -501,6 +506,27 @@ dt_ioctl(dtrace_hdl_t *dtp, u_long val, 
 	return (-1);
 }
 
+#ifdef __NetBSD__
+static bool
+cpu_online(processorid_t cpu)
+{
+	cpustate_t cs;
+	int fd, online = false;
+
+	if ((fd = open(_PATH_CPUCTL, O_RDONLY)) < 0)
+		return false;
+
+	cs.cs_id = cpu;
+	if (ioctl(fd, IOC_CPU_GETSTATE, ) == 0) {
+		if (cs.cs_online)
+			online = true;
+	}
+
+	close(fd);
+	return online;
+}
+#endif
+
 int
 dt_status(dtrace_hdl_t *dtp, processorid_t cpu)
 {
@@ -509,7 +535,8 @@ dt_status(dtrace_hdl_t *dtp, processorid
 	if (v == NULL) {
 #ifdef illumos
 		return (p_online(cpu, P_STATUS));
-#else
+#endif
+#ifdef __FreeBSD__
 		int maxid = 0;
 		size_t len = sizeof(maxid);
 		if (sysctlbyname("kern.smp.maxid", , , NULL, 0) != 0)
@@ -517,6 +544,9 @@ dt_status(dtrace_hdl_t *dtp, processorid
 		else
 			return (cpu <= maxid ? 1 : -1);
 #endif
+#ifdef __NetBSD__
+		return cpu_online(cpu) ? 1 : -1;
+#endif
 	}
 
 	return (v->dtv_status(dtp->dt_varg, cpu));



CVS commit: src/external/cddl/osnet/dist/lib/libdtrace/common

2023-02-06 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Feb  6 22:22:12 UTC 2023

Modified Files:
src/external/cddl/osnet/dist/lib/libdtrace/common: dt_subr.c

Log Message:
dtrace: re-fix aggregations to report from all online CPUs

Reapply the fix to dt_status() from rev 1.10
("Don't return success when the target CPU is offline")
which was lost in rev 1.12 ("sync with FreeBSD").
The FreeBSD version that we have been using since then does run on NetBSD
but always reports that CPU 0 is online and all other CPUs are offline,
because the sysctl that it uses does not exist on NetBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 \
src/external/cddl/osnet/dist/lib/libdtrace/common/dt_subr.c

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



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2022-12-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 25 20:23:43 UTC 2022

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: output.c

Log Message:
Don't bail out if the input file does not have a symbol table. This happens
with crtn.o which used to have an empty symbol table with binutils 2.34,
with binutils 2.39 has no symbol table.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/cddl/osnet/dist/tools/ctf/cvt/output.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/tools/ctf/cvt/output.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/output.c:1.9 src/external/cddl/osnet/dist/tools/ctf/cvt/output.c:1.10
--- src/external/cddl/osnet/dist/tools/ctf/cvt/output.c:1.9	Mon May 28 17:05:06 2018
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/output.c	Sun Dec 25 15:23:42 2022
@@ -353,15 +353,17 @@ sort_iidescs(Elf *elf, const char *file,
 	match.iim_file = NULL;
 
 	if ((stidx = findelfsecidx(elf, file,
-	dynsym ? ".dynsym" : ".symtab")) < 0)
-		terminate("%s: Can't open symbol table\n", file);
-	scn = elf_getscn(elf, stidx);
-	data = elf_getdata(scn, NULL);
-	gelf_getshdr(scn, );
-	nent = shdr.sh_size / shdr.sh_entsize;
+	dynsym ? ".dynsym" : ".symtab")) < 0) {
+		nent = 0;
+	} else {
+		scn = elf_getscn(elf, stidx);
+		data = elf_getdata(scn, NULL);
+		gelf_getshdr(scn, );
+		nent = shdr.sh_size / shdr.sh_entsize;
 
-	scn = elf_getscn(elf, shdr.sh_link);
-	strdata = elf_getdata(scn, NULL);
+		scn = elf_getscn(elf, shdr.sh_link);
+		strdata = elf_getdata(scn, NULL);
+	}
 
 	iiburst = iiburst_new(td, nent);
 
@@ -665,8 +667,7 @@ write_file(Elf *src, const char *srcname
 	}
 
 	if (symtab_idx == -1) {
-		terminate("%s: Cannot find %s section\n", srcname,
-		dynsym ? "SHT_DYNSYM" : "SHT_SYMTAB");
+		goto out;
 	}
 
 	/* Add the ctf section */
@@ -709,6 +710,7 @@ write_file(Elf *src, const char *srcname
 	/* commit to disk */
 	dehdr.e_shstrndx = secxlate[sehdr.e_shstrndx];
 	gelf_update_ehdr(dst, );
+out:
 	if (elf_update(dst, ELF_C_WRITE) < 0)
 		elfterminate(dstname, "Cannot finalize temp file");
 



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2022-12-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 25 20:23:43 UTC 2022

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: output.c

Log Message:
Don't bail out if the input file does not have a symbol table. This happens
with crtn.o which used to have an empty symbol table with binutils 2.34,
with binutils 2.39 has no symbol table.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/cddl/osnet/dist/tools/ctf/cvt/output.c

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



CVS commit: src/external/cddl/osnet/dist/uts/common/os

2022-10-31 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Oct 31 10:44:29 UTC 2022

Modified Files:
src/external/cddl/osnet/dist/uts/common/os: list.c

Log Message:
Provide an empty ASSERT macro ifdef _STANDALONE.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/cddl/osnet/dist/uts/common/os/list.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/os/list.c
diff -u src/external/cddl/osnet/dist/uts/common/os/list.c:1.1.1.1 src/external/cddl/osnet/dist/uts/common/os/list.c:1.2
--- src/external/cddl/osnet/dist/uts/common/os/list.c:1.1.1.1	Fri Aug  7 18:33:45 2009
+++ src/external/cddl/osnet/dist/uts/common/os/list.c	Mon Oct 31 10:44:29 2022
@@ -35,6 +35,10 @@
 #include 
 #include 
 
+#ifdef _STANDALONE
+#define	ASSERT(x)	/* nothing */
+#endif
+
 #define	list_d2l(a, obj) ((list_node_t *)(((char *)obj) + (a)->list_offset))
 #define	list_object(a, node) ((void *)(((char *)node) - (a)->list_offset))
 #define	list_empty(a) ((a)->list_head.list_next == &(a)->list_head)



CVS commit: src/external/cddl/osnet/dist/uts/common/os

2022-10-31 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Oct 31 10:44:29 UTC 2022

Modified Files:
src/external/cddl/osnet/dist/uts/common/os: list.c

Log Message:
Provide an empty ASSERT macro ifdef _STANDALONE.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/cddl/osnet/dist/uts/common/os/list.c

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



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

2022-10-31 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Oct 31 10:32:28 UTC 2022

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

Log Message:
Whitespace nit.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.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_ioctl.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.24 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.25
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.24	Mon Mar 28 12:33:20 2022
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c	Mon Oct 31 10:32:28 2022
@@ -3077,7 +3077,7 @@ zfs_get_vfs(const char *resource)
 		mtx_unlock(_mtx);
 #endif
 #ifdef __NetBSD__
-mount_iterator_t *iter;
+	mount_iterator_t *iter;
 
 	mountlist_iterator_init();
 	while ((vfsp = mountlist_iterator_next(iter)) != NULL) {



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

2022-10-31 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Oct 31 10:32:28 UTC 2022

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

Log Message:
Whitespace nit.


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

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



CVS commit: src/external/cddl/osnet/sys/sys

2022-10-30 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Oct 31 04:50:12 UTC 2022

Modified Files:
src/external/cddl/osnet/sys/sys: time.h

Log Message:
Only need TIMESPEC_OVERFLOW() to check against INT32_{MIN,MAX} on FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/external/cddl/osnet/sys/sys/time.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/sys/sys/time.h
diff -u src/external/cddl/osnet/sys/sys/time.h:1.14 src/external/cddl/osnet/sys/sys/time.h:1.15
--- src/external/cddl/osnet/sys/sys/time.h:1.14	Mon Sep 19 22:30:19 2022
+++ src/external/cddl/osnet/sys/sys/time.h	Mon Oct 31 04:50:12 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: time.h,v 1.14 2022/09/19 22:30:19 mlelstv Exp $	*/
+/*	$NetBSD: time.h,v 1.15 2022/10/31 04:50:12 simonb Exp $	*/
 
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek 
@@ -50,7 +50,8 @@
 typedef longlong_t	hrtime_t;
 #endif
 
-#if defined(__i386__) || defined(__powerpc__)
+/* FreeBSD i386 and PPC use int32 for time, all else int64 */
+#if defined(__FreeBSD__) && (defined(__i386__) || defined(__powerpc__))
 #define	TIMESPEC_OVERFLOW(ts)		\
 	((ts)->tv_sec < INT32_MIN || (ts)->tv_sec > INT32_MAX)
 #else



CVS commit: src/external/cddl/osnet/sys/sys

2022-10-30 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Oct 31 04:50:12 UTC 2022

Modified Files:
src/external/cddl/osnet/sys/sys: time.h

Log Message:
Only need TIMESPEC_OVERFLOW() to check against INT32_{MIN,MAX} on FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/external/cddl/osnet/sys/sys/time.h

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



CVS commit: src/external/cddl/osnet/dist/cmd/zpool

2022-10-24 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Mon Oct 24 14:22:53 UTC 2022

Modified Files:
src/external/cddl/osnet/dist/cmd/zpool: zpool_vdev.c

Log Message:
Remove references to GEOM from zpool(8).


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/cddl/osnet/dist/cmd/zpool/zpool_vdev.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/cmd/zpool/zpool_vdev.c
diff -u src/external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c:1.5 src/external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c:1.6
--- src/external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c:1.5	Sun Feb 16 14:06:10 2020
+++ src/external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c	Mon Oct 24 14:22:53 2022
@@ -482,7 +482,7 @@ make_leaf_vdev(const char *arg, uint64_t
 			if (errno == ENOENT) {
 (void) fprintf(stderr,
 gettext("cannot open '%s': no such "
-"GEOM provider\n"), arg);
+"device\n"), arg);
 (void) fprintf(stderr,
 gettext("must be a full path or "
 "shorthand device name\n"));
@@ -513,7 +513,7 @@ make_leaf_vdev(const char *arg, uint64_t
 		type = VDEV_TYPE_FILE;
 	} else {
 		(void) fprintf(stderr, gettext("cannot use '%s': must be a "
-		"GEOM provider or regular file\n"), path);
+		"device or regular file\n"), path);
 		return (NULL);
 	}
 



CVS commit: src/external/cddl/osnet/dist/cmd/zpool

2022-10-24 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Mon Oct 24 14:22:53 UTC 2022

Modified Files:
src/external/cddl/osnet/dist/cmd/zpool: zpool_vdev.c

Log Message:
Remove references to GEOM from zpool(8).


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c

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



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

2022-10-03 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Mon Oct  3 16:04:19 UTC 2022

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

Log Message:
Revert. Spotted by hannken@ - fix needs to be in zfs_ctldir.c it is missing
VOP_PATHCONF.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 \
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.79 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.80
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.79	Tue Sep 27 10:33:21 2022
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Mon Oct  3 16:04:19 2022
@@ -5027,7 +5027,7 @@ zfs_pathconf(vnode_t *vp, int cmd, ulong
 #endif
 
 	default:
-		return (EINVAL);
+		return (EOPNOTSUPP);
 	}
 }
 



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

2022-10-03 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Mon Oct  3 16:04:19 UTC 2022

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

Log Message:
Revert. Spotted by hannken@ - fix needs to be in zfs_ctldir.c it is missing
VOP_PATHCONF.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 \
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.



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

2022-10-03 Thread J. Hannken-Illjes
Yes -- I suppose genfs_pathconf() is sufficient here.

--
J. Hannken-Illjes - hann...@mailbox.org

> On 3. Oct 2022, at 11:40, Frank Kardel  wrote:
> 
> 
> Good to know. So do we need to add path conf there?
> Frank
> 
> 3 Oct 2022 11:34:09 J. Hannken-Illjes :
> 
>> Frank,
>> 
>> the vnode operations for ".zfs" are in zfs_ctldir.c and there
>> is no pathconf operation here ...
>> 
>> --
>> J. Hannken-Illjes - hann...@mailbox.org
>> 
>>> On 3. Oct 2022, at 11:26, Frank Kardel  wrote:
>>> 
>>> Well, I am am happy to do that. But ls got eopnotsupp for fpathconf of ACL 
>>> names and barked at them when listing the .zfs snapshot directory. Ls is 
>>> only ignoring einval at that place. So something must be wrong there wrt 
>>> tog.
>>> Frank
>>> 
>>> 3 Oct 2022 10:53:10 J. Hannken-Illjes :
>>> 
> On 27. Sep 2022, at 12:33, Frank Kardel  wrote:
> 
> Module Name:src
> Committed By:   kardel
> Date:   Tue Sep 27 10:33:21 UTC 2022
> 
> Modified Files:
> src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c
> 
> Log Message:
> for unsupported names return EINVAL as per TOG
> https://pubs.opengroup.org/onlinepubs/9699919799/functions/fpathconf.html
> discussed with christos@
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.78 -r1.79 \
>src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
 
 This is completely wrong!
 
 The call sequence is "VOP_PATHCONF -> zfs_netbsd_pathconf -> zfs_pathconf"
 where zfs_netbsd_pathconf() handles the NetBSD specific names if
 zfs_pathconf() returns EOPNOTSUPP and also returns EINVAL for
 unsupported names in this case.
 
 Please revert.
 
 --
 J. Hannken-Illjes - hann...@mailbox.org



signature.asc
Description: Message signed with OpenPGP


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

2022-10-03 Thread Frank Kardel


Good to know. So do we need to add path conf there?
Frank

3 Oct 2022 11:34:09 J. Hannken-Illjes :

> Frank,
> 
> the vnode operations for ".zfs" are in zfs_ctldir.c and there
> is no pathconf operation here ...
> 
> --
> J. Hannken-Illjes - hann...@mailbox.org
> 
>> On 3. Oct 2022, at 11:26, Frank Kardel  wrote:
>> 
>> Well, I am am happy to do that. But ls got eopnotsupp for fpathconf of ACL 
>> names and barked at them when listing the .zfs snapshot directory. Ls is 
>> only ignoring einval at that place. So something must be wrong there wrt tog.
>> Frank
>> 
>> 3 Oct 2022 10:53:10 J. Hannken-Illjes :
>> 
 On 27. Sep 2022, at 12:33, Frank Kardel  wrote:
 
 Module Name:    src
 Committed By:   kardel
 Date:   Tue Sep 27 10:33:21 UTC 2022
 
 Modified Files:
     src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c
 
 Log Message:
 for unsupported names return EINVAL as per TOG
 https://pubs.opengroup.org/onlinepubs/9699919799/functions/fpathconf.html
 discussed with christos@
 
 
 To generate a diff of this commit:
 cvs rdiff -u -r1.78 -r1.79 \
    src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
>>> 
>>> This is completely wrong!
>>> 
>>> The call sequence is "VOP_PATHCONF -> zfs_netbsd_pathconf -> zfs_pathconf"
>>> where zfs_netbsd_pathconf() handles the NetBSD specific names if
>>> zfs_pathconf() returns EOPNOTSUPP and also returns EINVAL for
>>> unsupported names in this case.
>>> 
>>> Please revert.
>>> 
>>> --
>>> J. Hannken-Illjes - hann...@mailbox.org


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

2022-10-03 Thread J. Hannken-Illjes
Frank,

the vnode operations for ".zfs" are in zfs_ctldir.c and there
is no pathconf operation here ...

--
J. Hannken-Illjes - hann...@mailbox.org

> On 3. Oct 2022, at 11:26, Frank Kardel  wrote:
> 
> Well, I am am happy to do that. But ls got eopnotsupp for fpathconf of ACL 
> names and barked at them when listing the .zfs snapshot directory. Ls is only 
> ignoring einval at that place. So something must be wrong there wrt tog.
> Frank
> 
> 3 Oct 2022 10:53:10 J. Hannken-Illjes :
> 
>>> On 27. Sep 2022, at 12:33, Frank Kardel  wrote:
>>> 
>>> Module Name:src
>>> Committed By:   kardel
>>> Date:   Tue Sep 27 10:33:21 UTC 2022
>>> 
>>> Modified Files:
>>> src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c
>>> 
>>> Log Message:
>>> for unsupported names return EINVAL as per TOG
>>> https://pubs.opengroup.org/onlinepubs/9699919799/functions/fpathconf.html
>>> discussed with christos@
>>> 
>>> 
>>> To generate a diff of this commit:
>>> cvs rdiff -u -r1.78 -r1.79 \
>>>src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
>> 
>> This is completely wrong!
>> 
>> The call sequence is "VOP_PATHCONF -> zfs_netbsd_pathconf -> zfs_pathconf"
>> where zfs_netbsd_pathconf() handles the NetBSD specific names if
>> zfs_pathconf() returns EOPNOTSUPP and also returns EINVAL for
>> unsupported names in this case.
>> 
>> Please revert.
>> 
>> --
>> J. Hannken-Illjes - hann...@mailbox.org



signature.asc
Description: Message signed with OpenPGP


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

2022-10-03 Thread Frank Kardel
Well, I am am happy to do that. But ls got eopnotsupp for fpathconf of ACL 
names and barked at them when listing the .zfs snapshot directory. Ls is only 
ignoring einval at that place. So something must be wrong there wrt tog.
Frank

3 Oct 2022 10:53:10 J. Hannken-Illjes :

>> On 27. Sep 2022, at 12:33, Frank Kardel  wrote:
>> 
>> Module Name:    src
>> Committed By:   kardel
>> Date:   Tue Sep 27 10:33:21 UTC 2022
>> 
>> Modified Files:
>>     src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c
>> 
>> Log Message:
>> for unsupported names return EINVAL as per TOG
>> https://pubs.opengroup.org/onlinepubs/9699919799/functions/fpathconf.html
>> discussed with christos@
>> 
>> 
>> To generate a diff of this commit:
>> cvs rdiff -u -r1.78 -r1.79 \
>>    src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
> 
> This is completely wrong!
> 
> The call sequence is "VOP_PATHCONF -> zfs_netbsd_pathconf -> zfs_pathconf"
> where zfs_netbsd_pathconf() handles the NetBSD specific names if
> zfs_pathconf() returns EOPNOTSUPP and also returns EINVAL for
> unsupported names in this case.
> 
> Please revert.
> 
> --
> J. Hannken-Illjes - hann...@mailbox.org


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

2022-10-03 Thread J. Hannken-Illjes
> On 27. Sep 2022, at 12:33, Frank Kardel  wrote:
> 
> Module Name:  src
> Committed By: kardel
> Date: Tue Sep 27 10:33:21 UTC 2022
> 
> Modified Files:
>   src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c
> 
> Log Message:
> for unsupported names return EINVAL as per TOG
> https://pubs.opengroup.org/onlinepubs/9699919799/functions/fpathconf.html
> discussed with christos@
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.78 -r1.79 \
>src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c

This is completely wrong!

The call sequence is "VOP_PATHCONF -> zfs_netbsd_pathconf -> zfs_pathconf"
where zfs_netbsd_pathconf() handles the NetBSD specific names if
zfs_pathconf() returns EOPNOTSUPP and also returns EINVAL for
unsupported names in this case.

Please revert.

--
J. Hannken-Illjes - hann...@mailbox.org


signature.asc
Description: Message signed with OpenPGP


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

2022-09-27 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Tue Sep 27 10:33:21 UTC 2022

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

Log Message:
for unsupported names return EINVAL as per TOG
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fpathconf.html
discussed with christos@


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 \
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.78 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.79
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.78	Sun Mar 27 16:26:26 2022
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Tue Sep 27 10:33:21 2022
@@ -5027,7 +5027,7 @@ zfs_pathconf(vnode_t *vp, int cmd, ulong
 #endif
 
 	default:
-		return (EOPNOTSUPP);
+		return (EINVAL);
 	}
 }
 



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

2022-09-27 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Tue Sep 27 10:33:21 UTC 2022

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

Log Message:
for unsupported names return EINVAL as per TOG
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fpathconf.html
discussed with christos@


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 \
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.



CVS commit: src/external/cddl/osnet/sys/sys

2022-09-19 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Sep 19 22:30:19 UTC 2022

Modified Files:
src/external/cddl/osnet/sys/sys: time.h

Log Message:
Reference kernel-wide hz constant instead of using a private but possibly
different value.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/external/cddl/osnet/sys/sys/time.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/sys/sys/time.h
diff -u src/external/cddl/osnet/sys/sys/time.h:1.13 src/external/cddl/osnet/sys/sys/time.h:1.14
--- src/external/cddl/osnet/sys/sys/time.h:1.13	Sun Aug 29 08:43:12 2021
+++ src/external/cddl/osnet/sys/sys/time.h	Mon Sep 19 22:30:19 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: time.h,v 1.13 2021/08/29 08:43:12 christos Exp $	*/
+/*	$NetBSD: time.h,v 1.14 2022/09/19 22:30:19 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek 
@@ -82,7 +82,7 @@ static inline int64_t
 ddi_get_lbolt64(void)
 {
 	struct timespec ts;
-	const int hz = 100;
+	extern int hz;
 
 	getnanouptime();
 	return (int64_t)(SEC_TO_TICK(ts.tv_sec) + NSEC_TO_TICK(ts.tv_nsec));



CVS commit: src/external/cddl/osnet/sys/sys

2022-09-19 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Sep 19 22:30:19 UTC 2022

Modified Files:
src/external/cddl/osnet/sys/sys: time.h

Log Message:
Reference kernel-wide hz constant instead of using a private but possibly
different value.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/external/cddl/osnet/sys/sys/time.h

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



CVS commit: src/external/cddl/osnet/dev/fbt

2022-09-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Sep  2 11:03:50 UTC 2022

Modified Files:
src/external/cddl/osnet/dev/fbt: fbt.c

Log Message:
dtrace_fbt: Allow tracing names that start with `__'.

This was never relevant on FreeBSD and I don't think it is relevant on
NetBSD either.  The FreeBSD change to lift this restriction had the
following comment:

r306570 | markj | 2016-10-02 00:35:00 + (Sun, 02 Oct 2016) | 7 lines

Allow tracing of functions prefixed by "__".

This restriction was inherited from upstream but is not relevant on FreeBSD.
Furthermore, it hindered the tracing of locking primitive subroutines.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/external/cddl/osnet/dev/fbt/fbt.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/dev/fbt/fbt.c
diff -u src/external/cddl/osnet/dev/fbt/fbt.c:1.28 src/external/cddl/osnet/dev/fbt/fbt.c:1.29
--- src/external/cddl/osnet/dev/fbt/fbt.c:1.28	Mon Mar 28 12:33:20 2022
+++ src/external/cddl/osnet/dev/fbt/fbt.c	Fri Sep  2 11:03:50 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fbt.c,v 1.28 2022/03/28 12:33:20 riastradh Exp $	*/
+/*	$NetBSD: fbt.c,v 1.29 2022/09/02 11:03:50 riastradh Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -168,9 +168,6 @@ fbt_excluded(const char *name)
 #endif
 
 #ifdef __NetBSD__
-	if (name[0] == '_' && name[1] == '_')
-		return (1);
-
 	if (strcmp(name, "cpu_index") == 0 ||
 	strncmp(name, "db_", 3) == 0 ||
 	strncmp(name, "ddb_", 4) == 0 ||



CVS commit: src/external/cddl/osnet/dev/fbt

2022-09-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Sep  2 11:03:50 UTC 2022

Modified Files:
src/external/cddl/osnet/dev/fbt: fbt.c

Log Message:
dtrace_fbt: Allow tracing names that start with `__'.

This was never relevant on FreeBSD and I don't think it is relevant on
NetBSD either.  The FreeBSD change to lift this restriction had the
following comment:

r306570 | markj | 2016-10-02 00:35:00 + (Sun, 02 Oct 2016) | 7 lines

Allow tracing of functions prefixed by "__".

This restriction was inherited from upstream but is not relevant on FreeBSD.
Furthermore, it hindered the tracing of locking primitive subroutines.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/external/cddl/osnet/dev/fbt/fbt.c

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



CVS commit: src/external/cddl/osnet/dev/sdt

2022-08-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Aug 31 12:34:04 UTC 2022

Modified Files:
src/external/cddl/osnet/dev/sdt: sdt.c

Log Message:
dtrace_sdt: Fix bug in builtin module reference counting.

Don't module_hold(NULL)!  This mistake was introduced in my attempt
to get dtrace working for sdt probes defined in non-builtin modules
like zfs.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/external/cddl/osnet/dev/sdt/sdt.c

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



CVS commit: src/external/cddl/osnet/dev/sdt

2022-08-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Aug 31 12:34:04 UTC 2022

Modified Files:
src/external/cddl/osnet/dev/sdt: sdt.c

Log Message:
dtrace_sdt: Fix bug in builtin module reference counting.

Don't module_hold(NULL)!  This mistake was introduced in my attempt
to get dtrace working for sdt probes defined in non-builtin modules
like zfs.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/external/cddl/osnet/dev/sdt/sdt.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/dev/sdt/sdt.c
diff -u src/external/cddl/osnet/dev/sdt/sdt.c:1.23 src/external/cddl/osnet/dev/sdt/sdt.c:1.24
--- src/external/cddl/osnet/dev/sdt/sdt.c:1.23	Sun Aug  7 23:42:09 2022
+++ src/external/cddl/osnet/dev/sdt/sdt.c	Wed Aug 31 12:34:04 2022
@@ -39,7 +39,7 @@
  * unloaded; in particular, probes may not span multiple kernel modules.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdt.c,v 1.23 2022/08/07 23:42:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdt.c,v 1.24 2022/08/31 12:34:04 riastradh Exp $");
 
 #include 
 #include 
@@ -270,7 +270,8 @@ sdt_enable(void *arg __unused, dtrace_id
 
 	probe->id = id;
 #ifdef __NetBSD__
-	module_hold(>sdtp_lf->lf_mod);
+	if (probe->sdtp_lf)
+		module_hold(>sdtp_lf->lf_mod);
 #endif
 #ifdef __FreeBSD__
 	probe->sdtp_lf->nenabled++;
@@ -286,7 +287,8 @@ sdt_disable(void *arg __unused, dtrace_i
 	struct sdt_probe *probe = parg;
 
 #ifdef __NetBSD__
-	module_rele(>sdtp_lf->lf_mod);
+	if (probe->sdtp_lf)
+		module_rele(>sdtp_lf->lf_mod);
 #endif
 #ifdef __FreeBSD__
 	SDT_KASSERT(probe->sdtp_lf->nenabled > 0, ("no probes enabled"));



CVS commit: src/external/cddl/osnet/dev/dtrace/i386

2022-08-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 21 18:58:45 UTC 2022

Modified Files:
src/external/cddl/osnet/dev/dtrace/i386: dtrace_subr.c

Log Message:
dtrace/i386: Need machine/cpufunc.h for x86_read_flags and rcr2.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.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/dev/dtrace/i386/dtrace_subr.c
diff -u src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c:1.13 src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c:1.14
--- src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c:1.13	Tue Apr  6 12:48:59 2021
+++ src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c	Sun Aug 21 18:58:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: dtrace_subr.c,v 1.13 2021/04/06 12:48:59 simonb Exp $	*/
+/*	$NetBSD: dtrace_subr.c,v 1.14 2022/08/21 18:58:45 riastradh Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -45,6 +45,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 



CVS commit: src/external/cddl/osnet/dev/dtrace/i386

2022-08-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 21 18:58:45 UTC 2022

Modified Files:
src/external/cddl/osnet/dev/dtrace/i386: dtrace_subr.c

Log Message:
dtrace/i386: Need machine/cpufunc.h for x86_read_flags and rcr2.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c

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



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

2022-08-02 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Aug  3 01:53:06 UTC 2022

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

Log Message:
change the ARC reclaim code to use the pagedaemon's free page target
rather than having a separate target.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.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/arc.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.21 src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.22
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.21	Wed May  4 15:49:55 2022
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c	Wed Aug  3 01:53:06 2022
@@ -288,6 +288,7 @@ int arc_procfd;
 #define	freemem		uvm_availmem(false)
 #define	minfree		uvmexp.freemin
 #define	desfree		uvmexp.freetarg
+#define	zfs_arc_free_target desfree
 #define	lotsfree	(desfree * 2)
 #define	availrmem	desfree
 #define	swapfs_minfree	0
@@ -387,7 +388,6 @@ int zfs_arc_grow_retry = 0;
 int zfs_arc_shrink_shift = 0;
 int zfs_arc_p_min_shift = 0;
 uint64_t zfs_arc_average_blocksize = 8 * 1024; /* 8KB */
-u_int zfs_arc_free_target = 0;
 
 /* Absolute min for arc min / max is 16MB. */
 static uint64_t arc_abs_min = 16 << 20;
@@ -395,6 +395,8 @@ static uint64_t arc_abs_min = 16 << 20;
 boolean_t zfs_compressed_arc_enabled = B_TRUE;
 
 #if defined(__FreeBSD__) && defined(_KERNEL)
+u_int zfs_arc_free_target = 0;
+
 static int sysctl_vfs_zfs_arc_free_target(SYSCTL_HANDLER_ARGS);
 static int sysctl_vfs_zfs_arc_meta_limit(SYSCTL_HANDLER_ARGS);
 static int sysctl_vfs_zfs_arc_max(SYSCTL_HANDLER_ARGS);



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

2022-08-02 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Aug  3 01:53:06 UTC 2022

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

Log Message:
change the ARC reclaim code to use the pagedaemon's free page target
rather than having a separate target.


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

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



CVS commit: src/external/cddl/osnet/sys

2022-07-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 30 13:09:20 UTC 2022

Modified Files:
src/external/cddl/osnet/sys/kern: misc.c
src/external/cddl/osnet/sys/sys: proc.h

Log Message:
solaris: Give threads less bad names.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/cddl/osnet/sys/kern/misc.c
cvs rdiff -u -r1.9 -r1.10 src/external/cddl/osnet/sys/sys/proc.h

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



CVS commit: src/external/cddl/osnet/sys

2022-07-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 30 13:09:20 UTC 2022

Modified Files:
src/external/cddl/osnet/sys/kern: misc.c
src/external/cddl/osnet/sys/sys: proc.h

Log Message:
solaris: Give threads less bad names.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/cddl/osnet/sys/kern/misc.c
cvs rdiff -u -r1.9 -r1.10 src/external/cddl/osnet/sys/sys/proc.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/sys/kern/misc.c
diff -u src/external/cddl/osnet/sys/kern/misc.c:1.9 src/external/cddl/osnet/sys/kern/misc.c:1.10
--- src/external/cddl/osnet/sys/kern/misc.c:1.9	Thu Jun 11 19:20:42 2020
+++ src/external/cddl/osnet/sys/kern/misc.c	Sat Jul 30 13:09:19 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: misc.c,v 1.9 2020/06/11 19:20:42 ad Exp $	*/
+/*	$NetBSD: misc.c,v 1.10 2022/07/30 13:09:19 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -94,8 +94,8 @@ vn_is_readonly(vnode_t *vp)
 }
 
 kthread_t *
-thread_create(void * stk, size_t stksize, void (*proc)(), void *arg,
-	  size_t len, proc_t *pp, int state, pri_t pri)
+solaris__thread_create(void * stk, size_t stksize, void (*proc)(), void *arg,
+size_t len, proc_t *pp, int state, pri_t pri, const char *name)
 {
 	int error;
 	lwp_t *thr;
@@ -105,7 +105,7 @@ thread_create(void * stk, size_t stksize
 	ASSERT(state == TS_RUN);
 
 	error = kthread_create(pri, KTHREAD_MPSAFE, NULL,
-	proc, arg, , "zfs");
+	proc, arg, , "%s", name);
 	KASSERT(error == 0);
 	return thr;
 }

Index: src/external/cddl/osnet/sys/sys/proc.h
diff -u src/external/cddl/osnet/sys/sys/proc.h:1.9 src/external/cddl/osnet/sys/sys/proc.h:1.10
--- src/external/cddl/osnet/sys/sys/proc.h:1.9	Thu Nov 15 04:55:26 2018
+++ src/external/cddl/osnet/sys/sys/proc.h	Sat Jul 30 13:09:19 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: proc.h,v 1.9 2018/11/15 04:55:26 riastradh Exp $	*/
+/*	$NetBSD: proc.h,v 1.10 2022/07/30 13:09:19 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -89,8 +89,11 @@ typedef struct lwp	*kthread_id_t;
 struct contract {
 };
 
-kthread_t *thread_create(void *, size_t, void (*)(void *), void *, size_t,
-			 proc_t *, int, pri_t);
+#define	thread_create(stk, stksz, proc, arg, len, pp, state, pri)	  \
+	solaris__thread_create(stk, stksz, proc, arg, len, pp, state, pri,\
+	#proc)
+kthread_t *solaris__thread_create(void *, size_t, void (*)(void *), void *,
+size_t, proc_t *, int, pri_t, const char *);
 void	thread_exit(void);
 void	thread_join(uint64_t);
 



CVS commit: src/external/cddl/osnet/sys/sys

2022-07-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 30 13:03:05 UTC 2022

Modified Files:
src/external/cddl/osnet/sys/sys: sdt.h

Log Message:
osnet: Stop disabling dtrace probes.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/cddl/osnet/sys/sys/sdt.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/sys/sys/sdt.h
diff -u src/external/cddl/osnet/sys/sys/sdt.h:1.8 src/external/cddl/osnet/sys/sys/sdt.h:1.9
--- src/external/cddl/osnet/sys/sys/sdt.h:1.8	Mon May 28 21:05:10 2018
+++ src/external/cddl/osnet/sys/sys/sdt.h	Sat Jul 30 13:03:05 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdt.h,v 1.8 2018/05/28 21:05:10 chs Exp $	*/
+/*	$NetBSD: sdt.h,v 1.9 2022/07/30 13:03:05 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek 
@@ -33,27 +33,6 @@
 
 #include_next 
 #include 
- 
-#undef	DTRACE_PROBE
-#undef	DTRACE_PROBE1
-#undef	DTRACE_PROBE2
-#undef	DTRACE_PROBE3
-#undef	DTRACE_PROBE4
-#undef	DTRACE_PROBE5
-#undef	DTRACE_PROBE6
-#undef	DTRACE_PROBE7
-
-#define	DTRACE_PROBE(name)
-#define	DTRACE_PROBE1(name, type1, arg1)
-#define	DTRACE_PROBE2(name, type1, arg1, type2, arg2)
-#define	DTRACE_PROBE3(name, type1, arg1, type2, arg2, type3, arg3)
-#define	DTRACE_PROBE4(name, type1, arg1, type2, arg2, type3, arg3, type4, arg4) 
-#define	DTRACE_PROBE5(name, type1, arg1, type2, arg2, type3, arg3, \
-	type4, arg4, type5, arg5)
-#define	DTRACE_PROBE6(name, type1, arg1, type2, arg2, type3, arg3, \
-	type4, arg4, type5, arg5, type6, arg6)
-#define	DTRACE_PROBE7(name, type1, arg1, type2, arg2, type3, arg3, \
-	type4, arg4, type5, arg5, type6, arg6, type7, arg7)
 
 #ifdef KDTRACE_HOOKS
 SDT_PROBE_DECLARE(sdt, , , set__error);



CVS commit: src/external/cddl/osnet/sys/sys

2022-07-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 30 13:03:05 UTC 2022

Modified Files:
src/external/cddl/osnet/sys/sys: sdt.h

Log Message:
osnet: Stop disabling dtrace probes.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/cddl/osnet/sys/sys/sdt.h

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



CVS commit: src/external/cddl/osnet/sys/sys

2022-07-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 30 12:59:31 UTC 2022

Modified Files:
src/external/cddl/osnet/sys/sys: kcondvar.h

Log Message:
zfs: Give condvars more meaningful names.

These will be truncated to 16 characters, but hey, better'n `zfscv'.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/sys/sys/kcondvar.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/sys/sys/kcondvar.h
diff -u src/external/cddl/osnet/sys/sys/kcondvar.h:1.4 src/external/cddl/osnet/sys/sys/kcondvar.h:1.5
--- src/external/cddl/osnet/sys/sys/kcondvar.h:1.4	Mon May 28 21:05:10 2018
+++ src/external/cddl/osnet/sys/sys/kcondvar.h	Sat Jul 30 12:59:31 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: kcondvar.h,v 1.4 2018/05/28 21:05:10 chs Exp $	*/
+/*	$NetBSD: kcondvar.h,v 1.5 2022/07/30 12:59:31 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@ typedef enum {
 	TR_CLOCK_TICK,
 } time_res_t;
 
-#define	cv_init(a, b, c, d)	cv_init(a, "zfscv")
+#define	cv_init(a, b, c, d)	cv_init(a, #a)
 
 static inline clock_t
 cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, hrtime_t res,



CVS commit: src/external/cddl/osnet/sys/sys

2022-07-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 30 12:59:31 UTC 2022

Modified Files:
src/external/cddl/osnet/sys/sys: kcondvar.h

Log Message:
zfs: Give condvars more meaningful names.

These will be truncated to 16 characters, but hey, better'n `zfscv'.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/sys/sys/kcondvar.h

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



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

2022-05-04 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed May  4 15:49:55 UTC 2022

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

Log Message:
fix ARC checks for available memory:
there's an extra check that we inherited from FreeBSD that tries to
detect KVA exhaustion on platforms with limited KVA, but the condition
that decided whether to use the extra check was using a FreeBSDism
that doesn't exist on NetBSD, resulting in this check being used on
all platforms.  on amd64 systems with lots of memory, this extra check
would result in the ARC thinking that it constantly needed to reclaim memory,
resulting in all the xcall threads running all the time but not doing
anything useful.  change this condition so that this extra check for
KVA exhaustion is only used on 32-bit platforms.  fixes PR 55707.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.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/arc.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.20 src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.21
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.20	Wed Apr 21 10:02:34 2021
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c	Wed May  4 15:49:55 2022
@@ -3963,7 +3963,7 @@ arc_available_memory(void)
 	}
 
 #endif	/* illumos */
-#if defined(__i386) || !defined(UMA_MD_SMALL_ALLOC)
+#if !defined(_LP64)
 	/*
 	 * If we're on an i386 platform, it's possible that we'll exhaust the
 	 * kernel heap space before we ever run out of available physical
@@ -5750,7 +5750,7 @@ arc_memory_throttle(uint64_t reserve, ui
 	static uint64_t page_load = 0;
 	static uint64_t last_txg = 0;
 
-#if defined(__i386) || !defined(UMA_MD_SMALL_ALLOC)
+#if !defined(_LP64)
 	available_memory =
 	MIN(available_memory, ptob(vmem_size(heap_arena, VMEM_FREE)));
 #endif



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

2022-05-04 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed May  4 15:49:55 UTC 2022

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

Log Message:
fix ARC checks for available memory:
there's an extra check that we inherited from FreeBSD that tries to
detect KVA exhaustion on platforms with limited KVA, but the condition
that decided whether to use the extra check was using a FreeBSDism
that doesn't exist on NetBSD, resulting in this check being used on
all platforms.  on amd64 systems with lots of memory, this extra check
would result in the ARC thinking that it constantly needed to reclaim memory,
resulting in all the xcall threads running all the time but not doing
anything useful.  change this condition so that this extra check for
KVA exhaustion is only used on 32-bit platforms.  fixes PR 55707.


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

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



CVS commit: src/external/cddl/osnet/sys/sys

2022-05-03 Thread Joseph Koshy
Module Name:src
Committed By:   jkoshy
Date:   Tue May  3 12:09:19 UTC 2022

Modified Files:
src/external/cddl/osnet/sys/sys: README

Log Message:
Minor: fix a typo.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/sys/sys/README

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/README
diff -u src/external/cddl/osnet/sys/sys/README:1.1 src/external/cddl/osnet/sys/sys/README:1.2
--- src/external/cddl/osnet/sys/sys/README:1.1	Sun Jun  3 20:59:49 2018
+++ src/external/cddl/osnet/sys/sys/README	Tue May  3 12:09:19 2022
@@ -1,4 +1,4 @@
-# $NetBSD: README,v 1.1 2018/06/03 20:59:49 christos Exp $
+# $NetBSD: README,v 1.2 2022/05/03 12:09:19 jkoshy Exp $
 
 General guidelines for system wrapper header maintainance.
 
@@ -26,7 +26,7 @@ solaris/foo.h:
 
 #endif /* SOLARIS_SYS_FOO_H */
 
-Now there caaes where the solaris headers expose more stuff than ours,
+Now there cases where the solaris headers expose more stuff than ours,
 so we need to include more of our system headers from theirs. When that
 happens the rule should be that:
 



CVS commit: src/external/cddl/osnet/sys/sys

2022-05-03 Thread Joseph Koshy
Module Name:src
Committed By:   jkoshy
Date:   Tue May  3 12:09:19 UTC 2022

Modified Files:
src/external/cddl/osnet/sys/sys: README

Log Message:
Minor: fix a typo.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/sys/sys/README

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



CVS commit: src/external/cddl/osnet/dist/lib/libdtrace/common

2022-05-02 Thread Joseph Koshy
Module Name:src
Committed By:   jkoshy
Date:   Mon May  2 20:09:48 UTC 2022

Modified Files:
src/external/cddl/osnet/dist/lib/libdtrace/common: dt_link.c

Log Message:
Follow FreeBSD revision <0e15d9fbeba4> and simplify #ifdef'ed code.

This change avoids redefining 'SHN_SUNW_IGNORE' if the symbol is already
present.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/external/cddl/osnet/dist/lib/libdtrace/common/dt_link.c

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



CVS commit: src/external/cddl/osnet/dist/lib/libdtrace/common

2022-05-02 Thread Joseph Koshy
Module Name:src
Committed By:   jkoshy
Date:   Mon May  2 20:09:48 UTC 2022

Modified Files:
src/external/cddl/osnet/dist/lib/libdtrace/common: dt_link.c

Log Message:
Follow FreeBSD revision <0e15d9fbeba4> and simplify #ifdef'ed code.

This change avoids redefining 'SHN_SUNW_IGNORE' if the symbol is already
present.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/external/cddl/osnet/dist/lib/libdtrace/common/dt_link.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/lib/libdtrace/common/dt_link.c
diff -u src/external/cddl/osnet/dist/lib/libdtrace/common/dt_link.c:1.12 src/external/cddl/osnet/dist/lib/libdtrace/common/dt_link.c:1.13
--- src/external/cddl/osnet/dist/lib/libdtrace/common/dt_link.c:1.12	Tue Dec  3 22:10:56 2019
+++ src/external/cddl/osnet/dist/lib/libdtrace/common/dt_link.c	Mon May  2 20:09:48 2022
@@ -1678,11 +1678,8 @@ process_obj(dtrace_hdl_t *dtp, const cha
 			 * already been processed by an earlier link
 			 * invocation.
 			 */
-#ifndef illumos
-#define SHN_SUNW_IGNORE	SHN_ABS
-#endif
-			if (rsym.st_shndx != SHN_SUNW_IGNORE) {
-rsym.st_shndx = SHN_SUNW_IGNORE;
+			if (rsym.st_shndx != SHN_ABS) {
+rsym.st_shndx = SHN_ABS;
 (void) gelf_update_sym(data_sym, ndx, );
 			}
 		}



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

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:56:45 UTC 2022

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

Log Message:
Unlock vnode for VOP_IOCTL().


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.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/vdev_disk.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.19 src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.20
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.19	Sat Nov 28 22:53:06 2020
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c	Sat Apr 16 07:56:45 2022
@@ -132,9 +132,7 @@ vdev_disk_flush(struct work *work, void 
 	KASSERT(vp == dvd->vd_vp);
 
 	cmd = 1;
-	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	error = VOP_IOCTL(vp, DIOCCACHESYNC, , FREAD|FWRITE, kcred);
-	VOP_UNLOCK(vp, 0);
 	bp->b_error = error;
 	vdev_disk_io_intr(bp);
 }



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

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:56:45 UTC 2022

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

Log Message:
Unlock vnode for VOP_IOCTL().


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

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



CVS commit: src/external/cddl/osnet/sys/kern

2022-03-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 30 16:34:27 UTC 2022

Modified Files:
src/external/cddl/osnet/sys/kern: policy.c

Log Message:
Add link our policy.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/cddl/osnet/sys/kern/policy.c

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

Modified files:

Index: src/external/cddl/osnet/sys/kern/policy.c
diff -u src/external/cddl/osnet/sys/kern/policy.c:1.9 src/external/cddl/osnet/sys/kern/policy.c:1.10
--- src/external/cddl/osnet/sys/kern/policy.c:1.9	Fri Aug 28 12:13:48 2020
+++ src/external/cddl/osnet/sys/kern/policy.c	Wed Mar 30 12:34:27 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: policy.c,v 1.9 2020/08/28 16:13:48 hannken Exp $	*/
+/*	$NetBSD: policy.c,v 1.10 2022/03/30 16:34:27 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -144,7 +144,8 @@ int
 secpolicy_basic_link(vnode_t *vp, cred_t *cred)
 {
 
-	return kauth_authorize_generic(cred, KAUTH_GENERIC_ISSUSER, NULL);
+	return kauth_authorize_vnode(cred, KAUTH_VNODE_ADD_LINK, vp, 
+	/* XXX dvp, currently unused */ NULL, 0);
 }
 
 int



CVS commit: src/external/cddl/osnet/sys/kern

2022-03-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 30 16:34:27 UTC 2022

Modified Files:
src/external/cddl/osnet/sys/kern: policy.c

Log Message:
Add link our policy.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/cddl/osnet/sys/kern/policy.c

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



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

2022-03-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 27 16:26:26 UTC 2022

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

Log Message:
add a kauth vnode check for adding links


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 \
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.77 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.78
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.77	Wed Dec 22 09:04:10 2021
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Sun Mar 27 12:26:26 2022
@@ -5794,10 +5794,19 @@ zfs_netbsd_link(void *v)
 	nm = PNBUF_GET();
 	(void)strlcpy(nm, cnp->cn_nameptr, cnp->cn_namelen + 1);
 
-	vn_lock(vp, LK_EXCLUSIVE);
+	if ((error = vn_lock(vp, LK_EXCLUSIVE)) != 0) {
+		/* XXX: No ABORTOP? */
+		PNBUF_PUT(nm);
+		return error;
+	}
+	error = kauth_authorize_vnode(cnp->cn_cred, KAUTH_VNODE_ADD_LINK, vp,
+	dvp, 0);
+	if (error)
+		goto out;
 	error = zfs_link(dvp, vp, nm, cnp->cn_cred,
 	NULL, 0);
 
+out:
 	PNBUF_PUT(nm);
 	VOP_UNLOCK(vp, 0);
 	return error;



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

2022-03-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 27 16:26:26 UTC 2022

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

Log Message:
add a kauth vnode check for adding links


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 \
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.



CVS commit: src/external/cddl/osnet/sys/kern

2022-03-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Mar 18 23:32:14 UTC 2022

Modified Files:
src/external/cddl/osnet/sys/kern: ddi.c

Log Message:
osnet: Delete dead #if 0 code using hardclock_ticks.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/cddl/osnet/sys/kern/ddi.c

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



CVS commit: src/external/cddl/osnet/sys/kern

2022-03-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Mar 18 23:32:14 UTC 2022

Modified Files:
src/external/cddl/osnet/sys/kern: ddi.c

Log Message:
osnet: Delete dead #if 0 code using hardclock_ticks.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/cddl/osnet/sys/kern/ddi.c

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

Modified files:

Index: src/external/cddl/osnet/sys/kern/ddi.c
diff -u src/external/cddl/osnet/sys/kern/ddi.c:1.8 src/external/cddl/osnet/sys/kern/ddi.c:1.9
--- src/external/cddl/osnet/sys/kern/ddi.c:1.8	Tue Jun 18 22:34:26 2019
+++ src/external/cddl/osnet/sys/kern/ddi.c	Fri Mar 18 23:32:14 2022
@@ -675,19 +675,3 @@ ddi_remove_minor_node(dev_info_t *dip, c
 	do_rmdirp(pn);
 	PNBUF_PUT(pn);
 }
-
-#if 0
-clock_t
-ddi_get_lbolt()
-{
-
-	return hardclock_ticks;
-}
-
-int64_t
-ddi_get_lbolt64()
-{
-
-	return hardclock_ticks;
-}
-#endif



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

2021-12-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Dec 28 17:51:23 UTC 2021

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs/sys: zfs_context.h

Log Message:
zfs: Expose hostid to zfs, as in gethostid/sethostid(3).

If set to nonzero, the hostid is recorded in the metadata of a zpool,
and checked by `zpool import' when the pool has not been explicitly
exported.  After reboot, zpool import will not need `-f' to reimport
the pool.

Setting the hostid must be done explicitly through sysctl (or the
sethostid(3) library call) on all ports except acorn32, amiga,
mvme68k, newsmips, sparc, sparc64, sun2, and sun3.  So for most users
this change will have no immediate effect.  But you can obviate the
need for `zpool import -f' by adding `kern.hostid=123456789' to
/etc/sysctl.conf and importing the pool one last time with `-f'.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_context.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/sys/zfs_context.h
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_context.h:1.3 src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_context.h:1.4
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_context.h:1.3	Tue Feb 16 09:54:17 2021
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_context.h	Tue Dec 28 17:51:23 2021
@@ -130,6 +130,7 @@ extern "C" {
 #include 
 #else /* !__NetBSD__ */
 #include 
+#include 
 #include 
 
 #include 
@@ -165,7 +166,7 @@ extern "C" {
 #define td_rul_ru
 #define UID_NOBODY			(32767)
 #define vnode_pager_setsize(vp, size)	zfs_netbsd_setsize(vp, size)
-#define zone_get_hostid(a)		0
+#define zone_get_hostid(a)		((unsigned)hostid)
 
 extern struct utsname utsname;
 



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

2021-12-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Dec 28 17:51:23 UTC 2021

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs/sys: zfs_context.h

Log Message:
zfs: Expose hostid to zfs, as in gethostid/sethostid(3).

If set to nonzero, the hostid is recorded in the metadata of a zpool,
and checked by `zpool import' when the pool has not been explicitly
exported.  After reboot, zpool import will not need `-f' to reimport
the pool.

Setting the hostid must be done explicitly through sysctl (or the
sethostid(3) library call) on all ports except acorn32, amiga,
mvme68k, newsmips, sparc, sparc64, sun2, and sun3.  So for most users
this change will have no immediate effect.  But you can obviate the
need for `zpool import -f' by adding `kern.hostid=123456789' to
/etc/sysctl.conf and importing the pool one last time with `-f'.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_context.h

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



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

2021-12-22 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Dec 22 14:04:10 UTC 2021

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

Log Message:
In zfs_setattr() don't recheck the auth policy for a "nodump" flags
change. zfs_netbsd_setattr() has already checked if this request is
authorised, and our secpolicy_xvattr() doesn't check kauth chflags.

XXX: Fix this propery when we migrate to openzfs.

riastradh@: Seems reasonable.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 \
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.76 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.77
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.76	Wed Oct 20 03:08:19 2021
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Wed Dec 22 14:04:10 2021
@@ -3503,7 +3503,17 @@ zfs_setattr(vnode_t *vp, vattr_t *vap, i
 		if (XVA_ISSET_REQ(xvap, XAT_NODUMP)) {
 			if (xoap->xoa_nodump !=
 			((zp->z_pflags & ZFS_NODUMP) != 0)) {
+#if 0
+/*
+ * XXXSB - zfs_netbsd_setattr()
+ * has already checked if this
+ * request is authorised, and our
+ * secpolicy_xvattr() doesn't check
+ * kauth chflags.  Fix this when we
+ * migrate to openzfs.
+ */
 need_policy = TRUE;
+#endif
 			} else {
 XVA_CLR_REQ(xvap, XAT_NODUMP);
 XVA_SET_REQ(, XAT_NODUMP);



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

2021-12-22 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Dec 22 14:04:10 UTC 2021

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

Log Message:
In zfs_setattr() don't recheck the auth policy for a "nodump" flags
change. zfs_netbsd_setattr() has already checked if this request is
authorised, and our secpolicy_xvattr() doesn't check kauth chflags.

XXX: Fix this propery when we migrate to openzfs.

riastradh@: Seems reasonable.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 \
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.



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

2021-12-21 Thread Hauke Fath
Module Name:src
Committed By:   hauke
Date:   Tue Dec 21 15:08:14 UTC 2021

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

Log Message:
Default files to BSD group ownership in line with ffs, after the lead
of FreeBSD 
(patch by hannken@)


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

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



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

2021-12-21 Thread Hauke Fath
Module Name:src
Committed By:   hauke
Date:   Tue Dec 21 15:08:14 UTC 2021

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

Log Message:
Default files to BSD group ownership in line with ffs, after the lead
of FreeBSD 
(patch by hannken@)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_acl.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_acl.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_acl.c:1.6 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_acl.c:1.7
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_acl.c:1.6	Tue Mar 17 00:54:03 2020
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_acl.c	Tue Dec 21 15:08:14 2021
@@ -1661,7 +1661,7 @@ zfs_acl_ids_create(znode_t *dzp, int fla
 			} else {
 acl_ids->z_fgid = zfs_fuid_create_cred(zfsvfs,
 ZFS_GROUP, cr, _ids->z_fuidp);
-#ifdef __FreeBSD_kernel__
+#if defined(__FreeBSD_kernel__) || defined(__NetBSD__)
 gid = acl_ids->z_fgid = dzp->z_gid;
 #else
 gid = crgetgid(cr);



CVS commit: src/external/cddl/osnet/sys/sys

2021-12-17 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri Dec 17 08:07:12 UTC 2021

Modified Files:
src/external/cddl/osnet/sys/sys: vnode.h

Log Message:
In vattr_init_mask() check for va_flags and if set add to the mask of
to the things that setattr is interested in.
Fixes chflags(2) on ZFS.

Thanks riastradh@ for fix.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/external/cddl/osnet/sys/sys/vnode.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/sys/sys/vnode.h
diff -u src/external/cddl/osnet/sys/sys/vnode.h:1.20 src/external/cddl/osnet/sys/sys/vnode.h:1.21
--- src/external/cddl/osnet/sys/sys/vnode.h:1.20	Sun Jul 18 07:22:22 2021
+++ src/external/cddl/osnet/sys/sys/vnode.h	Fri Dec 17 08:07:12 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnode.h,v 1.20 2021/07/18 07:22:22 kardel Exp $	*/
+/*	$NetBSD: vnode.h,v 1.21 2021/12/17 08:07:12 simonb Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -227,6 +227,8 @@ vattr_init_mask(vattr_t *vap)
 		vap->va_mask |= AT_MTIME;
 	if (vap->va_mode != (mode_t)VNOVAL)
 		vap->va_mask |= AT_MODE;
+	if (vap->va_flags != VNOVAL)
+		vap->va_mask |= AT_XVATTR;
 }
 
 #define	FCREAT	O_CREAT



CVS commit: src/external/cddl/osnet/sys/sys

2021-12-17 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri Dec 17 08:07:12 UTC 2021

Modified Files:
src/external/cddl/osnet/sys/sys: vnode.h

Log Message:
In vattr_init_mask() check for va_flags and if set add to the mask of
to the things that setattr is interested in.
Fixes chflags(2) on ZFS.

Thanks riastradh@ for fix.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/external/cddl/osnet/sys/sys/vnode.h

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



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

2021-11-30 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Nov 30 12:37:38 UTC 2021

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

Log Message:
In zfs_statvfs(), set f_bresvd and f_fresvd to 0.  Fixes random kernel
accounting suspend/resumes with erroneous values leaking out.

Note: no userland leakage as statvfs(2) handler memset 0's the buffer.

XXX: Should be fixed with a memset in VFS_STATVFS().


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.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_vfsops.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c:1.29 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c:1.30
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c:1.29	Thu Aug 27 09:57:33 2020
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c	Tue Nov 30 12:37:38 2021
@@ -2182,6 +2182,7 @@ zfs_statvfs(vfs_t *vfsp, struct statvfs 
 	statp->f_blocks = (refdbytes + availbytes) >> SPA_MINBLOCKSHIFT;
 	statp->f_bfree = availbytes / statp->f_bsize;
 	statp->f_bavail = statp->f_bfree; /* no root reservation */
+	statp->f_bresvd = 0;
 
 	/*
 	 * statvfs() should really be called statufs(), because it assumes
@@ -2196,6 +2197,7 @@ zfs_statvfs(vfs_t *vfsp, struct statvfs 
 	statp->f_favail = statp->f_ffree;	/* no "root reservation" */
 #endif
 	statp->f_files = statp->f_ffree + usedobjs;
+	statp->f_fresvd = 0;
 
 #ifdef __FreeBSD__
 	(void) cmpldev(, vfsp->vfs_dev);



  1   2   3   4   >