aboutsummaryrefslogtreecommitdiff
path: root/cddl/lib
diff options
context:
space:
mode:
Diffstat (limited to 'cddl/lib')
-rw-r--r--cddl/lib/Makefile52
-rw-r--r--cddl/lib/Makefile.inc2
-rw-r--r--cddl/lib/drti/Makefile11
-rw-r--r--cddl/lib/drti/Makefile.depend1
-rw-r--r--cddl/lib/libavl/Makefile15
-rw-r--r--cddl/lib/libavl/Makefile.depend3
-rw-r--r--cddl/lib/libctf/Makefile12
-rw-r--r--cddl/lib/libctf/Makefile.depend2
-rw-r--r--cddl/lib/libdtrace/Makefile34
-rw-r--r--cddl/lib/libdtrace/Makefile.depend4
-rw-r--r--cddl/lib/libdtrace/errno.d2
-rw-r--r--cddl/lib/libdtrace/io.d7
-rw-r--r--cddl/lib/libdtrace/ip.d6
-rw-r--r--cddl/lib/libdtrace/libproc_compat.h4
-rw-r--r--cddl/lib/libdtrace/net.d2
-rw-r--r--cddl/lib/libdtrace/nfs.d2
-rw-r--r--cddl/lib/libdtrace/nfssrv.d2
-rw-r--r--cddl/lib/libdtrace/psinfo.d4
-rw-r--r--cddl/lib/libdtrace/regs_aarch64.d74
-rw-r--r--cddl/lib/libdtrace/regs_riscv.d74
-rw-r--r--cddl/lib/libdtrace/regs_x86.d8
-rw-r--r--cddl/lib/libdtrace/sched.d2
-rw-r--r--cddl/lib/libdtrace/sctp.d2
-rw-r--r--cddl/lib/libdtrace/siftr.d55
-rw-r--r--cddl/lib/libdtrace/signal.d2
-rw-r--r--cddl/lib/libdtrace/socket.d2
-rw-r--r--cddl/lib/libdtrace/tcp.d63
-rw-r--r--cddl/lib/libdtrace/udp.d2
-rw-r--r--cddl/lib/libdtrace/udplite.d2
-rw-r--r--cddl/lib/libdtrace/unistd.d2
-rw-r--r--cddl/lib/libicp/Makefile76
-rw-r--r--cddl/lib/libicp/Makefile.depend15
-rw-r--r--cddl/lib/libicp_rescue/Makefile71
-rw-r--r--cddl/lib/libicp_rescue/Makefile.depend15
-rw-r--r--cddl/lib/libnvpair/Makefile20
-rw-r--r--cddl/lib/libnvpair/Makefile.depend3
-rw-r--r--cddl/lib/libspl/Makefile38
-rw-r--r--cddl/lib/libspl/Makefile.depend15
-rw-r--r--cddl/lib/libtpool/Makefile29
-rw-r--r--cddl/lib/libtpool/Makefile.depend16
-rw-r--r--cddl/lib/libtpool/tests/Makefile11
-rw-r--r--cddl/lib/libtpool/tests/libtpool_test.c82
-rw-r--r--cddl/lib/libumem/Makefile6
-rw-r--r--cddl/lib/libumem/Makefile.depend1
-rw-r--r--cddl/lib/libuutil/Makefile15
-rw-r--r--cddl/lib/libuutil/Makefile.depend3
-rw-r--r--cddl/lib/libzdb/Makefile28
-rw-r--r--cddl/lib/libzdb/Makefile.depend14
-rw-r--r--cddl/lib/libzfs/Makefile42
-rw-r--r--cddl/lib/libzfs/Makefile.depend4
-rw-r--r--cddl/lib/libzfs_core/Makefile29
-rw-r--r--cddl/lib/libzfs_core/Makefile.depend4
-rw-r--r--cddl/lib/libzfsbootenv/Makefile21
-rw-r--r--cddl/lib/libzfsbootenv/Makefile.depend17
-rw-r--r--cddl/lib/libzpool/Makefile52
-rw-r--r--cddl/lib/libzpool/Makefile.depend4
-rw-r--r--cddl/lib/libzutil/Makefile23
-rw-r--r--cddl/lib/libzutil/Makefile.depend19
-rw-r--r--cddl/lib/pam_zfs_key/Makefile20
-rw-r--r--cddl/lib/tests/Makefile2
-rw-r--r--cddl/lib/tests/Makefile.depend1
61 files changed, 796 insertions, 353 deletions
diff --git a/cddl/lib/Makefile b/cddl/lib/Makefile
index 5ca0d56b291a..892798be347d 100644
--- a/cddl/lib/Makefile
+++ b/cddl/lib/Makefile
@@ -1,40 +1,32 @@
-# $FreeBSD$
-
.include <src.opts.mk>
-SUBDIR= drti \
- libavl \
+.if ${MK_DTRACE} == yes || ${MK_ZFS} == yes
+SUBDIR= libspl
+.endif
+
+SUBDIR.${MK_DTRACE}+= \
+ drti \
libctf \
- libdtrace \
- ${_libicp} \
- ${_libicp_rescue} \
+ libdtrace
+
+SUBDIR.${MK_TESTS}+= tests
+
+SUBDIR.${MK_ZFS}+= \
+ libavl \
+ libicp \
+ libicp_rescue \
libnvpair \
- libspl \
- ${_libtpool} \
+ libtpool \
libumem \
libuutil \
- ${_libzfs_core} \
- ${_libzfs} \
- ${_libzfsbootenv} \
- ${_libzpool} \
- ${_libzutil} \
- ${_pam_zfs_key}
-
-SUBDIR.${MK_TESTS}+= tests
+ libzdb \
+ libzfs \
+ libzfs_core \
+ libzfsbootenv \
+ libzpool \
+ libzutil
-.if ${MK_ZFS} != "no"
-_libzfs_core= libzfs_core
-_libicp= libicp
-_libicp_rescue= libicp_rescue
-_libzfs= libzfs
-_libzutil= libzutil
-_libzfsbootenv= libzfsbootenv
-_libzpool= libzpool
-_libtpool= libtpool
-.if ${MK_OPENSSL} != "no"
-_pam_zfs_key= pam_zfs_key
-.endif
-.endif
+SUBDIR.${MK_ZFS}.${MK_OPENSSL} = pam_zfs_key
SUBDIR_DEPEND_libavl= libspl
SUBDIR_DEPEND_libctf= libspl
diff --git a/cddl/lib/Makefile.inc b/cddl/lib/Makefile.inc
index 8f9af1d17e9d..ebcc06f3e956 100644
--- a/cddl/lib/Makefile.inc
+++ b/cddl/lib/Makefile.inc
@@ -1,5 +1,3 @@
-# $FreeBSD$
-
SHLIBDIR?= /lib
SHLIB_MAJOR?= 2
diff --git a/cddl/lib/drti/Makefile b/cddl/lib/drti/Makefile
index 321352c7100c..dda6168a8195 100644
--- a/cddl/lib/drti/Makefile
+++ b/cddl/lib/drti/Makefile
@@ -1,5 +1,3 @@
-# $FreeBSD$
-
.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libdtrace/common
PACKAGE= dtrace
@@ -13,11 +11,12 @@ CLEANFILES= ${FILES}
# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY.
.undef LIBRARIES_ONLY
CFLAGS+= -DIN_BASE
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
+CFLAGS+= -DSKIP_SPL_SYS_CONDVAR_H
+CFLAGS+= -I${ZFSTOP}/include
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/os/freebsd
CFLAGS+= -I${SRCTOP}/sys
-CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h
CFLAGS+= -DHAVE_ISSETUGID
CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris \
-I${SRCTOP}/cddl/compat/opensolaris/include \
diff --git a/cddl/lib/drti/Makefile.depend b/cddl/lib/drti/Makefile.depend
index 422dbea77a29..2c564fe515ff 100644
--- a/cddl/lib/drti/Makefile.depend
+++ b/cddl/lib/drti/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/cddl/lib/libavl/Makefile b/cddl/lib/libavl/Makefile
index b5e3b458f982..aef8c34c853c 100644
--- a/cddl/lib/libavl/Makefile
+++ b/cddl/lib/libavl/Makefile
@@ -1,16 +1,17 @@
-# $FreeBSD$
+.PATH: ${ZFSTOP}/module/avl
-.PATH: ${SRCTOP}/sys/contrib/openzfs/module/avl
+PACKAGE= zfs
+LIB_PACKAGE=
-PACKAGE= runtime
LIB= avl
LIBADD= spl
SRCS= avl.c
WARNS?= 3
CFLAGS+= -DIN_BASE
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
+CFLAGS+= -I${ZFSTOP}/include
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/os/freebsd
CFLAGS+= -I${SRCTOP}/sys
-CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h
+
.include <bsd.lib.mk>
diff --git a/cddl/lib/libavl/Makefile.depend b/cddl/lib/libavl/Makefile.depend
index 1c1a9bee1d67..409c3c86cc20 100644
--- a/cddl/lib/libavl/Makefile.depend
+++ b/cddl/lib/libavl/Makefile.depend
@@ -1,8 +1,9 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
+ cddl/lib/libspl \
include \
+ include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
diff --git a/cddl/lib/libctf/Makefile b/cddl/lib/libctf/Makefile
index 860b327ca768..b47f4a47551a 100644
--- a/cddl/lib/libctf/Makefile
+++ b/cddl/lib/libctf/Makefile
@@ -1,9 +1,9 @@
-# $FreeBSD$
-
.PATH: ${SRCTOP}/cddl/contrib/opensolaris/common/ctf
.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libctf/common
.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/ctf
+PACKAGE= ctf
+LIB_PACKAGE=
LIB= ctf
SRCS= ctf_create.c \
ctf_decl.c \
@@ -22,10 +22,10 @@ WARNS?= 2
CFLAGS+= -DCTF_OLD_VERSIONS
CFLAGS+= -DIN_BASE
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
-CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -I${ZFSTOP}/include
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/os/freebsd
+CFLAGS+= -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h
CFLAGS+= -DHAVE_ISSETUGID
CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris \
diff --git a/cddl/lib/libctf/Makefile.depend b/cddl/lib/libctf/Makefile.depend
index ec3b871042c4..7cbc01413fbc 100644
--- a/cddl/lib/libctf/Makefile.depend
+++ b/cddl/lib/libctf/Makefile.depend
@@ -1,7 +1,7 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
+ cddl/lib/libspl \
include \
include/xlocale \
lib/${CSU_DIR} \
diff --git a/cddl/lib/libdtrace/Makefile b/cddl/lib/libdtrace/Makefile
index f95517f10ebb..0742d0b5cd5a 100644
--- a/cddl/lib/libdtrace/Makefile
+++ b/cddl/lib/libdtrace/Makefile
@@ -1,10 +1,13 @@
-# $FreeBSD$
+SHLIBDIR?= /lib
+
+.include <src.opts.mk>
.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libdtrace/common
.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libgen/common
PACKAGE= dtrace
LIB= dtrace
+
SRCS= dt_aggregate.c \
dt_as.c \
dt_buf.c \
@@ -74,16 +77,18 @@ SYSINCS+= ${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys/ctf_api.h
WARNS?= 1
CFLAGS+= -DIN_BASE
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
+CFLAGS+= -DSKIP_SPL_SYS_CONDVAR_H
+CFLAGS+= -I${ZFSTOP}/include
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/os/freebsd
CFLAGS+= -I${SRCTOP}/sys
-CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h
CFLAGS+= -DHAVE_ISSETUGID
CFLAGS+= -I${.OBJDIR} -I${.CURDIR} \
-I${SRCTOP}/sys/cddl/dev/dtrace/${MACHINE_ARCH} \
+ -I${SRCTOP}/sys/cddl/dev/kinst \
-I${SRCTOP}/sys/cddl/compat/opensolaris \
-I${SRCTOP}/cddl/compat/opensolaris/include \
-I${OPENSOLARIS_USR_DISTDIR}/head \
@@ -121,13 +126,28 @@ CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/intel
.endif
.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
-SRCS+= dis_tables.c
+SRCS+= dis_tables.c instr_size.c
DSRCS+= regs_x86.d
.endif
+.if ${MACHINE_CPUARCH} == "riscv"
+SRCS+= instr_size.c
+DSRCS+= regs_riscv.d
+.endif
+
+.if ${MACHINE_CPUARCH} == "aarch64"
+SRCS+= instr_size.c
+DSRCS+= regs_aarch64.d
+.endif
+
YFLAGS+=-d
-LIBADD= ctf elf proc pthread rtld_db
+.if ${MK_DTRACE_ASAN} != "no"
+CFLAGS+= -fsanitize=address -fsanitize=undefined
+LDFLAGS+= -fsanitize=address -fsanitize=undefined
+.endif
+
+LIBADD= ctf elf proc pthread rtld_db xo
CLEANFILES= dt_errtags.c dt_names.c
diff --git a/cddl/lib/libdtrace/Makefile.depend b/cddl/lib/libdtrace/Makefile.depend
index 68a8d3e9c520..92c6b0e658b5 100644
--- a/cddl/lib/libdtrace/Makefile.depend
+++ b/cddl/lib/libdtrace/Makefile.depend
@@ -1,9 +1,8 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
+ bin/sh.host \
cddl/lib/libctf \
- gnu/lib/csu \
include \
include/arpa \
include/xlocale \
@@ -14,6 +13,7 @@ DIRDEPS = \
lib/libproc \
lib/librtld_db \
lib/libthr \
+ usr.bin/awk.host \
usr.bin/yacc.host \
diff --git a/cddl/lib/libdtrace/errno.d b/cddl/lib/libdtrace/errno.d
index 426d882b0db1..2045e3a7433d 100644
--- a/cddl/lib/libdtrace/errno.d
+++ b/cddl/lib/libdtrace/errno.d
@@ -21,8 +21,6 @@
*
* Portions Copyright 2006-2008 John Birrell jb@freebsd.org
* Portions Copyright 2018 Devin Teske dteske@freebsd.org
- *
- * $FreeBSD$
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
diff --git a/cddl/lib/libdtrace/io.d b/cddl/lib/libdtrace/io.d
index d643ad732a94..484e6416bac7 100644
--- a/cddl/lib/libdtrace/io.d
+++ b/cddl/lib/libdtrace/io.d
@@ -19,8 +19,6 @@
* CDDL HEADER END
*
* Portions Copyright 2018 Devin Teske dteske@freebsd.org
- *
- * $FreeBSD$
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
@@ -75,7 +73,7 @@ translator bufinfo_t < struct bio *B > {
b_lblkno = 0;
b_resid = B->bio_resid;
b_bufsize = 0; /* XXX gnn */
- b_error = B->bio_error;
+ b_error = B->bio_exterr.error;
};
/*
@@ -196,6 +194,8 @@ inline int DEVSTAT_TYPE_IF_IDE = 0x020;
#pragma D binding "1.13" DEVSTAT_TYPE_IF_IDE
inline int DEVSTAT_TYPE_IF_OTHER = 0x030;
#pragma D binding "1.13" DEVSTAT_TYPE_IF_OTHER
+inline int DEVSTAT_TYPE_IF_NVME = 0x040;
+#pragma D binding "1.13" DEVSTAT_TYPE_IF_NVME
inline int DEVSTAT_TYPE_IF_MASK = 0x0f0;
#pragma D binding "1.13" DEVSTAT_TYPE_IF_MASK
inline int DEVSTAT_TYPE_PASS = 0x100;
@@ -230,6 +230,7 @@ inline string device_if_string[int type] =
type == DEVSTAT_TYPE_IF_SCSI ? "SCSI" :
type == DEVSTAT_TYPE_IF_IDE ? "IDE" :
type == DEVSTAT_TYPE_IF_OTHER ? "OTHER" :
+ type == DEVSTAT_TYPE_IF_NVME ? "NVME" :
strjoin("UNKNOWN(", strjoin(lltostr(type), ")"));
#pragma D binding "1.13" device_if
diff --git a/cddl/lib/libdtrace/ip.d b/cddl/lib/libdtrace/ip.d
index f591a965af68..2fe98858efc2 100644
--- a/cddl/lib/libdtrace/ip.d
+++ b/cddl/lib/libdtrace/ip.d
@@ -17,8 +17,6 @@
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
- *
- * $FreeBSD$
*/
/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
@@ -264,8 +262,8 @@ inline int IFF_LOOPBACK = 0x8;
#pragma D binding "1.5" translator
translator ifinfo_t < struct ifnet *p > {
- if_name = p->if_xname;
- if_local = (p->if_flags & IFF_LOOPBACK) == 0 ? 0 : 1;
+ if_name = p == NULL ? "<unknown>" : p->if_xname;
+ if_local = p == NULL ? 0 : (p->if_flags & IFF_LOOPBACK) == 0 ? 0 : 1;
if_addr = (uintptr_t)p;
};
diff --git a/cddl/lib/libdtrace/libproc_compat.h b/cddl/lib/libdtrace/libproc_compat.h
index 14f32506bb8f..7cdc8af18b56 100644
--- a/cddl/lib/libdtrace/libproc_compat.h
+++ b/cddl/lib/libdtrace/libproc_compat.h
@@ -25,8 +25,6 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
/*
@@ -58,10 +56,8 @@
#define Prd_agent proc_rdagent
#define Prelease proc_detach
#define Psetbkpt proc_bkptset
-#define Psetflags proc_setflags
#define Pstate proc_state
#define Psymbol_iter_by_addr proc_iter_symbyaddr
-#define Punsetflags proc_clearflags
#define Pupdate_maps proc_rdagent
#define Pupdate_syms proc_updatesyms
#define Pxecbkpt proc_bkptexec
diff --git a/cddl/lib/libdtrace/net.d b/cddl/lib/libdtrace/net.d
index ee22c8ffb0cc..fef61ea31f4b 100644
--- a/cddl/lib/libdtrace/net.d
+++ b/cddl/lib/libdtrace/net.d
@@ -19,8 +19,6 @@
* CDDL HEADER END
*
* Portions Copyright 2006-2008 John Birrell jb@freebsd.org
- *
- * $FreeBSD$
*/
/*
diff --git a/cddl/lib/libdtrace/nfs.d b/cddl/lib/libdtrace/nfs.d
index ae864ed363d2..4d55b39a809d 100644
--- a/cddl/lib/libdtrace/nfs.d
+++ b/cddl/lib/libdtrace/nfs.d
@@ -19,8 +19,6 @@
* CDDL HEADER END
*
* Portions Copyright 2006-2008 John Birrell jb@freebsd.org
- *
- * $FreeBSD$
*/
/*
diff --git a/cddl/lib/libdtrace/nfssrv.d b/cddl/lib/libdtrace/nfssrv.d
index 37842f7963a1..b5231bf7a2ec 100644
--- a/cddl/lib/libdtrace/nfssrv.d
+++ b/cddl/lib/libdtrace/nfssrv.d
@@ -19,8 +19,6 @@
* CDDL HEADER END
*
* Portions Copyright 2006-2008 John Birrell jb@freebsd.org
- *
- * $FreeBSD$
*/
/*
diff --git a/cddl/lib/libdtrace/psinfo.d b/cddl/lib/libdtrace/psinfo.d
index 0f5ca63c39a4..8dc27e812965 100644
--- a/cddl/lib/libdtrace/psinfo.d
+++ b/cddl/lib/libdtrace/psinfo.d
@@ -20,8 +20,6 @@
* CDDL HEADER END
*
* Portions Copyright 2006 John Birrell jb@freebsd.org
- *
- * $FreeBSD$
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
@@ -57,7 +55,7 @@ translator psinfo_t < struct proc *T > {
pr_uid = T->p_ucred->cr_ruid;
pr_euid = T->p_ucred->cr_uid;
pr_gid = T->p_ucred->cr_rgid;
- pr_egid = T->p_ucred->cr_groups[0];
+ pr_egid = T->p_ucred->cr_gid;
pr_addr = 0;
pr_psargs = (T->p_args == 0) ? "" :
memstr(T->p_args->ar_args, ' ', T->p_args->ar_length);
diff --git a/cddl/lib/libdtrace/regs_aarch64.d b/cddl/lib/libdtrace/regs_aarch64.d
new file mode 100644
index 000000000000..7d20b5c546c5
--- /dev/null
+++ b/cddl/lib/libdtrace/regs_aarch64.d
@@ -0,0 +1,74 @@
+/*
+ * SPDX-License-Identifier: CDDL 1.0
+ *
+ * Copyright 2023 Christos Margiolis <christos@FreeBSD.org>
+ */
+
+inline int R_X0 = 0;
+#pragma D binding "1.13" R_X0
+inline int R_X1 = 1;
+#pragma D binding "1.13" R_X1
+inline int R_X2 = 2;
+#pragma D binding "1.13" R_X2
+inline int R_X3 = 3;
+#pragma D binding "1.13" R_X3
+inline int R_X4 = 4;
+#pragma D binding "1.13" R_X4
+inline int R_X5 = 5;
+#pragma D binding "1.13" R_X5
+inline int R_X6 = 6;
+#pragma D binding "1.13" R_X6
+inline int R_X7 = 7;
+#pragma D binding "1.13" R_X7
+inline int R_X8 = 8;
+#pragma D binding "1.13" R_X8
+inline int R_X9 = 9;
+#pragma D binding "1.13" R_X9
+inline int R_X10 = 10;
+#pragma D binding "1.13" R_X10
+inline int R_X11 = 11;
+#pragma D binding "1.13" R_X11
+inline int R_X12 = 12;
+#pragma D binding "1.13" R_X12
+inline int R_X13 = 13;
+#pragma D binding "1.13" R_X13
+inline int R_X14 = 14;
+#pragma D binding "1.13" R_X14
+inline int R_X15 = 15;
+#pragma D binding "1.13" R_X15
+inline int R_X16 = 16;
+#pragma D binding "1.13" R_X16
+inline int R_X17 = 17;
+#pragma D binding "1.13" R_X17
+inline int R_X18 = 18;
+#pragma D binding "1.13" R_X18
+inline int R_X19 = 19;
+#pragma D binding "1.13" R_X19
+inline int R_X20 = 20;
+#pragma D binding "1.13" R_X20
+inline int R_X21 = 21;
+#pragma D binding "1.13" R_X21
+inline int R_X22 = 22;
+#pragma D binding "1.13" R_X22
+inline int R_X23 = 23;
+#pragma D binding "1.13" R_X23
+inline int R_X24 = 24;
+#pragma D binding "1.13" R_X24
+inline int R_X25 = 25;
+#pragma D binding "1.13" R_X25
+inline int R_X26 = 26;
+#pragma D binding "1.13" R_X26
+inline int R_X27 = 27;
+#pragma D binding "1.13" R_X27
+inline int R_X28 = 28;
+#pragma D binding "1.13" R_X28
+inline int R_X29 = 29;
+#pragma D binding "1.13" R_X29
+inline int R_FP= 29;
+#pragma D binding "1.13" R_FP
+inline int R_LR = 30;
+#pragma D binding "1.13" R_LR
+inline int R_SP = 31;
+#pragma D binding "1.13" R_SP
+inline int R_PC = 32;
+#pragma D binding "1.13" R_PC
diff --git a/cddl/lib/libdtrace/regs_riscv.d b/cddl/lib/libdtrace/regs_riscv.d
new file mode 100644
index 000000000000..e8a9667d2efd
--- /dev/null
+++ b/cddl/lib/libdtrace/regs_riscv.d
@@ -0,0 +1,74 @@
+/*
+ * SPDX-License-Identifier: CDDL 1.0
+ *
+ * Copyright 2023 Christos Margiolis <christos@FreeBSD.org>
+ */
+
+inline int R_ZERO = 0;
+#pragma D binding "1.13" R_ZERO
+inline int R_RA = 1;
+#pragma D binding "1.13" R_RA
+inline int R_SP = 2;
+#pragma D binding "1.13" R_SP
+inline int R_GP = 3;
+#pragma D binding "1.13" R_GP
+inline int R_TP = 4;
+#pragma D binding "1.13" R_TP
+inline int R_T0 = 5;
+#pragma D binding "1.13" R_T0
+inline int R_T1 = 6;
+#pragma D binding "1.13" R_T1
+inline int R_T2 = 7;
+#pragma D binding "1.13" R_T2
+inline int R_S0 = 8;
+#pragma D binding "1.13" R_S0
+inline int R_FP = 8;
+#pragma D binding "1.13" R_FP
+inline int R_S1 = 9;
+#pragma D binding "1.13" R_S1
+inline int R_A0 = 10;
+#pragma D binding "1.13" R_A0
+inline int R_A1 = 11;
+#pragma D binding "1.13" R_A1
+inline int R_A2 = 12;
+#pragma D binding "1.13" R_A2
+inline int R_A3 = 13;
+#pragma D binding "1.13" R_A3
+inline int R_A4 = 14;
+#pragma D binding "1.13" R_A4
+inline int R_A5 = 15;
+#pragma D binding "1.13" R_A5
+inline int R_A6 = 16;
+#pragma D binding "1.13" R_A6
+inline int R_A7 = 17;
+#pragma D binding "1.13" R_A7
+inline int R_S2 = 18;
+#pragma D binding "1.13" R_S2
+inline int R_S3 = 19;
+#pragma D binding "1.13" R_S3
+inline int R_S4 = 20;
+#pragma D binding "1.13" R_S4
+inline int R_S5 = 21;
+#pragma D binding "1.13" R_S5
+inline int R_S6 = 22;
+#pragma D binding "1.13" R_S6
+inline int R_S7 = 23;
+#pragma D binding "1.13" R_S7
+inline int R_S8 = 24;
+#pragma D binding "1.13" R_S8
+inline int R_S9 = 25;
+#pragma D binding "1.13" R_S9
+inline int R_S10 = 26;
+#pragma D binding "1.13" R_S10
+inline int R_S11 = 27;
+#pragma D binding "1.13" R_S11
+inline int R_T3 = 28;
+#pragma D binding "1.13" R_T3
+inline int R_T4 = 29;
+#pragma D binding "1.13" R_T4
+inline int R_T5 = 30;
+#pragma D binding "1.13" R_T5
+inline int R_T6 = 31;
+#pragma D binding "1.13" R_T6
+inline int R_PC = 32;
+#pragma D binding "1.13" R_PC
diff --git a/cddl/lib/libdtrace/regs_x86.d b/cddl/lib/libdtrace/regs_x86.d
index 3f625f9f4445..2e31517fdd8d 100644
--- a/cddl/lib/libdtrace/regs_x86.d
+++ b/cddl/lib/libdtrace/regs_x86.d
@@ -20,8 +20,6 @@
* CDDL HEADER END
*
* Portions Copyright 2009 Stacey Son sson@FreeBSD.org
- *
- * $FreeBSD$
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
@@ -80,11 +78,11 @@ inline int R_R0 = R_EAX;
inline int R_R1 = R_EBX;
#pragma D binding "1.0" R_R1
-inline int R_RSP = 18 + 1 + 20;
+inline int R_RSP = 18 + 1 + 24;
#pragma D binding "1.0" R_RSP
-inline int R_RFL = 18 + 1 + 19;
+inline int R_RFL = 18 + 1 + 23;
#pragma D binding "1.0" R_RFL
-inline int R_RIP = 18 + 1 + 17;
+inline int R_RIP = 18 + 1 + 21;
#pragma D binding "1.0" R_RIP
inline int R_RAX = 18 + 1 + 14;
#pragma D binding "1.0" R_RAX
diff --git a/cddl/lib/libdtrace/sched.d b/cddl/lib/libdtrace/sched.d
index 82fdf3ab0c05..7eca118fc428 100644
--- a/cddl/lib/libdtrace/sched.d
+++ b/cddl/lib/libdtrace/sched.d
@@ -19,8 +19,6 @@
* CDDL HEADER END
*
* Portions Copyright 2006-2008 John Birrell jb@freebsd.org
- *
- * $FreeBSD$
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
diff --git a/cddl/lib/libdtrace/sctp.d b/cddl/lib/libdtrace/sctp.d
index 5dc776bdb971..ef8c3bcc4a56 100644
--- a/cddl/lib/libdtrace/sctp.d
+++ b/cddl/lib/libdtrace/sctp.d
@@ -17,8 +17,6 @@
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
- *
- * $FreeBSD$
*/
/*
* Copyright (c) 2018 Michael Tuexen <tuexen@FreeBSD.org>
diff --git a/cddl/lib/libdtrace/siftr.d b/cddl/lib/libdtrace/siftr.d
index 37bc30ff3e06..bca3a0f0df7f 100644
--- a/cddl/lib/libdtrace/siftr.d
+++ b/cddl/lib/libdtrace/siftr.d
@@ -17,10 +17,9 @@
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
- *
- * $FreeBSD$
*/
+#pragma D depends_on library ip.d
#pragma D depends_on module kernel
#pragma D depends_on module siftr
#pragma D depends_on provider tcp
@@ -29,9 +28,9 @@
* Convert a SIFTR direction value to a string
*/
#pragma D binding "1.12.1" SIFTR_IN
-inline int SIFTR_IN = 1;
+inline int SIFTR_IN = 0;
#pragma D binding "1.12.1" SIFTR_OUT
-inline int SIFTR_OUT = 2;
+inline int SIFTR_OUT = 1;
/* SIFTR direction strings. */
#pragma D binding "1.12.1" siftr_dir_string
@@ -44,22 +43,23 @@ typedef struct siftrinfo {
struct timeval tval;
uint8_t direction;
uint8_t ipver;
- uint32_t hash;
- uint16_t tcp_localport;
- uint16_t tcp_foreignport;
- uint64_t snd_cwnd;
- u_long snd_wnd;
- u_long rcv_wnd;
- u_long snd_bwnd;
- u_long snd_ssthresh;
+ uint16_t lport;
+ uint16_t rport;
+ string laddr;
+ string raddr;
+ uint32_t snd_cwnd;
+ uint32_t snd_wnd;
+ uint32_t rcv_wnd;
+ uint32_t t_flags2;
+ uint32_t snd_ssthresh;
int conn_state;
- u_int max_seg_size;
- int smoothed_rtt;
+ uint32_t mss;
+ uint32_t srtt;
u_char sack_enabled;
u_char snd_scale;
u_char rcv_scale;
- u_int flags;
- int rxt_length;
+ u_int t_flags;
+ uint32_t rto;
u_int snd_buf_hiwater;
u_int snd_buf_cc;
u_int rcv_buf_hiwater;
@@ -74,22 +74,29 @@ typedef struct siftrinfo {
translator siftrinfo_t < struct pkt_node *p > {
direction = p == NULL ? 0 : p->direction;
ipver = p == NULL ? 0 : p->ipver;
- hash = p == NULL ? 0 : p->hash;
- tcp_localport = p == NULL ? 0 : ntohs(p->tcp_localport);
- tcp_foreignport = p == NULL ? 0 : ntohs(p->tcp_foreignport);
+ lport = p == NULL ? 0 : ntohs(p->lport);
+ rport = p == NULL ? 0 : ntohs(p->fport);
+ laddr = p == NULL ? "<unknown>" :
+ p->ipver == INP_IPV4 ?
+ inet_ntoa(&p->laddr.id46_addr.ia46_addr4.s_addr) :
+ inet_ntoa6(&p->laddr.id6_addr);
+ raddr = p == NULL ? "<unknown>" :
+ p->ipver == INP_IPV4 ?
+ inet_ntoa(&p->faddr.id46_addr.ia46_addr4.s_addr) :
+ inet_ntoa6(&p->faddr.id6_addr);
snd_cwnd = p == NULL ? 0 : p->snd_cwnd;
snd_wnd = p == NULL ? 0 : p->snd_wnd;
rcv_wnd = p == NULL ? 0 : p->rcv_wnd;
- snd_bwnd = p == NULL ? 0 : p->snd_bwnd;
+ t_flags2 = p == NULL ? 0 : p->t_flags2;
snd_ssthresh = p == NULL ? 0 : p->snd_ssthresh;
conn_state = p == NULL ? 0 : p->conn_state;
- max_seg_size = p == NULL ? 0 : p->max_seg_size;
- smoothed_rtt = p == NULL ? 0 : p->smoothed_rtt;
+ mss = p == NULL ? 0 : p->mss;
+ srtt = p == NULL ? 0 : p->srtt;
sack_enabled = p == NULL ? 0 : p->sack_enabled;
snd_scale = p == NULL ? 0 : p->snd_scale;
rcv_scale = p == NULL ? 0 : p->rcv_scale;
- flags = p == NULL ? 0 : p->flags;
- rxt_length = p == NULL ? 0 : p->rxt_length;
+ t_flags = p == NULL ? 0 : p->t_flags;
+ rto = p == NULL ? 0 : p->rto;
snd_buf_hiwater = p == NULL ? 0 : p->snd_buf_hiwater;
snd_buf_cc = p == NULL ? 0 : p->snd_buf_cc;
rcv_buf_hiwater = p == NULL ? 0 : p->rcv_buf_hiwater;
diff --git a/cddl/lib/libdtrace/signal.d b/cddl/lib/libdtrace/signal.d
index cdd433883397..0f9b2567cc0d 100644
--- a/cddl/lib/libdtrace/signal.d
+++ b/cddl/lib/libdtrace/signal.d
@@ -21,8 +21,6 @@
*
* Portions Copyright 2008 John Birrell jb@freebsd.org
* Portions Copyright 2018 Devin Teske dteske@freebsd.org
- *
- * $FreeBSD$
*/
inline int SIGHUP = 1;
diff --git a/cddl/lib/libdtrace/socket.d b/cddl/lib/libdtrace/socket.d
index da8f149b2d10..c8161f9b2d30 100644
--- a/cddl/lib/libdtrace/socket.d
+++ b/cddl/lib/libdtrace/socket.d
@@ -23,8 +23,6 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD$
- *
* Translators and flags for the socket structure. FreeBSD specific code.
*/
diff --git a/cddl/lib/libdtrace/tcp.d b/cddl/lib/libdtrace/tcp.d
index afcfdfadaf1e..8f51675df305 100644
--- a/cddl/lib/libdtrace/tcp.d
+++ b/cddl/lib/libdtrace/tcp.d
@@ -17,8 +17,6 @@
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
- *
- * $FreeBSD$
*/
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
@@ -83,21 +81,23 @@ inline int TCP_STATE_TIME_WAIT = TCPS_TIME_WAIT;
/* TCP segment flags. */
#pragma D binding "1.6.3" TH_FIN
-inline uint8_t TH_FIN = 0x01;
+inline uint16_t TH_FIN = 0x01;
#pragma D binding "1.6.3" TH_SYN
-inline uint8_t TH_SYN = 0x02;
+inline uint16_t TH_SYN = 0x02;
#pragma D binding "1.6.3" TH_RST
-inline uint8_t TH_RST = 0x04;
+inline uint16_t TH_RST = 0x04;
#pragma D binding "1.6.3" TH_PUSH
-inline uint8_t TH_PUSH = 0x08;
+inline uint16_t TH_PUSH = 0x08;
#pragma D binding "1.6.3" TH_ACK
-inline uint8_t TH_ACK = 0x10;
+inline uint16_t TH_ACK = 0x10;
#pragma D binding "1.6.3" TH_URG
-inline uint8_t TH_URG = 0x20;
+inline uint16_t TH_URG = 0x20;
#pragma D binding "1.6.3" TH_ECE
-inline uint8_t TH_ECE = 0x40;
+inline uint16_t TH_ECE = 0x40;
#pragma D binding "1.6.3" TH_CWR
-inline uint8_t TH_CWR = 0x80;
+inline uint16_t TH_CWR = 0x80;
+#pragma D binding "1.6.3" TH_AE
+inline uint16_t TH_AE = 0x100;
/* TCP connection state strings. */
#pragma D binding "1.6.3" tcp_state_string
@@ -175,7 +175,7 @@ typedef struct tcpinfo {
uint32_t tcp_seq; /* sequence number */
uint32_t tcp_ack; /* acknowledgment number */
uint8_t tcp_offset; /* data offset, in bytes */
- uint8_t tcp_flags; /* flags */
+ uint16_t tcp_flags; /* flags */
uint16_t tcp_window; /* window size */
uint16_t tcp_checksum; /* checksum */
uint16_t tcp_urgent; /* urgent data pointer */
@@ -194,7 +194,7 @@ typedef struct tcpinfoh {
uint32_t tcp_seq; /* sequence number */
uint32_t tcp_ack; /* acknowledgment number */
uint8_t tcp_offset; /* data offset, in bytes */
- uint8_t tcp_flags; /* flags */
+ uint16_t tcp_flags; /* flags */
uint16_t tcp_window; /* window size */
uint16_t tcp_checksum; /* checksum */
uint16_t tcp_urgent; /* urgent data pointer */
@@ -204,7 +204,7 @@ typedef struct tcpinfoh {
#pragma D binding "1.6.3" translator
translator csinfo_t < struct tcpcb *p > {
cs_addr = NULL;
- cs_cid = (uint64_t)(p == NULL ? 0 : p->t_inpcb);
+ cs_cid = (uint64_t)(p == NULL ? 0 : &p->t_inpcb);
cs_pid = 0;
cs_zoneid = 0;
};
@@ -214,16 +214,16 @@ translator tcpsinfo_t < struct tcpcb *p > {
tcps_addr = (uintptr_t)p;
tcps_local = -1; /* XXX */
tcps_active = -1; /* XXX */
- tcps_lport = p == NULL ? 0 : ntohs(p->t_inpcb->inp_inc.inc_ie.ie_lport);
- tcps_rport = p == NULL ? 0 : ntohs(p->t_inpcb->inp_inc.inc_ie.ie_fport);
+ tcps_lport = p == NULL ? 0 : ntohs(p->t_inpcb.inp_inc.inc_ie.ie_lport);
+ tcps_rport = p == NULL ? 0 : ntohs(p->t_inpcb.inp_inc.inc_ie.ie_fport);
tcps_laddr = p == NULL ? "<unknown>" :
- p->t_inpcb->inp_vflag == INP_IPV4 ?
- inet_ntoa(&p->t_inpcb->inp_inc.inc_ie.ie_dependladdr.id46_addr.ia46_addr4.s_addr) :
- inet_ntoa6(&p->t_inpcb->inp_inc.inc_ie.ie_dependladdr.id6_addr);
+ p->t_inpcb.inp_vflag == INP_IPV4 ?
+ inet_ntoa(&p->t_inpcb.inp_inc.inc_ie.ie_dependladdr.id46_addr.ia46_addr4.s_addr) :
+ inet_ntoa6(&p->t_inpcb.inp_inc.inc_ie.ie_dependladdr.id6_addr);
tcps_raddr = p == NULL ? "<unknown>" :
- p->t_inpcb->inp_vflag == INP_IPV4 ?
- inet_ntoa(&p->t_inpcb->inp_inc.inc_ie.ie_dependfaddr.id46_addr.ia46_addr4.s_addr) :
- inet_ntoa6(&p->t_inpcb->inp_inc.inc_ie.ie_dependfaddr.id6_addr);
+ p->t_inpcb.inp_vflag == INP_IPV4 ?
+ inet_ntoa(&p->t_inpcb.inp_inc.inc_ie.ie_dependfaddr.id46_addr.ia46_addr4.s_addr) :
+ inet_ntoa6(&p->t_inpcb.inp_inc.inc_ie.ie_dependfaddr.id6_addr);
tcps_state = p == NULL ? -1 : p->t_state;
tcps_iss = p == NULL ? 0 : p->iss;
tcps_irs = p == NULL ? 0 : p->irs;
@@ -250,9 +250,9 @@ translator tcpsinfo_t < struct tcpcb *p > {
tcps_retransmit = p == NULL ? -1 : p->t_rxtshift > 0 ? 1 : 0;
tcps_srtt = p == NULL ? -1 : p->t_srtt; /* smoothed RTT in units of (TCP_RTT_SCALE*hz) */
tcps_debug = p == NULL ? 0 :
- p->t_inpcb->inp_socket->so_options & 1;
+ p->t_inpcb.inp_socket->so_options & 1;
tcps_cookie = p == NULL ? -1 :
- p->t_inpcb->inp_socket->so_user_cookie;
+ p->t_inpcb.inp_socket->so_user_cookie;
tcps_dupacks = p == NULL ? -1 : p->t_dupacks;
tcps_rtttime = p == NULL ? -1 : p->t_rtttime;
tcps_rtseq = p == NULL ? -1 : p->t_rtseq;
@@ -265,8 +265,8 @@ translator tcpinfo_t < struct tcphdr *p > {
tcp_dport = p == NULL ? 0 : ntohs(p->th_dport);
tcp_seq = p == NULL ? -1 : ntohl(p->th_seq);
tcp_ack = p == NULL ? -1 : ntohl(p->th_ack);
- tcp_offset = p == NULL ? -1 : (p->th_off >> 2);
- tcp_flags = p == NULL ? 0 : p->th_flags;
+ tcp_offset = p == NULL ? -1 : (p->th_off << 2);
+ tcp_flags = p == NULL ? 0 : ((p->th_x2 << 8) | p->th_flags);
tcp_window = p == NULL ? 0 : ntohs(p->th_win);
tcp_checksum = p == NULL ? 0 : ntohs(p->th_sum);
tcp_urgent = p == NULL ? 0 : ntohs(p->th_urp);
@@ -284,8 +284,8 @@ translator tcpinfoh_t < struct tcphdr *p > {
tcp_dport = p == NULL ? 0 : ntohs(p->th_dport);
tcp_seq = p == NULL ? -1 : p->th_seq;
tcp_ack = p == NULL ? -1 : p->th_ack;
- tcp_offset = p == NULL ? -1 : (p->th_off >> 2);
- tcp_flags = p == NULL ? 0 : p->th_flags;
+ tcp_offset = p == NULL ? -1 : (p->th_off << 2);
+ tcp_flags = p == NULL ? 0 : ((p->th_x2 << 8) | p->th_flags);
tcp_window = p == NULL ? 0 : p->th_win;
tcp_checksum = p == NULL ? 0 : ntohs(p->th_sum);
tcp_urgent = p == NULL ? 0 : p->th_urp;
@@ -313,17 +313,17 @@ inline int TA_DROP = 4;
/* direction strings. */
-#pragma D binding "1.12.1" tcpdebug_dir_string
+#pragma D binding "1.13" tcpdebug_dir_string
inline string tcpdebug_dir_string[uint8_t direction] =
direction == TA_INPUT ? "input" :
direction == TA_OUTPUT ? "output" :
direction == TA_USER ? "user" :
direction == TA_RESPOND ? "respond" :
- direction == TA_OUTPUT ? "drop" :
+ direction == TA_DROP ? "drop" :
"unknown" ;
-#pragma D binding "1.12.1" tcpflag_string
-inline string tcpflag_string[uint8_t flags] =
+#pragma D binding "1.13" tcpflag_string
+inline string tcpflag_string[uint16_t flags] =
flags & TH_FIN ? "FIN" :
flags & TH_SYN ? "SYN" :
flags & TH_RST ? "RST" :
@@ -332,6 +332,7 @@ inline string tcpflag_string[uint8_t flags] =
flags & TH_URG ? "URG" :
flags & TH_ECE ? "ECE" :
flags & TH_CWR ? "CWR" :
+ flags & TH_AE ? "AE" :
"unknown" ;
#pragma D binding "1.12.1" PRU_ATTACH
diff --git a/cddl/lib/libdtrace/udp.d b/cddl/lib/libdtrace/udp.d
index 603bbbd29617..fd28f5e2e7e9 100644
--- a/cddl/lib/libdtrace/udp.d
+++ b/cddl/lib/libdtrace/udp.d
@@ -17,8 +17,6 @@
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
- *
- * $FreeBSD$
*/
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
diff --git a/cddl/lib/libdtrace/udplite.d b/cddl/lib/libdtrace/udplite.d
index e41a6faa36a8..88c1c8553ce5 100644
--- a/cddl/lib/libdtrace/udplite.d
+++ b/cddl/lib/libdtrace/udplite.d
@@ -17,8 +17,6 @@
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
- *
- * $FreeBSD$
*/
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
diff --git a/cddl/lib/libdtrace/unistd.d b/cddl/lib/libdtrace/unistd.d
index 1ceffef2b215..ead9d23ce670 100644
--- a/cddl/lib/libdtrace/unistd.d
+++ b/cddl/lib/libdtrace/unistd.d
@@ -17,8 +17,6 @@
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
- *
- * $FreeBSD$
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
diff --git a/cddl/lib/libicp/Makefile b/cddl/lib/libicp/Makefile
index 58ebb292c946..15846e67a14b 100644
--- a/cddl/lib/libicp/Makefile
+++ b/cddl/lib/libicp/Makefile
@@ -1,12 +1,11 @@
-# $FreeBSD$
+.PATH: ${ZFSTOP}/module/icp
-.PATH: ${SRCTOP}/sys/contrib/openzfs/module/icp
+PACKAGE= zfs
+LIB_PACKAGE=
-PACKAGE= utilities
LIB= icp
LIBADD=
-
.if ${MACHINE_ARCH} == "amd64"
ASM_SOURCES_C = asm-x86_64/aes/aeskey.c
ASM_SOURCES_AS = \
@@ -14,31 +13,49 @@ ASM_SOURCES_AS = \
asm-x86_64/aes/aes_aesni.S \
asm-x86_64/modes/gcm_pclmulqdq.S \
asm-x86_64/modes/aesni-gcm-x86_64.S \
+ asm-x86_64/modes/aesni-gcm-avx2-vaes.S \
asm-x86_64/modes/ghash-x86_64.S \
- asm-x86_64/sha2/sha256_impl.S \
- asm-x86_64/sha2/sha512_impl.S \
+ asm-x86_64/sha2/sha256-x86_64.S \
+ asm-x86_64/sha2/sha512-x86_64.S \
asm-x86_64/blake3/blake3_avx2.S \
asm-x86_64/blake3/blake3_avx512.S \
asm-x86_64/blake3/blake3_sse2.S \
asm-x86_64/blake3/blake3_sse41.S
CFLAGS+= -D__amd64 -D_SYS_STACK_H -UHAVE_AES
+.elif ${MACHINE_CPUARCH} == "arm"
+ASM_SOURCES_C =
+ASM_SOURCES_AS = \
+ asm-arm/sha2/sha256-armv7.S \
+ asm-arm/sha2/sha512-armv7.S
.elif ${MACHINE_ARCH} == "aarch64"
ASM_SOURCES_C =
ASM_SOURCES_AS = \
asm-aarch64/blake3/b3_aarch64_sse2.S \
- asm-aarch64/blake3/b3_aarch64_sse41.S
+ asm-aarch64/blake3/b3_aarch64_sse41.S \
+ asm-aarch64/sha2/sha256-armv8.S \
+ asm-aarch64/sha2/sha512-armv8.S
+.elif ${MACHINE_ARCH} == "powerpc64"
+ASM_SOURCES_C =
+ASM_SOURCES_AS = \
+ asm-ppc64/sha2/sha256-ppc.S \
+ asm-ppc64/sha2/sha512-ppc.S \
+ asm-ppc64/sha2/sha256-p8.S \
+ asm-ppc64/sha2/sha512-p8.S
.elif ${MACHINE_ARCH} == "powerpc64le"
ASM_SOURCES_C =
ASM_SOURCES_AS = \
asm-ppc64/blake3/b3_ppc64le_sse2.S \
- asm-ppc64/blake3/b3_ppc64le_sse41.S
+ asm-ppc64/blake3/b3_ppc64le_sse41.S \
+ asm-ppc64/sha2/sha256-ppc.S \
+ asm-ppc64/sha2/sha512-ppc.S \
+ asm-ppc64/sha2/sha256-p8.S \
+ asm-ppc64/sha2/sha512-p8.S
.else
ASM_SOURCES_C =
ASM_SOURCES_AS =
.endif
-
KERNEL_C = \
spi/kcf_spi.c \
api/kcf_ctxops.c \
@@ -52,24 +69,21 @@ KERNEL_C = \
algs/blake3/blake3.c \
algs/blake3/blake3_generic.c \
algs/blake3/blake3_impl.c \
- algs/blake3/blake3_x86-64.c \
algs/edonr/edonr.c \
algs/modes/modes.c \
- algs/modes/cbc.c \
algs/modes/gcm_generic.c \
algs/modes/gcm_pclmulqdq.c \
algs/modes/gcm.c \
- algs/modes/ctr.c \
algs/modes/ccm.c \
- algs/modes/ecb.c \
- algs/sha2/sha2.c \
+ algs/sha2/sha2_generic.c \
+ algs/sha2/sha256_impl.c \
+ algs/sha2/sha512_impl.c \
algs/skein/skein.c \
algs/skein/skein_block.c \
algs/skein/skein_iv.c \
illumos-crypto.c \
io/aes.c \
io/sha2_mod.c \
- io/skein_mod.c \
core/kcf_sched.c \
core/kcf_prov_lib.c \
core/kcf_callprov.c \
@@ -77,43 +91,49 @@ KERNEL_C = \
core/kcf_prov_tabs.c \
$(ASM_SOURCES_C)
-
-
-
-
-
SRCS= $(ASM_SOURCES_AS) $(KERNEL_C)
WARNS?= 2
SHLIB_MAJOR= 3
CSTD= c99
CFLAGS+= -DIN_BASE
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
+CFLAGS+= -I${ZFSTOP}/include
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/os/freebsd
CFLAGS+= -I${SRCTOP}/sys
CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include
-CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -I${ZFSTOP}/module/icp/include
+CFLAGS+= -I${ZFSTOP}/lib/libzpool/include
+CFLAGS+= -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h
CFLAGS+= -DHAVE_ISSETUGID
CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
-
CFLAGS.aes_amd64.S+= -DLOCORE
CFLAGS.aes_aesni.S+= -DLOCORE
CFLAGS.gcm_pclmulqdq.S+= -DLOCORE
CFLAGS.aesni-gcm-x86_64.S+= -DLOCORE
+CFLAGS.aesni-gcm-avx2-vaes.S+= -DLOCORE
CFLAGS.ghash-x86_64.S+= -DLOCORE
-CFLAGS.sha256_impl.S+= -DLOCORE
-CFLAGS.sha512_impl.S+= -DLOCORE
+CFLAGS.sha256-x86_64.S+= -DLOCORE
+CFLAGS.sha512-x86_64.S+= -DLOCORE
CFLAGS.blake3_avx2.S = -DLOCORE
CFLAGS.blake3_avx512.S = -DLOCORE
CFLAGS.blake3_sse2.S = -DLOCORE
CFLAGS.blake3_sse41.S = -DLOCORE
CFLAGS.b3_aarch64_sse2.S = -DLOCORE
CFLAGS.b3_aarch64_sse41.S = -DLOCORE
+CFLAGS.sha256-armv7.S = -DLOCORE
+CFLAGS.sha256-armv8.S = -DLOCORE
+CFLAGS.sha512-armv7.S = -DLOCORE
+CFLAGS.sha512-armv8.S = -DLOCORE
CFLAGS.b3_ppc64le_sse2.S = -DLOCORE
CFLAGS.b3_ppc64le_sse41.S = -DLOCORE
+CFLAGS.sha256-p8.S = -DLOCORE
+CFLAGS.sha256-ppc.S = -DLOCORE
+CFLAGS.sha512-p8.S = -DLOCORE
+CFLAGS.sha512-ppc.S = -DLOCORE
+
+LDFLAGS.bfd+= -Wl,-znoexecstack
.include <bsd.lib.mk>
diff --git a/cddl/lib/libicp/Makefile.depend b/cddl/lib/libicp/Makefile.depend
new file mode 100644
index 000000000000..6ef78fac5cbf
--- /dev/null
+++ b/cddl/lib/libicp/Makefile.depend
@@ -0,0 +1,15 @@
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/cddl/lib/libicp_rescue/Makefile b/cddl/lib/libicp_rescue/Makefile
index 1237b1b05edf..8dc8c396774c 100644
--- a/cddl/lib/libicp_rescue/Makefile
+++ b/cddl/lib/libicp_rescue/Makefile
@@ -1,12 +1,9 @@
-# $FreeBSD$
-
-.PATH: ${SRCTOP}/sys/contrib/openzfs/module/icp
+.PATH: ${ZFSTOP}/module/icp
PACKAGE= utilities
LIB= icp_rescue
LIBADD=
-
.if ${MACHINE_ARCH} == "amd64"
ASM_SOURCES_C = asm-x86_64/aes/aeskey.c
ASM_SOURCES_AS = \
@@ -14,30 +11,48 @@ ASM_SOURCES_AS = \
asm-x86_64/aes/aes_aesni.S \
asm-x86_64/modes/gcm_pclmulqdq.S \
asm-x86_64/modes/aesni-gcm-x86_64.S \
- asm-x86_64/sha2/sha256_impl.S \
- asm-x86_64/sha2/sha512_impl.S \
+ asm-x86_64/modes/aesni-gcm-avx2-vaes.S \
+ asm-x86_64/sha2/sha256-x86_64.S \
+ asm-x86_64/sha2/sha512-x86_64.S \
asm-x86_64/blake3/blake3_avx2.S \
asm-x86_64/blake3/blake3_avx512.S \
asm-x86_64/blake3/blake3_sse2.S \
asm-x86_64/blake3/blake3_sse41.S
CFLAGS+= -D__amd64 -D_SYS_STACK_H
+.elif ${MACHINE_CPUARCH} == "arm"
+ASM_SOURCES_C =
+ASM_SOURCES_AS = \
+ asm-arm/sha2/sha256-armv7.S \
+ asm-arm/sha2/sha512-armv7.S
.elif ${MACHINE_ARCH} == "aarch64"
ASM_SOURCES_C =
ASM_SOURCES_AS = \
asm-aarch64/blake3/b3_aarch64_sse2.S \
- asm-aarch64/blake3/b3_aarch64_sse41.S
+ asm-aarch64/blake3/b3_aarch64_sse41.S \
+ asm-aarch64/sha2/sha256-armv8.S \
+ asm-aarch64/sha2/sha512-armv8.S
+.elif ${MACHINE_ARCH} == "powerpc64"
+ASM_SOURCES_C =
+ASM_SOURCES_AS = \
+ asm-ppc64/sha2/sha256-ppc.S \
+ asm-ppc64/sha2/sha512-ppc.S \
+ asm-ppc64/sha2/sha256-p8.S \
+ asm-ppc64/sha2/sha512-p8.S
.elif ${MACHINE_ARCH} == "powerpc64le"
ASM_SOURCES_C =
ASM_SOURCES_AS = \
asm-ppc64/blake3/b3_ppc64le_sse2.S \
- asm-ppc64/blake3/b3_ppc64le_sse41.S
+ asm-ppc64/blake3/b3_ppc64le_sse41.S \
+ asm-ppc64/sha2/sha256-ppc.S \
+ asm-ppc64/sha2/sha512-ppc.S \
+ asm-ppc64/sha2/sha256-p8.S \
+ asm-ppc64/sha2/sha512-p8.S
.else
ASM_SOURCES_C =
ASM_SOURCES_AS =
.endif
-
KERNEL_C = \
spi/kcf_spi.c \
api/kcf_ctxops.c \
@@ -51,22 +66,19 @@ KERNEL_C = \
algs/blake3/blake3.c \
algs/blake3/blake3_generic.c \
algs/blake3/blake3_impl.c \
- algs/blake3/blake3_x86-64.c \
algs/edonr/edonr.c \
algs/modes/modes.c \
- algs/modes/cbc.c \
algs/modes/gcm_generic.c \
algs/modes/gcm_pclmulqdq.c \
algs/modes/gcm.c \
- algs/modes/ctr.c \
algs/modes/ccm.c \
- algs/modes/ecb.c \
- algs/sha2/sha2.c \
+ algs/sha2/sha2_generic.c \
+ algs/sha2/sha256_impl.c \
+ algs/sha2/sha512_impl.c \
algs/skein/skein_block.c \
illumos-crypto.c \
io/aes.c \
io/sha2_mod.c \
- io/skein_mod.c \
core/kcf_sched.c \
core/kcf_prov_lib.c \
core/kcf_callprov.c \
@@ -74,30 +86,34 @@ KERNEL_C = \
core/kcf_prov_tabs.c \
$(ASM_SOURCES_C)
+.PATH: ${ZFSTOP}/module/zfs
+KERNEL_C+= zfs_impl.c
+
SRCS= $(ASM_SOURCES_AS) $(KERNEL_C)
WARNS?= 2
SHLIB_MAJOR= 3
CSTD= c99
CFLAGS+= -DIN_BASE
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
+CFLAGS+= -I${ZFSTOP}/include
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/os/freebsd
CFLAGS+= -I${SRCTOP}/sys
CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include
-CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -I${ZFSTOP}/module/icp/include
+CFLAGS+= -I${ZFSTOP}/lib/libzpool/include
+CFLAGS+= -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h
CFLAGS+= -DHAVE_ISSETUGID -UHAVE_AVX -DRESCUE
CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
-
CFLAGS.aes_amd64.S+= -DLOCORE
CFLAGS.aes_aesni.S+= -DLOCORE
CFLAGS.gcm_pclmulqdq.S+= -DLOCORE
CFLAGS.aesni-gcm-x86_64.S+= -DLOCORE
+CFLAGS.aesni-gcm-avx2-vaes.S+= -DLOCORE
CFLAGS.ghash-x86_64.S+= -DLOCORE
-CFLAGS.sha256_impl.S+= -DLOCORE
-CFLAGS.sha512_impl.S+= -DLOCORE
+CFLAGS.sha256-x86_64.S+= -DLOCORE
+CFLAGS.sha512-x86_64.S+= -DLOCORE
CFLAGS.gcm.c+= -UCAN_USE_GCM_ASM
CFLAGS.blake3_avx2.S = -DLOCORE
CFLAGS.blake3_avx512.S = -DLOCORE
@@ -105,8 +121,17 @@ CFLAGS.blake3_sse2.S = -DLOCORE
CFLAGS.blake3_sse41.S = -DLOCORE
CFLAGS.b3_aarch64_sse2.S = -DLOCORE
CFLAGS.b3_aarch64_sse41.S = -DLOCORE
+CFLAGS.sha256-armv7.S = -DLOCORE
+CFLAGS.sha512-armv7.S = -DLOCORE
+CFLAGS.sha256-armv8.S = -DLOCORE
+CFLAGS.sha512-armv8.S = -DLOCORE
CFLAGS.b3_ppc64le_sse2.S = -DLOCORE
CFLAGS.b3_ppc64le_sse41.S = -DLOCORE
+CFLAGS.sha256-ppc.S = -DLOCORE
+CFLAGS.sha256-p8.S = -DLOCORE
+CFLAGS.sha512-ppc.S = -DLOCORE
+CFLAGS.sha512-p8.S = -DLOCORE
+LDFLAGS.bfd+= -Wl,-znoexecstack
.include <bsd.lib.mk>
diff --git a/cddl/lib/libicp_rescue/Makefile.depend b/cddl/lib/libicp_rescue/Makefile.depend
new file mode 100644
index 000000000000..6ef78fac5cbf
--- /dev/null
+++ b/cddl/lib/libicp_rescue/Makefile.depend
@@ -0,0 +1,15 @@
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/cddl/lib/libnvpair/Makefile b/cddl/lib/libnvpair/Makefile
index aaf76ed3fb28..c66424cef219 100644
--- a/cddl/lib/libnvpair/Makefile
+++ b/cddl/lib/libnvpair/Makefile
@@ -1,13 +1,15 @@
-# $FreeBSD$
+.PATH: ${ZFSTOP}/module/nvpair
+.PATH: ${ZFSTOP}/lib/libnvpair
+.PATH: ${ZFSTOP}/include
-.PATH: ${SRCTOP}/sys/contrib/openzfs/module/nvpair
-.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libnvpair
+PACKAGE= zfs
+LIB_PACKAGE=
LIB= nvpair
LIBADD= spl
-PACKAGE= runtime
# user
+INCS= libnvpair.h
SRCS= libnvpair.c \
libnvpair_json.c \
nvpair_alloc_system.c
@@ -18,14 +20,12 @@ SRCS+= nvpair_alloc_fixed.c \
WARNS?= 2
CFLAGS+= -DIN_BASE -DHAVE_RPC_TYPES
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
+CFLAGS+= -I${ZFSTOP}/include
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/os/freebsd
CFLAGS+= -I${SRCTOP}/sys
CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
-CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h
CFLAGS+= -DHAVE_ISSETUGID -DHAVE_CONFIG_H -DHAVE_XDR_BYTESREC
-
-CFLAGS.nvpair.c+= -UHAVE_RPC_TYPES
.include <bsd.lib.mk>
diff --git a/cddl/lib/libnvpair/Makefile.depend b/cddl/lib/libnvpair/Makefile.depend
index 5f1a802404d8..409c3c86cc20 100644
--- a/cddl/lib/libnvpair/Makefile.depend
+++ b/cddl/lib/libnvpair/Makefile.depend
@@ -1,13 +1,12 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
+ cddl/lib/libspl \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
- lib/msun \
.include <dirdeps.mk>
diff --git a/cddl/lib/libspl/Makefile b/cddl/lib/libspl/Makefile
index 6a918c59e27e..b0f47172e52d 100644
--- a/cddl/lib/libspl/Makefile
+++ b/cddl/lib/libspl/Makefile
@@ -1,31 +1,45 @@
-# $FreeBSD$
-
.include <bsd.init.mk>
.include <bsd.compiler.mk>
-.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libspl
-.PATH: ${SRCTOP}/sys/contrib/openzfs/include
+.PATH: ${ZFSTOP}/lib/libspl
+.PATH: ${ZFSTOP}/include
+
+PACKAGE= zfs
+LIB_PACKAGE=
LIB= spl
LIBADD=
-PACKAGE= runtime
SRCS = \
assert.c \
+ backtrace.c \
+ condvar.c \
+ kmem.c \
+ libspl.c \
list.c \
mkdirp.c \
+ mutex.c \
os/freebsd/zone.c \
page.c \
+ procfs_list.c \
+ random.c \
+ rwlock.c \
+ sid.c \
+ taskq.c \
timestamp.c \
include/sys/list.h \
include/sys/list_impl.h
-# These functions are not required when bootstrapping and the atomic code
-# will not compile when building on macOS.
+# These functions are not required when bootstrapping and the atomic code,
+# among others, will not compile when building on macOS.
.if !defined(BOOTSTRAPPING)
SRCS += \
atomic.c \
+ cred.c \
getexecname.c \
+ kstat.c \
+ thread.c \
+ tunables.c \
os/freebsd/getexecname.c \
os/freebsd/gethostid.c \
os/freebsd/getmntany.c \
@@ -35,12 +49,12 @@ SRCS += \
WARNS?= 2
CSTD= c99
CFLAGS+= -DIN_BASE
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
+CFLAGS+= -I${ZFSTOP}/include
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/os/freebsd
CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include
-CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -I${ZFSTOP}/module/icp/include
+CFLAGS+= -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h
CFLAGS+= -DHAVE_ISSETUGID
CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
.if ${COMPILER_TYPE} == "clang"
diff --git a/cddl/lib/libspl/Makefile.depend b/cddl/lib/libspl/Makefile.depend
new file mode 100644
index 000000000000..6ef78fac5cbf
--- /dev/null
+++ b/cddl/lib/libspl/Makefile.depend
@@ -0,0 +1,15 @@
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/cddl/lib/libtpool/Makefile b/cddl/lib/libtpool/Makefile
index 637385bc842e..1ebfc52f5be9 100644
--- a/cddl/lib/libtpool/Makefile
+++ b/cddl/lib/libtpool/Makefile
@@ -1,12 +1,12 @@
-# $FreeBSD$
+.PATH: ${ZFSTOP}/lib/libtpool
+.PATH: ${ZFSTOP}/include
-.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libtpool
-.PATH: ${SRCTOP}/sys/contrib/openzfs/include
+PACKAGE= zfs
+LIB_PACKAGE=
-
-LIB= tpool
-LIBADD= spl
-PACKAGE= runtime
+LIB= tpool
+SHLIBDIR?= /lib
+LIBADD= spl
INCS= thread_pool_impl.h
SRCS= thread_pool.c
@@ -14,14 +14,19 @@ SRCS= thread_pool.c
WARNS?= 2
CSTD= c99
CFLAGS+= -DIN_BASE
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
+CFLAGS+= -I${ZFSTOP}/include
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/os/freebsd
CFLAGS+= -I${SRCTOP}/sys
CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include
-CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -I${ZFSTOP}/module/icp/include
+CFLAGS+= -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h
CFLAGS+= -DHAVE_ISSETUGID
CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
+.include <src.opts.mk>
+
+HAS_TESTS=
+SUBDIR.${MK_TESTS}+= tests
+
.include <bsd.lib.mk>
diff --git a/cddl/lib/libtpool/Makefile.depend b/cddl/lib/libtpool/Makefile.depend
new file mode 100644
index 000000000000..409c3c86cc20
--- /dev/null
+++ b/cddl/lib/libtpool/Makefile.depend
@@ -0,0 +1,16 @@
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ cddl/lib/libspl \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/cddl/lib/libtpool/tests/Makefile b/cddl/lib/libtpool/tests/Makefile
new file mode 100644
index 000000000000..72a82b6afa59
--- /dev/null
+++ b/cddl/lib/libtpool/tests/Makefile
@@ -0,0 +1,11 @@
+ATF_TESTS_C+= libtpool_test
+
+TEST_METADATA+= timeout="10"
+
+CFLAGS+= -I${ZFSTOP}/include \
+ -I${ZFSTOP}/lib/libspl/include
+
+LIBADD+= pthread tpool
+
+.include "${SRCTOP}/cddl/Makefile.inc"
+.include <bsd.test.mk>
diff --git a/cddl/lib/libtpool/tests/libtpool_test.c b/cddl/lib/libtpool/tests/libtpool_test.c
new file mode 100644
index 000000000000..42bce269cb23
--- /dev/null
+++ b/cddl/lib/libtpool/tests/libtpool_test.c
@@ -0,0 +1,82 @@
+#include <sys/stdtypes.h>
+#include <sys/sysctl.h>
+#include <errno.h>
+#include <pthread.h>
+
+#include <thread_pool.h>
+
+#include <atf-c.h>
+
+static void
+tp_delay(void *arg)
+{
+ pthread_barrier_t *barrier = arg;
+ int r;
+
+ /* Block this task until all thread pool workers have been created. */
+ r = pthread_barrier_wait(barrier);
+ ATF_REQUIRE_MSG(r == 0 || r == PTHREAD_BARRIER_SERIAL_THREAD,
+ "pthread_barrier_wait failed: %s", strerror(r));
+}
+
+/*
+ * NB: we could reduce the test's resource cost by using rctl(4). But that
+ * isn't enabled by default. And even with a thread limit of 1500, it takes <
+ * 0.1s to run on my machine. So I don't think it's worth optimizing for the
+ * case where rctl is available.
+ */
+ATF_TC(complete_exhaustion);
+ATF_TC_HEAD(complete_exhaustion, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "A thread pool should fail to schedule tasks if it is completely impossible to spawn any threads.");
+}
+
+ATF_TC_BODY(complete_exhaustion, tc)
+{
+ pthread_barrier_t barrier;
+ tpool_t *tp0, *tp1;
+ size_t len;
+ int max_threads_per_proc = 0;
+ int nworkers;
+ int r, i;
+
+ len = sizeof(max_threads_per_proc);
+ r = sysctlbyname("kern.threads.max_threads_per_proc",
+ &max_threads_per_proc, &len, NULL, 0);
+ ATF_REQUIRE_EQ_MSG(r, 0, "sysctlbyname: %s", strerror(errno));
+ nworkers = max_threads_per_proc - 1;
+ pthread_barrier_init(&barrier, NULL, max_threads_per_proc);
+
+ /*
+ * Create the first thread pool and spawn the maximum allowed number of
+ * processes.
+ */
+ tp0 = tpool_create(nworkers, nworkers, 1, NULL);
+ ATF_REQUIRE(tp0 != NULL);
+ for (i = 0; i < nworkers; i++) {
+ ATF_REQUIRE_EQ(tpool_dispatch(tp0, tp_delay, &barrier), 0);
+ }
+
+ /*
+ * Now create a second thread pool. Unable to create new threads, the
+ * dispatch function should return an error.
+ */
+ tp1 = tpool_create(nworkers, 2 * nworkers, 1, NULL);
+ ATF_REQUIRE(tp1 != NULL);
+ ATF_REQUIRE_EQ(tpool_dispatch(tp1, tp_delay, NULL), -1);
+
+ /* Cleanup */
+ r = pthread_barrier_wait(&barrier);
+ ATF_REQUIRE_MSG(r == 0 || r == PTHREAD_BARRIER_SERIAL_THREAD,
+ "pthread_barrier_wait failed: %s", strerror(r));
+ tpool_wait(tp1);
+ tpool_wait(tp0);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ ATF_TP_ADD_TC(tp, complete_exhaustion);
+
+ return (atf_no_error());
+}
diff --git a/cddl/lib/libumem/Makefile b/cddl/lib/libumem/Makefile
index ca8f5e665920..512332275fec 100644
--- a/cddl/lib/libumem/Makefile
+++ b/cddl/lib/libumem/Makefile
@@ -1,8 +1,8 @@
-# $FreeBSD$
-
.PATH: ${SRCTOP}/cddl/compat/opensolaris/lib/libumem
-PACKAGE= runtime
+PACKAGE= zfs
+LIB_PACKAGE=
+
LIB= umem
SRCS= umem.c
WARNS?= 3
diff --git a/cddl/lib/libumem/Makefile.depend b/cddl/lib/libumem/Makefile.depend
index 1c1a9bee1d67..93249906da4f 100644
--- a/cddl/lib/libumem/Makefile.depend
+++ b/cddl/lib/libumem/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/cddl/lib/libuutil/Makefile b/cddl/lib/libuutil/Makefile
index 169b8d8afe01..ca5a71d811f7 100644
--- a/cddl/lib/libuutil/Makefile
+++ b/cddl/lib/libuutil/Makefile
@@ -1,8 +1,8 @@
-# $FreeBSD$
+.PATH: ${ZFSTOP}/lib/libuutil
-.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libuutil
+PACKAGE= zfs
+LIB_PACKAGE=
-PACKAGE= runtime
LIB= uutil
SRCS=\
uu_alloc.c \
@@ -10,17 +10,16 @@ SRCS=\
uu_ident.c \
uu_list.c \
uu_misc.c \
- uu_pname.c \
uu_string.c
WARNS?= 2
CFLAGS+= -DIN_BASE
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
+CFLAGS+= -I${ZFSTOP}/include
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/os/freebsd
CFLAGS+= -I${SRCTOP}/sys
CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
-CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h
LIBADD= avl spl
diff --git a/cddl/lib/libuutil/Makefile.depend b/cddl/lib/libuutil/Makefile.depend
index 8d409f5263ac..808980b1879e 100644
--- a/cddl/lib/libuutil/Makefile.depend
+++ b/cddl/lib/libuutil/Makefile.depend
@@ -1,7 +1,8 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
+ cddl/lib/libavl \
+ cddl/lib/libspl \
include \
include/xlocale \
lib/${CSU_DIR} \
diff --git a/cddl/lib/libzdb/Makefile b/cddl/lib/libzdb/Makefile
new file mode 100644
index 000000000000..f5a6a42d7aad
--- /dev/null
+++ b/cddl/lib/libzdb/Makefile
@@ -0,0 +1,28 @@
+.PATH: ${ZFSTOP}/lib/libzdb
+.PATH: ${ZFSTOP}/include
+
+PACKAGE= zfs
+LIB_PACKAGE=
+
+LIB= zdb
+
+INCS = libzdb.h
+
+SRCS = libzdb.c
+
+WARNS?= 2
+CSTD= c99
+
+CFLAGS+= -I${ZFSTOP}/include
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/os/freebsd
+CFLAGS+= -I${ZFSTOP}/lib/libzpool/include
+CFLAGS+= -I${ZFSTOP}/include/os/freebsd/zfs
+CFLAGS+= -I${SRCTOP}/sys
+CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
+CFLAGS+= -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -I${ZFSTOP}/lib/libzutil
+CFLAGS+= -DHAVE_ISSETUGID -DIN_BASE
+CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
+
+.include <bsd.lib.mk>
diff --git a/cddl/lib/libzdb/Makefile.depend b/cddl/lib/libzdb/Makefile.depend
new file mode 100644
index 000000000000..93249906da4f
--- /dev/null
+++ b/cddl/lib/libzdb/Makefile.depend
@@ -0,0 +1,14 @@
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ include \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/cddl/lib/libzfs/Makefile b/cddl/lib/libzfs/Makefile
index 63bfcb39d4d8..ed0c240b1113 100644
--- a/cddl/lib/libzfs/Makefile
+++ b/cddl/lib/libzfs/Makefile
@@ -1,15 +1,15 @@
-# $FreeBSD$
+.PATH: ${ZFSTOP}/module/icp
+.PATH: ${ZFSTOP}/module/zcommon
+.PATH: ${ZFSTOP}/lib/libzfs
+.PATH: ${ZFSTOP}/lib/libzfs/os/freebsd
+.PATH: ${ZFSTOP}/lib/libshare
+.PATH: ${ZFSTOP}/include
+.PATH: ${ZFSTOP}/module/zstd
+.PATH: ${ZFSTOP}/module/zstd/lib
-.PATH: ${SRCTOP}/sys/contrib/openzfs/module/icp
-.PATH: ${SRCTOP}/sys/contrib/openzfs/module/zcommon
-.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libzfs
-.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libzfs/os/freebsd
-.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libshare
-.PATH: ${SRCTOP}/sys/contrib/openzfs/include
-.PATH: ${SRCTOP}/sys/contrib/openzfs/module/zstd
-.PATH: ${SRCTOP}/sys/contrib/openzfs/module/zstd/lib
+PACKAGE= zfs
+LIB_PACKAGE=
-PACKAGE= runtime
LIB= zfs
LIBADD= \
avl \
@@ -20,6 +20,7 @@ LIBADD= \
md \
nvpair \
pthread \
+ rt \
umem \
util \
uutil \
@@ -55,7 +56,6 @@ USER_C += \
os/freebsd/smb.c
KERNEL_C = \
- algs/sha2/sha2.c \
cityhash.c \
zfeature_common.c \
zfs_comutil.c \
@@ -65,10 +65,10 @@ KERNEL_C = \
zfs_fletcher_superscalar4.c \
zfs_namecheck.c \
zfs_prop.c \
+ zfs_valstr.c \
zpool_prop.c \
zprop_common.c
-
ARCH_C =
.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
ARCH_C += zfs_fletcher_intel.c \
@@ -89,20 +89,22 @@ WARNS?= 2
SHLIB_MAJOR= 4
CSTD= c99
CFLAGS+= -DIN_BASE
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include/os/freebsd
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libshare
+CFLAGS+= -I${ZFSTOP}/include
+CFLAGS+= -I${ZFSTOP}/include/os/freebsd
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/os/freebsd
+CFLAGS+= -I${ZFSTOP}/lib/libshare
+CFLAGS+= -I${ZFSTOP}/lib/libzpool/include
CFLAGS+= -I${SRCTOP}/sys/contrib/ck/include
CFLAGS+= -I${SRCTOP}/sys
CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include
-CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -I${ZFSTOP}/module/icp/include
+CFLAGS+= -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h
CFLAGS+= -DHAVE_ISSETUGID
+CFLAGS+= -DHAVE_EXECVPE
CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
CFLAGS+= -DSYSCONFDIR=\"/etc\"
CFLAGS+= -DPKGDATADIR=\"/usr/share/zfs\"
-
+CFLAGS+= -DZFSEXECDIR=\"${LIBEXECDIR}/zfs\"
.include <bsd.lib.mk>
diff --git a/cddl/lib/libzfs/Makefile.depend b/cddl/lib/libzfs/Makefile.depend
index 54a7c43b42aa..1fead4b4f29d 100644
--- a/cddl/lib/libzfs/Makefile.depend
+++ b/cddl/lib/libzfs/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
@@ -7,6 +6,7 @@ DIRDEPS = \
cddl/lib/libumem \
cddl/lib/libuutil \
cddl/lib/libzfs_core \
+ cddl/lib/libzutil \
include \
include/xlocale \
lib/${CSU_DIR} \
@@ -15,10 +15,12 @@ DIRDEPS = \
lib/libexpat \
lib/libgeom \
lib/libmd \
+ lib/librt \
lib/libthr \
lib/libutil \
lib/libz \
lib/msun \
+ secure/lib/libcrypto \
.include <dirdeps.mk>
diff --git a/cddl/lib/libzfs_core/Makefile b/cddl/lib/libzfs_core/Makefile
index 5a7475f55428..72b0f519e21d 100644
--- a/cddl/lib/libzfs_core/Makefile
+++ b/cddl/lib/libzfs_core/Makefile
@@ -1,14 +1,13 @@
-# $FreeBSD$
-
-.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libzfs_core
-.PATH: ${SRCTOP}/sys/contrib/openzfs/include
-.PATH: ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/zfs
-.PATH: ${SRCTOP}/sys/contrib/openzfs/module/os/freebsd/zfs
+.PATH: ${ZFSTOP}/lib/libzfs_core
+.PATH: ${ZFSTOP}/include
+.PATH: ${ZFSTOP}/include/os/freebsd/zfs
+.PATH: ${ZFSTOP}/module/os/freebsd/zfs
+PACKAGE= zfs
+LIB_PACKAGE=
LIB= zfs_core
LIBADD= nvpair spl zutil
-PACKAGE= runtime
INCS= libzfs_core.h
SRCS= libzfs_core.c \
@@ -18,15 +17,17 @@ SRCS= libzfs_core.c \
WARNS?= 2
CSTD= c99
CFLAGS+= -DIN_BASE
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libzfs_core/common
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/zfs
+CFLAGS+= -I${ZFSTOP}/include
+CFLAGS+= -I${ZFSTOP}/lib/libzfs_core
+CFLAGS+= -I${ZFSTOP}/lib/libzfs_core/common
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/os/freebsd
+CFLAGS+= -I${ZFSTOP}/lib/libzpool/include
+CFLAGS+= -I${ZFSTOP}/include/os/freebsd/zfs
CFLAGS+= -I${SRCTOP}/sys
CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include
-CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -I${ZFSTOP}/module/icp/include
+CFLAGS+= -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h
CFLAGS+= -DHAVE_ISSETUGID
CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
diff --git a/cddl/lib/libzfs_core/Makefile.depend b/cddl/lib/libzfs_core/Makefile.depend
index 26e3937b68fd..fd295d12904d 100644
--- a/cddl/lib/libzfs_core/Makefile.depend
+++ b/cddl/lib/libzfs_core/Makefile.depend
@@ -1,14 +1,14 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
cddl/lib/libnvpair \
+ cddl/lib/libspl \
+ cddl/lib/libzutil \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
- lib/msun \
.include <dirdeps.mk>
diff --git a/cddl/lib/libzfsbootenv/Makefile b/cddl/lib/libzfsbootenv/Makefile
index be39af96124a..eba6a1d8bea8 100644
--- a/cddl/lib/libzfsbootenv/Makefile
+++ b/cddl/lib/libzfsbootenv/Makefile
@@ -1,9 +1,9 @@
-# $FreeBSD$
+.PATH: ${ZFSTOP}/lib/libzfsbootenv
+.PATH: ${ZFSTOP}/include
-.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libzfsbootenv
-.PATH: ${SRCTOP}/sys/contrib/openzfs/include
+PACKAGE= zfs
+LIB_PACKAGE=
-PACKAGE= runtime
LIB= zfsbootenv
SHLIB_MAJOR= 1
@@ -20,15 +20,16 @@ SRCS= $(USER_C)
CSTD= c99
CFLAGS+= -DIN_BASE
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
+CFLAGS+= -I${ZFSTOP}/include
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/os/freebsd
+CFLAGS+= -I${ZFSTOP}/lib/libzpool/include
CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include
-CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -I${ZFSTOP}/module/icp/include
+CFLAGS+= -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h
CFLAGS+= -DHAVE_ISSETUGID
CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/zfs
+CFLAGS+= -I${ZFSTOP}/include/os/freebsd/zfs
CFLAGS.lzbe_device.c= -Wno-cast-qual
CFLAGS.lzbe_util.c= -Wno-cast-qual
CFLAGS.lzbe_pair.c= -Wno-cast-qual
diff --git a/cddl/lib/libzfsbootenv/Makefile.depend b/cddl/lib/libzfsbootenv/Makefile.depend
new file mode 100644
index 000000000000..7209d9b784ef
--- /dev/null
+++ b/cddl/lib/libzfsbootenv/Makefile.depend
@@ -0,0 +1,17 @@
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ cddl/lib/libnvpair \
+ cddl/lib/libzfs \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/cddl/lib/libzpool/Makefile b/cddl/lib/libzpool/Makefile
index 92f1bda6d82a..80fec2eb3fb1 100644
--- a/cddl/lib/libzpool/Makefile
+++ b/cddl/lib/libzpool/Makefile
@@ -1,6 +1,4 @@
-# $FreeBSD$
-
-ZFSTOP= ${SRCTOP}/sys/contrib/openzfs
+.PATH: ${ZFSTOP}/lib/libzpool
# ZFS_COMMON_SRCS
.PATH: ${ZFSTOP}/module/zfs
@@ -14,10 +12,6 @@ ZFSTOP= ${SRCTOP}/sys/contrib/openzfs
.PATH: ${ZFSTOP}/module/zstd/lib/compress
.PATH: ${ZFSTOP}/module/zstd/lib/decompress
-.PATH: ${ZFSTOP}/module/os/linux/zfs
-
-.PATH: ${ZFSTOP}/lib/libzpool
-
.if exists(${SRCTOP}/sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH}/opensolaris_atomic.S)
.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH}
ATOMIC_SRCS= opensolaris_atomic.S
@@ -32,14 +26,21 @@ ATOMIC_SRCS= opensolaris_atomic.c
PICFLAG= -fPIC
.endif
+PACKAGE= zfs
+LIB_PACKAGE=
+
LIB= zpool
USER_C = \
+ arc_os.c \
kernel.c \
- taskq.c \
- util.c
+ util.c \
+ zfs_debug.c
+
+.PATH: ${ZFSTOP}/module/os/linux/zfs
KERNEL_C = \
+ simd_stat.c \
zfeature_common.c \
zfs_comutil.c \
zfs_deleg.c \
@@ -55,21 +56,24 @@ KERNEL_C = \
abd_os.c \
aggsum.c \
arc.c \
- arc_os.c \
blake3_zfs.c \
blkptr.c \
bplist.c \
bpobj.c \
bptree.c \
- btree.c \
bqueue.c \
+ btree.c \
+ brt.c \
cityhash.c \
dbuf.c \
dbuf_stats.c \
ddt.c \
+ ddt_log.c \
+ ddt_stats.c \
ddt_zap.c \
dmu.c \
dmu_diff.c \
+ dmu_direct.c \
dmu_object.c \
dmu_objset.c \
dmu_recv.c \
@@ -116,10 +120,9 @@ KERNEL_C = \
refcount.c \
rrwlock.c \
sa.c \
- sha256.c \
+ sha2_zfs.c \
skein_zfs.c \
spa.c \
- spa_boot.c \
spa_checkpoint.c \
spa_config.c \
spa_errlog.c \
@@ -134,7 +137,6 @@ KERNEL_C = \
uberblock.c \
unique.c \
vdev.c \
- vdev_cache.c \
vdev_draid.c \
vdev_draid_rand.c \
vdev_file.c \
@@ -143,6 +145,7 @@ KERNEL_C = \
vdev_indirect_mapping.c \
vdev_initialize.c \
vdev_label.c \
+ vdev_label_os.c \
vdev_mirror.c \
vdev_missing.c \
vdev_queue.c \
@@ -171,9 +174,11 @@ KERNEL_C = \
zfeature.c \
zfs_byteswap.c \
zfs_chksum.c \
- zfs_debug.c \
+ zfs_crrd.c \
+ zfs_debug_common.c \
zfs_fm.c \
zfs_fuid.c \
+ zfs_impl.c \
zfs_sa.c \
zfs_znode.c \
zfs_racct.c \
@@ -245,9 +250,10 @@ LUA_C = \
lvm.c \
lzio.c
-UNICODE_C = u8_textprep.c uconv.c
+UNICODE_C = u8_textprep.c
+
+SRCS+= ${USER_C} ${KERNEL_C} ${LUA_C} ${UNICODE_C} ${ARCH_C}
-SRCS= ${USER_C} ${KERNEL_C} ${LUA_C} ${UNICODE_C} ${ARCH_C}
WARNS?= 2
CFLAGS+= \
@@ -255,10 +261,11 @@ CFLAGS+= \
-I${ZFSTOP}/include \
-I${ZFSTOP}/lib/libspl/include \
-I${ZFSTOP}/lib/libspl/include/os/freebsd \
+ -I${ZFSTOP}/lib/libzpool/include \
-I${SRCTOP}/sys \
- -I${ZFSTOP}/include/os/freebsd/zfs \
-I${SRCTOP}/cddl/compat/opensolaris/include \
-I${ZFSTOP}/module/icp/include \
+ -I${SRCTOP}/compat/linuxkpi/common/include/linux \
-include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h \
-DHAVE_ISSETUGID \
-include ${SRCTOP}/sys/modules/zfs/zfs_config.h \
@@ -277,9 +284,6 @@ CFLAGS.gcc+= -fms-extensions
LIBADD= md pthread z spl icp nvpair avl umem
-# atomic.S doesn't like profiling.
-MK_PROFILE= no
-
CSTD= c99
# Since there are many asserts in this library, it makes no sense to compile
@@ -287,6 +291,12 @@ CSTD= c99
CFLAGS+= -g -DDEBUG=1
+CFLAGS.gcc+= -Wno-pointer-to-int-cast
+
+# Pointer values are used as debugging "tags" to mark reference count
+# ownerships and in some cases the tag reference is dropped after an
+# object is freed.
+CFLAGS.dbuf.c= ${NO_WUSE_AFTER_FREE}
CFLAGS.entropy_common.c= -fno-tree-vectorize
CFLAGS.entropy_common.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL}
CFLAGS.error_private.c= -fno-tree-vectorize
diff --git a/cddl/lib/libzpool/Makefile.depend b/cddl/lib/libzpool/Makefile.depend
index 06045f57b437..42b2995ff2d1 100644
--- a/cddl/lib/libzpool/Makefile.depend
+++ b/cddl/lib/libzpool/Makefile.depend
@@ -1,12 +1,11 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
cddl/lib/libavl \
cddl/lib/libicp \
cddl/lib/libnvpair \
+ cddl/lib/libspl \
cddl/lib/libumem \
- gnu/lib/csu \
include \
include/xlocale \
lib/${CSU_DIR} \
@@ -15,7 +14,6 @@ DIRDEPS = \
lib/libmd \
lib/libthr \
lib/libz \
- lib/msun \
.include <dirdeps.mk>
diff --git a/cddl/lib/libzutil/Makefile b/cddl/lib/libzutil/Makefile
index 2e6b53658b22..952ebda889b2 100644
--- a/cddl/lib/libzutil/Makefile
+++ b/cddl/lib/libzutil/Makefile
@@ -1,12 +1,12 @@
-# $FreeBSD$
+.PATH: ${ZFSTOP}/lib/libzutil
+.PATH: ${ZFSTOP}/lib/libzutil/os/freebsd
+.PATH: ${ZFSTOP}/module/os/freebsd/zfs
-.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libzutil
-.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libzutil/os/freebsd
-.PATH: ${SRCTOP}/sys/contrib/openzfs/module/os/freebsd/zfs
+PACKAGE= zfs
+LIB_PACKAGE=
LIB= zutil
LIBADD= avl geom m tpool
-PACKAGE= runtime
INCS = zutil_import.h
@@ -27,14 +27,15 @@ SRCS += zfs_ioctl_compat.c
WARNS?= 2
CSTD= c99
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/zfs
+CFLAGS+= -I${ZFSTOP}/include
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/os/freebsd
+CFLAGS+= -I${ZFSTOP}/lib/libzpool/include
+CFLAGS+= -I${ZFSTOP}/include/os/freebsd/zfs
CFLAGS+= -I${SRCTOP}/sys
CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
-CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libzutil
+CFLAGS+= -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -I${ZFSTOP}/lib/libzutil
CFLAGS+= -DHAVE_ISSETUGID -DIN_BASE
CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
diff --git a/cddl/lib/libzutil/Makefile.depend b/cddl/lib/libzutil/Makefile.depend
new file mode 100644
index 000000000000..ddad58a70480
--- /dev/null
+++ b/cddl/lib/libzutil/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ cddl/lib/libavl \
+ cddl/lib/libtpool \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libgeom \
+ lib/msun \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/cddl/lib/pam_zfs_key/Makefile b/cddl/lib/pam_zfs_key/Makefile
index cf43802090dd..345321b5926d 100644
--- a/cddl/lib/pam_zfs_key/Makefile
+++ b/cddl/lib/pam_zfs_key/Makefile
@@ -1,7 +1,7 @@
-.PATH: ${SRCTOP}/sys/contrib/openzfs/contrib/pam_zfs_key
-.PATH: ${SRCTOP}/sys/contrib/openzfs/include
+.PATH: ${ZFSTOP}/contrib/pam_zfs_key
+.PATH: ${ZFSTOP}/include
-PACKAGE= utilities
+PACKAGE= zfs
LIB= pam_zfs_key
SHLIBDIR?= /usr/lib
@@ -13,15 +13,17 @@ SRCS= pam_zfs_key.c
WARNS?= 2
CSTD= c99
CFLAGS+= -DIN_BASE
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
+CFLAGS+= -I${ZFSTOP}/include
+CFLAGS+= -I${ZFSTOP}
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/
+CFLAGS+= -I${ZFSTOP}/lib/libspl/include/os/freebsd
+CFLAGS+= -I${ZFSTOP}/lib/libzpool/include
CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include
-CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -I${ZFSTOP}/module/icp/include
+CFLAGS+= -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h
CFLAGS+= -DHAVE_ISSETUGID
CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/zfs
+CFLAGS+= -I${ZFSTOP}/include/os/freebsd/zfs
CFLAGS+= -DRUNSTATEDIR=\"/var/run\"
.include "../../lib/libpam/modules/Makefile.inc"
diff --git a/cddl/lib/tests/Makefile b/cddl/lib/tests/Makefile
index 3b3078f8612a..29b1b564beca 100644
--- a/cddl/lib/tests/Makefile
+++ b/cddl/lib/tests/Makefile
@@ -1,5 +1,3 @@
-# $FreeBSD$
-
.PATH: ${SRCTOP}/tests
KYUAFILE= yes
diff --git a/cddl/lib/tests/Makefile.depend b/cddl/lib/tests/Makefile.depend
index f80275d86ab1..11aba52f82cf 100644
--- a/cddl/lib/tests/Makefile.depend
+++ b/cddl/lib/tests/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \