aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile7
-rw-r--r--lib/clang/llvm.build.mk12
-rw-r--r--lib/csu/common/crtbrand.S2
-rw-r--r--lib/csu/common/feature_note.S2
-rw-r--r--lib/csu/common/ignore_init_note.S2
-rw-r--r--lib/flua/libjail/lua_jail.c2
-rw-r--r--lib/geom/cache/Makefile2
-rw-r--r--lib/geom/concat/Makefile2
-rw-r--r--lib/geom/eli/Makefile2
-rw-r--r--lib/geom/journal/Makefile2
-rw-r--r--lib/geom/label/Makefile2
-rw-r--r--lib/geom/mirror/Makefile2
-rw-r--r--lib/geom/mirror/gmirror.818
-rw-r--r--lib/geom/mountver/Makefile2
-rw-r--r--lib/geom/multipath/Makefile2
-rw-r--r--lib/geom/nop/Makefile2
-rw-r--r--lib/geom/part/Makefile2
-rw-r--r--lib/geom/part/gpart.82
-rw-r--r--lib/geom/raid/Makefile2
-rw-r--r--lib/geom/raid3/Makefile2
-rw-r--r--lib/geom/shsec/Makefile2
-rw-r--r--lib/geom/stripe/Makefile2
-rw-r--r--lib/geom/union/Makefile2
-rw-r--r--lib/geom/virstor/Makefile2
-rw-r--r--lib/libarchive/Makefile1
-rw-r--r--lib/libbe/Makefile2
-rw-r--r--lib/libbegemot/Makefile2
-rw-r--r--lib/libbsddialog/Makefile1
-rw-r--r--lib/libc/Makefile7
-rw-r--r--lib/libc/amd64/string/memmove.S2
-rw-r--r--lib/libc/gen/Makefile.inc5
-rw-r--r--lib/libc/gen/Symbol.map2
-rw-r--r--lib/libc/gen/auxv.36
-rw-r--r--lib/libc/gen/auxv.c29
-rw-r--r--lib/libc/gen/dlopen.38
-rw-r--r--lib/libc/gen/elf_utils.c29
-rw-r--r--lib/libc/gen/ftok.33
-rw-r--r--lib/libc/gen/getpagesize.33
-rw-r--r--lib/libc/gen/getpeereid.33
-rw-r--r--lib/libc/gen/getpwent.33
-rw-r--r--lib/libc/gen/scandir-compat11.c8
-rw-r--r--lib/libc/gen/scandir.384
-rw-r--r--lib/libc/gen/scandir.c70
-rw-r--r--lib/libc/gen/setproctitle.33
-rw-r--r--lib/libc/gen/tcgetpgrp.33
-rw-r--r--lib/libc/gen/tcgetsid.33
-rw-r--r--lib/libc/gen/tcsetpgrp.33
-rw-r--r--lib/libc/gen/tcsetsid.33
-rw-r--r--lib/libc/gen/times.c3
-rw-r--r--lib/libc/net/gai_strerror.317
-rw-r--r--lib/libc/net/gai_strerror.c10
-rw-r--r--lib/libc/net/getaddrinfo.32
-rw-r--r--lib/libc/net/getaddrinfo.c18
-rw-r--r--lib/libc/net/gethostbydns.c5
-rw-r--r--lib/libc/net/resolver.35
-rw-r--r--lib/libc/quad/qdivrem.c2
-rw-r--r--lib/libc/rpc/netnamer.c2
-rw-r--r--lib/libc/rpc/rpcb_clnt.c14
-rw-r--r--lib/libc/stdio/fflush.c3
-rw-r--r--lib/libc/stdio/fvwrite.c5
-rw-r--r--lib/libc/stdio/setvbuf.c3
-rw-r--r--lib/libc/stdio/wbuf.c6
-rw-r--r--lib/libc/stdlib/Makefile.inc4
-rw-r--r--lib/libc/stdlib/Symbol.map2
-rw-r--r--lib/libc/stdlib/qsort.312
-rw-r--r--lib/libc/stdlib/qsort.c16
-rw-r--r--lib/libc/stdlib/qsort_r.c11
-rw-r--r--lib/libc/stdlib/qsort_r_compat.c21
-rw-r--r--lib/libc/stdlib/strfmon.318
-rw-r--r--lib/libc/stdlib/strfmon.c218
-rw-r--r--lib/libc/string/Makefile.inc4
-rw-r--r--lib/libc/string/Symbol.map1
-rw-r--r--lib/libc/string/strverscmp.356
-rw-r--r--lib/libc/string/strverscmp.c91
-rw-r--r--lib/libc/sys/getsockopt.28
-rw-r--r--lib/libc/sys/ktrace.25
-rw-r--r--lib/libc/sys/socket.224
-rw-r--r--lib/libc/sys/thr_new.26
-rw-r--r--lib/libc/tests/locale/c16rtomb_test.c3
-rw-r--r--lib/libc/tests/stdlib/Makefile10
-rw-r--r--lib/libc/tests/stdlib/qsort_b_test.c76
-rw-r--r--lib/libc/tests/stdlib/qsort_r_compat_test.c92
-rw-r--r--lib/libc/tests/stdlib/qsort_r_test.c6
-rw-r--r--lib/libc/tests/stdlib/strfmon_test.c190
-rw-r--r--lib/libc/tests/string/Makefile5
-rw-r--r--lib/libc/tests/string/strverscmp_test.c93
-rw-r--r--lib/libc_nonshared/Makefile1
-rw-r--r--lib/libcasper/libcasper/libcasper.35
-rw-r--r--lib/libcasper/libcasper/libcasper_service.32
-rw-r--r--lib/libcasper/services/cap_netdb/cap_netdb.33
-rw-r--r--lib/libdevinfo/Makefile1
-rw-r--r--lib/libdpv/dpv.324
-rw-r--r--lib/libedit/Makefile2
-rw-r--r--lib/libefivar/efivar-dp-format.c3
-rw-r--r--lib/libexpat/expat_config.h11
-rw-r--r--lib/libexpat/libbsdxml.34
-rw-r--r--lib/libfetch/common.c9
-rw-r--r--lib/libfetch/fetch.33
-rw-r--r--lib/libfetch/http.c5
-rw-r--r--lib/libgeom/libgeom.32
-rw-r--r--lib/libiconv_modules/VIQR/citrus_viqr.c4
-rw-r--r--lib/libifconfig/libifconfig.h6
-rw-r--r--lib/libifconfig/libifconfig_internal.h4
-rw-r--r--lib/libipsec/pfkey_dump.c6
-rw-r--r--lib/libkvm/kvm.c2
-rw-r--r--lib/libldns/Makefile2
-rw-r--r--lib/liblzma/Makefile5
-rw-r--r--lib/liblzma/Symbol.map6
-rw-r--r--lib/liblzma/config.h120
-rw-r--r--lib/libmagic/Makefile6
-rw-r--r--lib/libmagic/config.h108
-rw-r--r--lib/libmd/Makefile2
-rw-r--r--lib/libmd/mdX.32
-rw-r--r--lib/libmd/ripemd.32
-rw-r--r--lib/libmd/sha.32
-rw-r--r--lib/libmd/sha256.32
-rw-r--r--lib/libmd/sha512.32
-rw-r--r--lib/libmd/skein.32
-rw-r--r--lib/libopie/Makefile40
-rw-r--r--lib/libopie/Makefile.depend18
-rw-r--r--lib/libopie/config.h381
-rw-r--r--lib/libopie/opieaccess13
-rw-r--r--lib/libopie/opieextra.c98
-rw-r--r--lib/libpam/modules/modules.inc2
-rw-r--r--lib/libpam/modules/pam_chroot/pam_chroot.82
-rw-r--r--lib/libpam/modules/pam_deny/pam_deny.82
-rw-r--r--lib/libpam/modules/pam_echo/pam_echo.82
-rw-r--r--lib/libpam/modules/pam_exec/pam_exec.814
-rw-r--r--lib/libpam/modules/pam_ftpusers/pam_ftpusers.82
-rw-r--r--lib/libpam/modules/pam_group/pam_group.82
-rw-r--r--lib/libpam/modules/pam_guest/pam_guest.82
-rw-r--r--lib/libpam/modules/pam_krb5/pam_krb5.82
-rw-r--r--lib/libpam/modules/pam_ksu/pam_ksu.82
-rw-r--r--lib/libpam/modules/pam_lastlog/pam_lastlog.86
-rw-r--r--lib/libpam/modules/pam_nologin/pam_nologin.82
-rw-r--r--lib/libpam/modules/pam_opie/Makefile36
-rw-r--r--lib/libpam/modules/pam_opie/Makefile.depend19
-rw-r--r--lib/libpam/modules/pam_opie/pam_opie.8123
-rw-r--r--lib/libpam/modules/pam_opie/pam_opie.c157
-rw-r--r--lib/libpam/modules/pam_opieaccess/Makefile11
-rw-r--r--lib/libpam/modules/pam_opieaccess/Makefile.depend18
-rw-r--r--lib/libpam/modules/pam_opieaccess/pam_opieaccess.8142
-rw-r--r--lib/libpam/modules/pam_opieaccess/pam_opieaccess.c97
-rw-r--r--lib/libpam/modules/pam_passwdqc/pam_passwdqc.82
-rw-r--r--lib/libpam/modules/pam_permit/pam_permit.82
-rw-r--r--lib/libpam/modules/pam_radius/pam_radius.82
-rw-r--r--lib/libpam/modules/pam_rhosts/pam_rhosts.82
-rw-r--r--lib/libpam/modules/pam_rootok/pam_rootok.82
-rw-r--r--lib/libpam/modules/pam_securetty/pam_securetty.82
-rw-r--r--lib/libpam/modules/pam_self/pam_self.82
-rw-r--r--lib/libpam/modules/pam_ssh/pam_ssh.82
-rw-r--r--lib/libpam/modules/pam_tacplus/pam_tacplus.82
-rw-r--r--lib/libpam/modules/pam_unix/pam_unix.82
-rw-r--r--lib/libpam/modules/pam_unix/pam_unix.c4
-rw-r--r--lib/libpam/pam.d/Makefile7
-rw-r--r--lib/libpam/pam.d/ftpd2
-rw-r--r--lib/libpam/pam.d/other2
-rw-r--r--lib/libpam/pam.d/sshd2
-rw-r--r--lib/libpam/pam.d/system2
-rw-r--r--lib/libpam/pam.d/telnetd26
-rw-r--r--lib/libpam/static_libpam/Makefile.depend2
-rw-r--r--lib/libpfctl/libpfctl.c18
-rw-r--r--lib/libpfctl/libpfctl.h6
-rw-r--r--lib/libpmc/Makefile2
-rw-r--r--lib/libpmc/libpmc.c108
-rw-r--r--lib/libpmc/pmc.sandybridge.38
-rw-r--r--lib/libpmc/pmu-events/arch/x86/broadwell/pipeline.json4
-rw-r--r--lib/libpmc/pmu-events/arch/x86/broadwellde/pipeline.json4
-rw-r--r--lib/libpmc/pmu-events/arch/x86/broadwellx/pipeline.json4
-rw-r--r--lib/libpmc/pmu-events/arch/x86/cascadelakex/uncore-other.json2
-rw-r--r--lib/libpmc/pmu-events/arch/x86/silvermont/pipeline.json4
-rw-r--r--lib/libpmc/pmu-events/arch/x86/skylakex/uncore-other.json2
-rw-r--r--lib/libproc/proc_bkpt.c3
-rw-r--r--lib/libproc/proc_regs.c8
-rw-r--r--lib/libproc/proc_sym.c4
-rw-r--r--lib/libprocstat/libprocstat.h1
-rw-r--r--lib/librpcsec_gss/rpc_gss_get_error.32
-rw-r--r--lib/librpcsec_gss/rpc_gss_get_mech_info.32
-rw-r--r--lib/librpcsec_gss/rpc_gss_get_mechanisms.32
-rw-r--r--lib/librpcsec_gss/rpc_gss_get_principal_name.32
-rw-r--r--lib/librpcsec_gss/rpc_gss_get_versions.32
-rw-r--r--lib/librpcsec_gss/rpc_gss_getcred.32
-rw-r--r--lib/librpcsec_gss/rpc_gss_is_installed.32
-rw-r--r--lib/librpcsec_gss/rpc_gss_max_data_length.32
-rw-r--r--lib/librpcsec_gss/rpc_gss_mech_to_oid.32
-rw-r--r--lib/librpcsec_gss/rpc_gss_oid_to_mech.32
-rw-r--r--lib/librpcsec_gss/rpc_gss_qop_to_num.32
-rw-r--r--lib/librpcsec_gss/rpc_gss_seccreate.32
-rw-r--r--lib/librpcsec_gss/rpc_gss_set_callback.32
-rw-r--r--lib/librpcsec_gss/rpc_gss_set_defaults.34
-rw-r--r--lib/librpcsec_gss/rpc_gss_set_svc_name.32
-rw-r--r--lib/librpcsec_gss/rpc_gss_svc_max_data_length.32
-rw-r--r--lib/librpcsec_gss/rpcsec_gss.31
-rw-r--r--lib/libsecureboot/openpgp/opgp_sig.c2
-rw-r--r--lib/libsecureboot/vets.c2
-rw-r--r--lib/libsysdecode/Makefile.depend1
-rw-r--r--lib/libsysdecode/mktables2
-rw-r--r--lib/libthr/thread/thr_init.c51
-rw-r--r--lib/libthr/thread/thr_private.h2
-rw-r--r--lib/libthr/thread/thr_stack.c21
-rw-r--r--lib/libufs/Makefile4
-rw-r--r--lib/libufs/cgroup.c4
-rw-r--r--lib/libufs/libufs.h4
-rw-r--r--lib/libufs/sblock.c54
-rw-r--r--lib/libufs/sbread.369
-rw-r--r--lib/libunbound/Makefile3
-rw-r--r--lib/libusb/Makefile7
-rw-r--r--lib/libusb/libusb-0.1.pc.in (renamed from lib/libusb/libusb-0.1.pc)5
-rw-r--r--lib/libusb/libusb-1.0.pc.in (renamed from lib/libusb/libusb-1.0.pc)5
-rw-r--r--lib/libusb/libusb-2.0.pc.in (renamed from lib/libusb/libusb-2.0.pc)5
-rw-r--r--lib/libusb/libusb.313
-rw-r--r--lib/libusb/libusb.h1
-rw-r--r--lib/libusb/libusb10.c22
-rw-r--r--lib/libvmmapi/vmmapi.c85
-rw-r--r--lib/libvmmapi/vmmapi.h23
-rw-r--r--lib/libwrap/Makefile2
-rw-r--r--lib/libz/Makefile6
-rw-r--r--lib/msun/Makefile2
-rw-r--r--lib/msun/i387/s_ceil.S2
-rw-r--r--lib/msun/i387/s_ceilf.S2
-rw-r--r--lib/msun/i387/s_ceill.S2
-rw-r--r--lib/msun/i387/s_floor.S2
-rw-r--r--lib/msun/i387/s_floorf.S2
-rw-r--r--lib/msun/i387/s_floorl.S2
-rw-r--r--lib/msun/i387/s_trunc.S2
-rw-r--r--lib/msun/i387/s_truncf.S2
-rw-r--r--lib/msun/i387/s_truncl.S2
-rw-r--r--lib/msun/man/clog.32
-rw-r--r--lib/msun/man/cospi.34
-rw-r--r--lib/msun/man/sinpi.34
-rw-r--r--lib/msun/man/tanpi.38
-rw-r--r--lib/msun/src/e_jn.c12
-rw-r--r--lib/msun/src/e_lgamma_r.c2
-rw-r--r--lib/msun/src/k_tanf.c2
-rw-r--r--lib/msun/tests/fenv_test.c2
-rw-r--r--lib/ncurses/tinfo/Makefile4
-rw-r--r--lib/ofed/libirdma/Makefile1
237 files changed, 1882 insertions, 1832 deletions
diff --git a/lib/Makefile b/lib/Makefile
index 482e4d603f4b..6b4b356707fe 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -57,7 +57,6 @@ SUBDIR= ${SUBDIR_BOOTSTRAP} \
libexecinfo \
libexpat \
libfetch \
- libfigpar \
libgcc_eh \
libgcc_s \
libgeom \
@@ -78,7 +77,6 @@ SUBDIR= ${SUBDIR_BOOTSTRAP} \
libnetmap \
libnv \
libopenbsd \
- libopie \
libpam \
libpathconv \
libpcap \
@@ -133,8 +131,7 @@ SUBDIR_DEPEND_libgeom= libexpat libsbuf
SUBDIR_DEPEND_librpcsec_gss= libgssapi
SUBDIR_DEPEND_libmagic= libz
SUBDIR_DEPEND_libmemstat= libkvm
-SUBDIR_DEPEND_libopie= libmd
-SUBDIR_DEPEND_libpam= libcrypt libopie ${_libradius} librpcsvc libtacplus libutil ${_libypclnt} ${_libcom_err}
+SUBDIR_DEPEND_libpam= libcrypt ${_libradius} librpcsvc libtacplus libutil ${_libypclnt} ${_libcom_err}
SUBDIR_DEPEND_libpjdlog= libutil
SUBDIR_DEPEND_libprocstat= libkvm libutil
SUBDIR_DEPEND_libradius= libmd
@@ -170,7 +167,7 @@ SUBDIR+= clang
SUBDIR.${MK_CUSE}+= libcuse
SUBDIR.${MK_CXX}+= libdevdctl
SUBDIR.${MK_TOOLCHAIN}+=libpe
-SUBDIR.${MK_DIALOG}+= libdpv
+SUBDIR.${MK_DIALOG}+= libdpv libfigpar
SUBDIR.${MK_FILE}+= libmagic
SUBDIR.${MK_GPIO}+= libgpio
SUBDIR.${MK_GSSAPI}+= libgssapi librpcsec_gss
diff --git a/lib/clang/llvm.build.mk b/lib/clang/llvm.build.mk
index dd54bf7312d9..575b6b2d9c62 100644
--- a/lib/clang/llvm.build.mk
+++ b/lib/clang/llvm.build.mk
@@ -30,6 +30,10 @@ CFLAGS+= -DHAVE_VCS_VERSION_INC
CFLAGS+= -DNDEBUG
.endif
+# Note that using TARGET_ARCH here is essential for a functional native-xtools
+# build! For native-xtools, we're building binaries that will work on the
+# *host* machine (MACHINE_ARCH), but they should default to producing binaries
+# for the *target* machine (TARGET_ARCH).
TARGET_ARCH?= ${MACHINE_ARCH}
BUILD_ARCH?= ${MACHINE_ARCH}
@@ -37,15 +41,15 @@ BUILD_ARCH?= ${MACHINE_ARCH}
# arm (for armv4 and armv5 CPUs) always uses the soft float ABI.
# For all other targets, we stick with 'unknown'.
.if ${TARGET_ARCH:Marmv[67]*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "")
-TARGET_ABI= -gnueabihf
+TARGET_TRIPLE_ABI= -gnueabihf
.elif ${TARGET_ARCH:Marm*}
-TARGET_ABI= -gnueabi
+TARGET_TRIPLE_ABI= -gnueabi
.else
-TARGET_ABI=
+TARGET_TRIPLE_ABI=
.endif
VENDOR= unknown
-LLVM_TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${VENDOR}-freebsd${OS_REVISION}${TARGET_ABI}
+LLVM_TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${VENDOR}-freebsd${OS_REVISION}${TARGET_TRIPLE_ABI}
LLVM_BUILD_TRIPLE?= ${BUILD_ARCH:C/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${VENDOR}-freebsd${OS_REVISION}
CFLAGS+= -DLLVM_DEFAULT_TARGET_TRIPLE=\"${LLVM_TARGET_TRIPLE}\"
diff --git a/lib/csu/common/crtbrand.S b/lib/csu/common/crtbrand.S
index bf223d84bc12..142ef56c2785 100644
--- a/lib/csu/common/crtbrand.S
+++ b/lib/csu/common/crtbrand.S
@@ -47,3 +47,5 @@ __FBSDID("$FreeBSD$");
2: .p2align 2
3: .4byte __FreeBSD_version
4:
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/lib/csu/common/feature_note.S b/lib/csu/common/feature_note.S
index 0274ce61debc..c2a6c94d1ee2 100644
--- a/lib/csu/common/feature_note.S
+++ b/lib/csu/common/feature_note.S
@@ -40,3 +40,5 @@ __FBSDID("$FreeBSD$");
2: .p2align 2
3: .4byte 0
4:
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/lib/csu/common/ignore_init_note.S b/lib/csu/common/ignore_init_note.S
index 804cefd47155..9026ba925891 100644
--- a/lib/csu/common/ignore_init_note.S
+++ b/lib/csu/common/ignore_init_note.S
@@ -41,3 +41,5 @@ __FBSDID("$FreeBSD$");
2: .p2align 2
3: .4byte 0
4:
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/lib/flua/libjail/lua_jail.c b/lib/flua/libjail/lua_jail.c
index 025694bf1181..27db9c52f319 100644
--- a/lib/flua/libjail/lua_jail.c
+++ b/lib/flua/libjail/lua_jail.c
@@ -78,7 +78,7 @@ l_jail_filter(const char *param_name, void *data __unused)
/*
* Allowing lastjid will mess up our iteration over all jails on the
- * system, as this is a special paramter that indicates where the search
+ * system, as this is a special parameter that indicates where the search
* starts from. We'll always add jid and name, so just silently remove
* these.
*/
diff --git a/lib/geom/cache/Makefile b/lib/geom/cache/Makefile
index e1ba031c9ffe..2aee7212dfda 100644
--- a/lib/geom/cache/Makefile
+++ b/lib/geom/cache/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-PACKAGE=runtime
+PACKAGE=geom
.PATH: ${.CURDIR:H:H}/misc
GEOM_CLASS= cache
diff --git a/lib/geom/concat/Makefile b/lib/geom/concat/Makefile
index 3c370520a624..9d5cfb8b3893 100644
--- a/lib/geom/concat/Makefile
+++ b/lib/geom/concat/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-PACKAGE=runtime
+PACKAGE=geom
.PATH: ${.CURDIR:H:H}/misc
GEOM_CLASS= concat
diff --git a/lib/geom/eli/Makefile b/lib/geom/eli/Makefile
index e36eece7a6e2..49f34908f917 100644
--- a/lib/geom/eli/Makefile
+++ b/lib/geom/eli/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-PACKAGE=runtime
+PACKAGE=geom
.PATH: ${.CURDIR:H:H}/misc ${SRCTOP}/sys/geom/eli ${SRCTOP}/sys/crypto/sha2
GEOM_CLASS= eli
diff --git a/lib/geom/journal/Makefile b/lib/geom/journal/Makefile
index 3be15a13a81e..e789793a68b8 100644
--- a/lib/geom/journal/Makefile
+++ b/lib/geom/journal/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-PACKAGE=runtime
+PACKAGE=geom
.PATH: ${.CURDIR:H:H}/misc
GEOM_CLASS= journal
diff --git a/lib/geom/label/Makefile b/lib/geom/label/Makefile
index 767924b78b61..9f2b9c5e24f8 100644
--- a/lib/geom/label/Makefile
+++ b/lib/geom/label/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-PACKAGE=runtime
+PACKAGE=geom
.PATH: ${.CURDIR:H:H}/misc
GEOM_CLASS= label
diff --git a/lib/geom/mirror/Makefile b/lib/geom/mirror/Makefile
index 553e44787d8b..0fd7a7bcd13b 100644
--- a/lib/geom/mirror/Makefile
+++ b/lib/geom/mirror/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-PACKAGE=runtime
+PACKAGE=geom
.PATH: ${.CURDIR:H:H}/misc
GEOM_CLASS= mirror
diff --git a/lib/geom/mirror/gmirror.8 b/lib/geom/mirror/gmirror.8
index 44ea08bcf65b..c7d2b0e0e7ac 100644
--- a/lib/geom/mirror/gmirror.8
+++ b/lib/geom/mirror/gmirror.8
@@ -24,13 +24,29 @@
.\"
.\" $FreeBSD$
.\"
-.Dd July 21, 2022
+.Dd October 5, 2022
.Dt GMIRROR 8
.Os
.Sh NAME
.Nm gmirror
.Nd "control utility for mirrored devices"
.Sh SYNOPSIS
+To compile GEOM_MIRROR into your kernel, add the following lines to your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options GEOM_MIRROR"
+.Ed
+.Pp
+Alternatively, to load the GEOM_MIRROR module at boot time, add the following
+line to your
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+geom_mirror_load="YES"
+.Ed
+.Pp
+.No Usage of the Nm
+utility:
+.Pp
.Nm
.Cm label
.Op Fl Fhnv
diff --git a/lib/geom/mountver/Makefile b/lib/geom/mountver/Makefile
index 36c1e01e112a..7924df1a074d 100644
--- a/lib/geom/mountver/Makefile
+++ b/lib/geom/mountver/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-PACKAGE=runtime
+PACKAGE=geom
.PATH: ${.CURDIR:H:H}/misc
GEOM_CLASS= mountver
diff --git a/lib/geom/multipath/Makefile b/lib/geom/multipath/Makefile
index 5a753e42d76d..4364e382ba75 100644
--- a/lib/geom/multipath/Makefile
+++ b/lib/geom/multipath/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-PACKAGE=runtime
+PACKAGE=geom
.PATH: ${.CURDIR:H:H}/misc
GEOM_CLASS= multipath
diff --git a/lib/geom/nop/Makefile b/lib/geom/nop/Makefile
index 9d8b69117466..51a535a3b9e1 100644
--- a/lib/geom/nop/Makefile
+++ b/lib/geom/nop/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-PACKAGE=runtime
+PACKAGE=geom
.PATH: ${.CURDIR:H:H}/misc
GEOM_CLASS= nop
diff --git a/lib/geom/part/Makefile b/lib/geom/part/Makefile
index e9631caf4d84..077bc6c64b1d 100644
--- a/lib/geom/part/Makefile
+++ b/lib/geom/part/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-PACKAGE=runtime
+PACKAGE=geom
.PATH: ${.CURDIR:H:H}/misc
GEOM_CLASS= part
diff --git a/lib/geom/part/gpart.8 b/lib/geom/part/gpart.8
index 4dbe45b9953e..81d5a7a2bb3c 100644
--- a/lib/geom/part/gpart.8
+++ b/lib/geom/part/gpart.8
@@ -221,7 +221,7 @@ MBR bootcode contains Volume Serial Number by default, and
.Nm
tries to preserve it when installing new bootstrap code.
This option skips preservation to help with some versions of
-.Xr boot0 8
+.Xr boot0cfg 8
that do not support Volume Serial Number.
.It Fl b Ar bootcode
Embed bootstrap code from the file
diff --git a/lib/geom/raid/Makefile b/lib/geom/raid/Makefile
index 75d2ac7e25b7..2e3d4083492a 100644
--- a/lib/geom/raid/Makefile
+++ b/lib/geom/raid/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-PACKAGE=runtime
+PACKAGE=geom
.PATH: ${.CURDIR:H:H}/misc
GEOM_CLASS= raid
diff --git a/lib/geom/raid3/Makefile b/lib/geom/raid3/Makefile
index 2fdf4e8f8167..29aeb9d595b5 100644
--- a/lib/geom/raid3/Makefile
+++ b/lib/geom/raid3/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-PACKAGE=runtime
+PACKAGE=geom
.PATH: ${.CURDIR:H:H}/misc
GEOM_CLASS= raid3
diff --git a/lib/geom/shsec/Makefile b/lib/geom/shsec/Makefile
index f86df6c9af42..e6acbf24577c 100644
--- a/lib/geom/shsec/Makefile
+++ b/lib/geom/shsec/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-PACKAGE=runtime
+PACKAGE=geom
.PATH: ${.CURDIR:H:H}/misc
GEOM_CLASS= shsec
diff --git a/lib/geom/stripe/Makefile b/lib/geom/stripe/Makefile
index bbea1901749e..9fc24db55d65 100644
--- a/lib/geom/stripe/Makefile
+++ b/lib/geom/stripe/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-PACKAGE=runtime
+PACKAGE=geom
.PATH: ${.CURDIR:H:H}/misc
GEOM_CLASS= stripe
diff --git a/lib/geom/union/Makefile b/lib/geom/union/Makefile
index cb8b09dc7eca..384d1fbf8ca5 100644
--- a/lib/geom/union/Makefile
+++ b/lib/geom/union/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-PACKAGE=runtime
+PACKAGE=geom
.PATH: ${.CURDIR:H:H}/misc
GEOM_CLASS= union
diff --git a/lib/geom/virstor/Makefile b/lib/geom/virstor/Makefile
index dfbe0aeddc47..24b4e508af18 100644
--- a/lib/geom/virstor/Makefile
+++ b/lib/geom/virstor/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-PACKAGE=runtime
+PACKAGE=geom
.PATH: ${.CURDIR:H:H}/misc ${SRCTOP}/sys/geom/virstor
GEOM_CLASS= virstor
diff --git a/lib/libarchive/Makefile b/lib/libarchive/Makefile
index 90aeef82b641..d0db17b567c0 100644
--- a/lib/libarchive/Makefile
+++ b/lib/libarchive/Makefile
@@ -389,6 +389,7 @@ MLINKS+= archive_write_filter.3 archive_write_add_filter_lzma.3
MLINKS+= archive_write_filter.3 archive_write_add_filter_none.3
MLINKS+= archive_write_filter.3 archive_write_add_filter_program.3
MLINKS+= archive_write_filter.3 archive_write_add_filter_xz.3
+MLINKS+= archive_write_filter.3 archive_write_add_filter_zstd.3
MLINKS+= archive_write_format.3 archive_write_set_format_cpio.3
MLINKS+= archive_write_format.3 archive_write_set_format_pax.3
MLINKS+= archive_write_format.3 archive_write_set_format_pax_restricted.3
diff --git a/lib/libbe/Makefile b/lib/libbe/Makefile
index 3c66ea9f1cf0..7c8247b80402 100644
--- a/lib/libbe/Makefile
+++ b/lib/libbe/Makefile
@@ -4,7 +4,7 @@ SHLIBDIR?= /lib
.include <src.opts.mk>
-PACKAGE= runtime
+PACKAGE= zfs
LIB= be
SHLIB_MAJOR= 1
SHLIB_MINOR= 0
diff --git a/lib/libbegemot/Makefile b/lib/libbegemot/Makefile
index c5d3bb8badc2..6ce1310ae97b 100644
--- a/lib/libbegemot/Makefile
+++ b/lib/libbegemot/Makefile
@@ -25,3 +25,5 @@ MLINKS= rpoll.3 poll_register.3 \
rpoll.3 poll_dispatch.3
.include <bsd.lib.mk>
+
+CWARNFLAGS+= ${NO_WUSE_AFTER_FREE}
diff --git a/lib/libbsddialog/Makefile b/lib/libbsddialog/Makefile
index 08e5bebcb6a5..ddb7e08f71ba 100644
--- a/lib/libbsddialog/Makefile
+++ b/lib/libbsddialog/Makefile
@@ -6,6 +6,7 @@ LIB= bsddialog
PRIVATELIB= yes
SHLIB_MAJOR= 0
SRCS= barbox.c \
+ calendarbox.c \
formbox.c \
infobox.c \
lib_util.c \
diff --git a/lib/libc/Makefile b/lib/libc/Makefile
index 3667eea15307..c9150869f223 100644
--- a/lib/libc/Makefile
+++ b/lib/libc/Makefile
@@ -109,10 +109,7 @@ NOASM=
.include "${LIBC_SRCTOP}/net/Makefile.inc"
.include "${LIBC_SRCTOP}/nls/Makefile.inc"
.include "${LIBC_SRCTOP}/posix1e/Makefile.inc"
-.if ${LIBC_ARCH} != "aarch64" && \
- ${LIBC_ARCH} != "amd64" && \
- ${LIBC_ARCH} != "powerpc64" && \
- ${LIBC_ARCH} != "riscv"
+.if ${MACHINE_ABI:Mlong32}
.include "${LIBC_SRCTOP}/quad/Makefile.inc"
.endif
.include "${LIBC_SRCTOP}/regex/Makefile.inc"
@@ -162,7 +159,7 @@ CFLAGS+= -DSYMBOL_VERSIONING
# If there are no machine dependent sources, append all the
# machine-independent sources:
-.if empty(MDSRCS)
+.if empty(MDSRCS) || ${MK_MACHDEP_OPTIMIZATIONS} == no
SRCS+= ${MISRCS}
.else
# Append machine-dependent sources, then append machine-independent sources
diff --git a/lib/libc/amd64/string/memmove.S b/lib/libc/amd64/string/memmove.S
index ea92cb18782a..bd074e233511 100644
--- a/lib/libc/amd64/string/memmove.S
+++ b/lib/libc/amd64/string/memmove.S
@@ -306,3 +306,5 @@ ENTRY(memcpy)
MEMMOVE erms=0 overlap=1 begin=MEMMOVE_BEGIN end=MEMMOVE_END
END(memcpy)
#endif
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc
index 395edefc0503..45977b6b9005 100644
--- a/lib/libc/gen/Makefile.inc
+++ b/lib/libc/gen/Makefile.inc
@@ -493,7 +493,10 @@ MLINKS+=rand48.3 _rand48.3 \
rand48.3 seed48.3 \
rand48.3 srand48.3
MLINKS+=recv.2 recvmmsg.2
-MLINKS+=scandir.3 alphasort.3
+MLINKS+=scandir.3 alphasort.3 \
+ scandir.3 scandirat.3 \
+ scandir.3 scandir_b.3 \
+ scandir.3 versionsort.3
MLINKS+=sem_open.3 sem_close.3 \
sem_open.3 sem_unlink.3
MLINKS+=sem_wait.3 sem_trywait.3
diff --git a/lib/libc/gen/Symbol.map b/lib/libc/gen/Symbol.map
index 012c9ff11f04..0a20a41d0e20 100644
--- a/lib/libc/gen/Symbol.map
+++ b/lib/libc/gen/Symbol.map
@@ -439,9 +439,11 @@ FBSD_1.7 {
posix_spawn_file_actions_addchdir_np;
posix_spawn_file_actions_addclosefrom_np;
posix_spawn_file_actions_addfchdir_np;
+ scandirat;
sched_getaffinity;
sched_setaffinity;
sched_getcpu;
+ versionsort;
__cpuset_alloc;
__cpuset_free;
};
diff --git a/lib/libc/gen/auxv.3 b/lib/libc/gen/auxv.3
index 007e8066c791..bf09eb0286be 100644
--- a/lib/libc/gen/auxv.3
+++ b/lib/libc/gen/auxv.3
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd November 17, 2019
+.Dd September 16, 2022
.Dt ELF_AUX_INFO 3
.Os
.Sh NAME
@@ -79,6 +79,10 @@ Page size in bytes
.It AT_TIMEKEEP
Pointer to VDSO timehands (for library internal use,
.Dv sizeof(void *)).
+.It AT_USRSTACKBASE
+Top of the user stack for main thread.
+.It AT_USRSTACKLIM
+Limit for grow of the user stack for main thread.
.El
.Sh RETURN VALUES
Returns zero on success, or an error number on failure.
diff --git a/lib/libc/gen/auxv.c b/lib/libc/gen/auxv.c
index ae21d088a8d1..2f043f8814cf 100644
--- a/lib/libc/gen/auxv.c
+++ b/lib/libc/gen/auxv.c
@@ -73,6 +73,7 @@ static char *canary, *pagesizes, *execpath;
static void *ps_strings, *timekeep;
static u_long hwcap, hwcap2;
static void *fxrng_seed_version;
+static u_long usrstackbase, usrstacklim;
#ifdef __powerpc__
static int powerpc_new_auxv_format = 0;
@@ -144,6 +145,14 @@ init_aux(void)
case AT_FXRNG:
fxrng_seed_version = aux->a_un.a_ptr;
break;
+
+ case AT_USRSTACKBASE:
+ usrstackbase = aux->a_un.a_val;
+ break;
+
+ case AT_USRSTACKLIM:
+ usrstacklim = aux->a_un.a_val;
+ break;
#ifdef __powerpc__
/*
* Since AT_STACKPROT is always set, and the common
@@ -370,6 +379,26 @@ _elf_aux_info(int aux, void *buf, int buflen)
} else
res = EINVAL;
break;
+ case AT_USRSTACKBASE:
+ if (buflen == sizeof(u_long)) {
+ if (usrstackbase != 0) {
+ *(u_long *)buf = usrstackbase;
+ res = 0;
+ } else
+ res = ENOENT;
+ } else
+ res = EINVAL;
+ break;
+ case AT_USRSTACKLIM:
+ if (buflen == sizeof(u_long)) {
+ if (usrstacklim != 0) {
+ *(u_long *)buf = usrstacklim;
+ res = 0;
+ } else
+ res = ENOENT;
+ } else
+ res = EINVAL;
+ break;
default:
res = ENOENT;
break;
diff --git a/lib/libc/gen/dlopen.3 b/lib/libc/gen/dlopen.3
index 8bafb0897fd9..9cd572ef7165 100644
--- a/lib/libc/gen/dlopen.3
+++ b/lib/libc/gen/dlopen.3
@@ -326,11 +326,9 @@ triggering compiler diagnostics.
(The
.Fn dlsym
function
-returns a data pointer; in the C standard, conversions between
-data and function pointer types are undefined.
-Some compilers and
-.Xr lint 1
-utilities warn about such casts.)
+returns an object pointer; in the C standard, conversions between
+object and function pointer types are undefined.
+Some compilers and lint utilities warn about such casts.)
The precise return type of
.Fn dlfunc
is unspecified; applications must cast it to an appropriate function pointer
diff --git a/lib/libc/gen/elf_utils.c b/lib/libc/gen/elf_utils.c
index fbf3bf17082c..ed3ac843f7c3 100644
--- a/lib/libc/gen/elf_utils.c
+++ b/lib/libc/gen/elf_utils.c
@@ -28,7 +28,8 @@
* $FreeBSD$
*/
-#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/auxv.h>
#include <sys/mman.h>
#include <sys/resource.h>
#include <sys/sysctl.h>
@@ -77,19 +78,23 @@ __libc_map_stacks_exec(void)
{
int mib[2];
struct rlimit rlim;
- u_long usrstack;
+ u_long usrstack, stacksz;
size_t len;
- mib[0] = CTL_KERN;
- mib[1] = KERN_USRSTACK;
- len = sizeof(usrstack);
- if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), &usrstack, &len, NULL, 0)
- == -1)
- return;
- if (getrlimit(RLIMIT_STACK, &rlim) == -1)
- return;
- mprotect((void *)(uintptr_t)(usrstack - rlim.rlim_cur),
- rlim.rlim_cur, _rtld_get_stack_prot());
+ if (_elf_aux_info(AT_USRSTACKBASE, &usrstack, sizeof(usrstack)) != 0) {
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_USRSTACK;
+ len = sizeof(usrstack);
+ if (sysctl(mib, nitems(mib), &usrstack, &len, NULL, 0) == -1)
+ return;
+ }
+ if (_elf_aux_info(AT_USRSTACKLIM, &stacksz, sizeof(stacksz)) != 0) {
+ if (getrlimit(RLIMIT_STACK, &rlim) == -1)
+ return;
+ stacksz = rlim.rlim_cur;
+ }
+ mprotect((void *)(uintptr_t)(usrstack - stacksz), stacksz,
+ _rtld_get_stack_prot());
}
#pragma weak __pthread_map_stacks_exec
diff --git a/lib/libc/gen/ftok.3 b/lib/libc/gen/ftok.3
index b819dbd185d4..88c366a7dcf3 100644
--- a/lib/libc/gen/ftok.3
+++ b/lib/libc/gen/ftok.3
@@ -24,7 +24,7 @@
.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD$
-.Dd July 9, 2009
+.Dd November 28, 2022
.Dt FTOK 3
.Os
.Sh NAME
@@ -33,7 +33,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
-.In sys/types.h
.In sys/ipc.h
.Ft key_t
.Fn ftok "const char *path" "int id"
diff --git a/lib/libc/gen/getpagesize.3 b/lib/libc/gen/getpagesize.3
index 4c57f7474208..9c6faa88236f 100644
--- a/lib/libc/gen/getpagesize.3
+++ b/lib/libc/gen/getpagesize.3
@@ -28,7 +28,7 @@
.\" @(#)getpagesize.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd June 1, 2022
+.Dd October 17, 2022
.Dt GETPAGESIZE 3
.Os
.Sh NAME
@@ -61,6 +61,7 @@ instead.
.Sh SEE ALSO
.Xr pagesize 1 ,
.Xr sbrk 2 ,
+.Xr getpagesizes 3 ,
.Xr sysconf 3
.Sh HISTORY
The
diff --git a/lib/libc/gen/getpeereid.3 b/lib/libc/gen/getpeereid.3
index 3c99eeda37f0..ec9b60b461db 100644
--- a/lib/libc/gen/getpeereid.3
+++ b/lib/libc/gen/getpeereid.3
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd February 3, 2017
+.Dd November 28, 2022
.Dt GETPEEREID 3
.Os
.Sh NAME
@@ -34,7 +34,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
-.In sys/types.h
.In unistd.h
.Ft int
.Fn getpeereid "int s" "uid_t *euid" "gid_t *egid"
diff --git a/lib/libc/gen/getpwent.3 b/lib/libc/gen/getpwent.3
index d7043d814802..782c4f729ecd 100644
--- a/lib/libc/gen/getpwent.3
+++ b/lib/libc/gen/getpwent.3
@@ -28,7 +28,7 @@
.\" From: @(#)getpwent.3 8.2 (Berkeley) 12/11/93
.\" $FreeBSD$
.\"
-.Dd April 16, 2003
+.Dd November 28, 2022
.Dt GETPWENT 3
.Os
.Sh NAME
@@ -45,7 +45,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
-.In sys/types.h
.In pwd.h
.Ft struct passwd *
.Fn getpwent void
diff --git a/lib/libc/gen/scandir-compat11.c b/lib/libc/gen/scandir-compat11.c
index 2c86b548f1d9..fe8d34d4b7d6 100644
--- a/lib/libc/gen/scandir-compat11.c
+++ b/lib/libc/gen/scandir-compat11.c
@@ -58,8 +58,8 @@ __FBSDID("$FreeBSD$");
#define SELECT(x) select(x)
-static int freebsd11_alphasort_thunk(void *thunk, const void *p1,
- const void *p2);
+static int freebsd11_scandir_thunk_cmp(const void *p1, const void *p2,
+ void *thunk);
int
freebsd11_scandir(const char *dirname, struct freebsd11_dirent ***namelist,
@@ -116,7 +116,7 @@ freebsd11_scandir(const char *dirname, struct freebsd11_dirent ***namelist,
closedir(dirp);
if (numitems && dcomp != NULL)
qsort_r(names, numitems, sizeof(struct freebsd11_dirent *),
- &dcomp, freebsd11_alphasort_thunk);
+ freebsd11_scandir_thunk_cmp, &dcomp);
*namelist = names;
return (numitems);
@@ -141,7 +141,7 @@ freebsd11_alphasort(const struct freebsd11_dirent **d1,
}
static int
-freebsd11_alphasort_thunk(void *thunk, const void *p1, const void *p2)
+freebsd11_scandir_thunk_cmp(const void *p1, const void *p2, void *thunk)
{
int (*dc)(const struct freebsd11_dirent **, const struct
freebsd11_dirent **);
diff --git a/lib/libc/gen/scandir.3 b/lib/libc/gen/scandir.3
index 7f9891343a1a..07d8074ae592 100644
--- a/lib/libc/gen/scandir.3
+++ b/lib/libc/gen/scandir.3
@@ -28,23 +28,46 @@
.\" @(#)scandir.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd January 3, 2010
+.Dd August 23, 2022
.Dt SCANDIR 3
.Os
.Sh NAME
.Nm scandir ,
-.Nm alphasort
+.Nm scandirat ,
+.Nm scandir_b ,
+.Nm alphasort ,
+.Nm versionsort
.Nd scan a directory
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In dirent.h
.Ft int
-.Fn scandir "const char *dirname" "struct dirent ***namelist" "int \*(lp*select\*(rp\*(lpconst struct dirent *\*(rp" "int \*(lp*compar\*(rp\*(lpconst struct dirent **, const struct dirent **\*(rp"
+.Fo scandir
+.Fa "const char *dirname"
+.Fa "struct dirent ***namelist"
+.Fa "int \*(lp*select\*(rp\*(lpconst struct dirent *\*(rp"
+.Fa "int \*(lp*compar\*(rp\*(lpconst struct dirent **, const struct dirent **\*(rp"
+.Fc
+.Ft
+.Fo scandirat
+.Fa int dirfd
+.Fa "const char *dirname"
+.Fa "struct dirent ***namelist"
+.Fa "int \*(lp*select\*(rp\*(lpconst struct dirent *\*(rp"
+.Fa "int \*(lp*compar\*(rp\*(lpconst struct dirent **, const struct dirent **\*(rp"
+.Fc
.Ft int
-.Fn scandir_b "const char *dirname" "struct dirent ***namelist" "int \*(lp*select\^(rp\*(lpconst struct dirent *\*(rp" "int \*(lp^compar\*(rp\*(lpconst struct dirent **, const struct dirent **\*(rp"
+.Fo scandir_b
+.Fa "const char *dirname"
+.Fa "struct dirent ***namelist"
+.Fa "int \*(lp*select\^(rp\*(lpconst struct dirent *\*(rp"
+.Fa "int \*(lp^compar\*(rp\*(lpconst struct dirent **, const struct dirent **\*(rp"
+.Fc
.Ft int
.Fn alphasort "const struct dirent **d1" "const struct dirent **d2"
+.Ft int
+.Fn versionsort "const struct dirent **d1" "const struct dirent **d2"
.Sh DESCRIPTION
The
.Fn scandir
@@ -86,11 +109,51 @@ is a routine which can be used for the
argument to sort the array alphabetically using
.Xr strcoll 3 .
.Pp
+The
+.Fn versionsort
+function is a routine which can be used for the
+.Fa compar
+argument to sort the array naturally using
+.Xr strverscmp 3 .
+.Pp
The memory allocated for the array can be deallocated with
.Xr free 3 ,
by freeing each pointer in the array and then the array itself.
.Pp
The
+.Fn scandirat
+function is similar to
+.Fn scandir ,
+but takes an additional
+.Fa dirfd
+argument.
+If the supplied
+.Fa dirname
+is absolute, the function's behavior is identical to that of
+.Fn scandir ,
+the
+.Fa dirfd
+argument is unused.
+If
+.Fa dirname
+is relative,
+.Fa dirfd
+must be a valid file descriptor referencing a directory, in
+which case the
+.Fa dirname
+lookup is performed relative to the directory referenced by
+.Fa dirfd .
+If
+.Fa dirfd
+has the special value
+.Va AT_FDCWD ,
+then the current process directory is used as the base for
+relative lookups.
+See
+.Xr openat 2
+for additional details.
+.Pp
+The
.Fn scandir_b
function behaves in the same way as
.Fn scandir ,
@@ -103,11 +166,17 @@ Returns \-1 if the directory cannot be opened for reading or if
.Xr malloc 3
cannot allocate enough memory to hold all the data structures.
.Sh SEE ALSO
+.Xr openat 2 ,
.Xr directory 3 ,
.Xr malloc 3 ,
.Xr qsort 3 ,
.Xr strcoll 3 ,
+.Xr strverscmp 3 ,
.Xr dir 5
+.Sh STANDARDS
+The
+.Fn versionsort
+function is a GNU extension and conforms to no standard.
.Sh HISTORY
The
.Fn scandir
@@ -115,3 +184,10 @@ and
.Fn alphasort
functions appeared in
.Bx 4.2 .
+The
+.Fn scandirat
+and
+.Fn
+versionsort
+functions were added in
+.Fx 14.0 .
diff --git a/lib/libc/gen/scandir.c b/lib/libc/gen/scandir.c
index 10cd7633dac1..4f40678513dd 100644
--- a/lib/libc/gen/scandir.c
+++ b/lib/libc/gen/scandir.c
@@ -42,8 +42,10 @@ __FBSDID("$FreeBSD$");
#include "namespace.h"
#include <dirent.h>
+#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include "un-namespace.h"
#ifdef I_AM_SCANDIR_B
@@ -61,25 +63,21 @@ typedef DECLARE_BLOCK(int, select_block, const struct dirent *);
typedef DECLARE_BLOCK(int, dcomp_block, const struct dirent **,
const struct dirent **);
#else
-static int alphasort_thunk(void *thunk, const void *p1, const void *p2);
+static int scandir_thunk_cmp(const void *p1, const void *p2, void *thunk);
#endif
-int
+static int
#ifdef I_AM_SCANDIR_B
-scandir_b(const char *dirname, struct dirent ***namelist, select_block select,
+scandir_b_dirp(DIR *dirp, struct dirent ***namelist, select_block select,
dcomp_block dcomp)
#else
-scandir(const char *dirname, struct dirent ***namelist,
+scandir_dirp(DIR *dirp, struct dirent ***namelist,
int (*select)(const struct dirent *), int (*dcomp)(const struct dirent **,
- const struct dirent **))
+ const struct dirent **))
#endif
{
struct dirent *d, *p, **names = NULL;
size_t arraysz, numitems;
- DIR *dirp;
-
- if ((dirp = opendir(dirname)) == NULL)
- return(-1);
numitems = 0;
arraysz = 32; /* initial estimate of the array size */
@@ -125,7 +123,7 @@ scandir(const char *dirname, struct dirent ***namelist,
qsort_b(names, numitems, sizeof(struct dirent *), (void*)dcomp);
#else
qsort_r(names, numitems, sizeof(struct dirent *),
- &dcomp, alphasort_thunk);
+ scandir_thunk_cmp, &dcomp);
#endif
*namelist = names;
return (numitems);
@@ -138,7 +136,50 @@ fail:
return (-1);
}
+int
+#ifdef I_AM_SCANDIR_B
+scandir_b(const char *dirname, struct dirent ***namelist, select_block select,
+ dcomp_block dcomp)
+#else
+scandir(const char *dirname, struct dirent ***namelist,
+ int (*select)(const struct dirent *), int (*dcomp)(const struct dirent **,
+ const struct dirent **))
+#endif
+{
+ DIR *dirp;
+
+ dirp = opendir(dirname);
+ if (dirp == NULL)
+ return (-1);
+ return (
+#ifdef I_AM_SCANDIR_B
+ scandir_b_dirp
+#else
+ scandir_dirp
+#endif
+ (dirp, namelist, select, dcomp));
+}
+
#ifndef I_AM_SCANDIR_B
+int
+scandirat(int dirfd, const char *dirname, struct dirent ***namelist,
+ int (*select)(const struct dirent *), int (*dcomp)(const struct dirent **,
+ const struct dirent **))
+{
+ DIR *dirp;
+ int fd;
+
+ fd = _openat(dirfd, dirname, O_RDONLY | O_DIRECTORY | O_CLOEXEC);
+ if (fd == -1)
+ return (-1);
+ dirp = fdopendir(fd);
+ if (dirp == NULL) {
+ _close(fd);
+ return (-1);
+ }
+ return (scandir_dirp(dirp, namelist, select, dcomp));
+}
+
/*
* Alphabetic order comparison routine for those who want it.
* POSIX 2008 requires that alphasort() uses strcoll().
@@ -150,8 +191,15 @@ alphasort(const struct dirent **d1, const struct dirent **d2)
return (strcoll((*d1)->d_name, (*d2)->d_name));
}
+int
+versionsort(const struct dirent **d1, const struct dirent **d2)
+{
+
+ return (strverscmp((*d1)->d_name, (*d2)->d_name));
+}
+
static int
-alphasort_thunk(void *thunk, const void *p1, const void *p2)
+scandir_thunk_cmp(const void *p1, const void *p2, void *thunk)
{
int (*dc)(const struct dirent **, const struct dirent **);
diff --git a/lib/libc/gen/setproctitle.3 b/lib/libc/gen/setproctitle.3
index 1dd602ef58dc..a725977e5191 100644
--- a/lib/libc/gen/setproctitle.3
+++ b/lib/libc/gen/setproctitle.3
@@ -20,7 +20,7 @@
.\" $FreeBSD$
.\"
.\" The following requests are required for all man pages.
-.Dd November 13, 2020
+.Dd November 28, 2022
.Dt SETPROCTITLE 3
.Os
.Sh NAME
@@ -28,7 +28,6 @@
.Nm setproctitle_fast
.Nd set process title
.Sh SYNOPSIS
-.In sys/types.h
.In unistd.h
.Ft void
.Fn setproctitle "const char *fmt" "..."
diff --git a/lib/libc/gen/tcgetpgrp.3 b/lib/libc/gen/tcgetpgrp.3
index 965416e9a50e..ca07d228afab 100644
--- a/lib/libc/gen/tcgetpgrp.3
+++ b/lib/libc/gen/tcgetpgrp.3
@@ -28,7 +28,7 @@
.\" @(#)tcgetpgrp.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd June 4, 1993
+.Dd November 28, 2022
.Dt TCGETPGRP 3
.Os
.Sh NAME
@@ -37,7 +37,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
-.In sys/types.h
.In unistd.h
.Ft pid_t
.Fn tcgetpgrp "int fd"
diff --git a/lib/libc/gen/tcgetsid.3 b/lib/libc/gen/tcgetsid.3
index 60bff8d0b98a..fdf374b1aa98 100644
--- a/lib/libc/gen/tcgetsid.3
+++ b/lib/libc/gen/tcgetsid.3
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 15, 2008
+.Dd November 28, 2022
.Dt TCGETSID 3
.Os
.Sh NAME
@@ -33,7 +33,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
-.In sys/types.h
.In termios.h
.Ft pid_t
.Fn tcgetsid "int fd"
diff --git a/lib/libc/gen/tcsetpgrp.3 b/lib/libc/gen/tcsetpgrp.3
index d59dcf03f446..71d98ae1d467 100644
--- a/lib/libc/gen/tcsetpgrp.3
+++ b/lib/libc/gen/tcsetpgrp.3
@@ -28,7 +28,7 @@
.\" @(#)tcsetpgrp.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd June 4, 1993
+.Dd November 28, 2022
.Dt TCSETPGRP 3
.Os
.Sh NAME
@@ -37,7 +37,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
-.In sys/types.h
.In unistd.h
.Ft int
.Fn tcsetpgrp "int fd" "pid_t pgrp_id"
diff --git a/lib/libc/gen/tcsetsid.3 b/lib/libc/gen/tcsetsid.3
index d0f1d985753e..0b0facd69811 100644
--- a/lib/libc/gen/tcsetsid.3
+++ b/lib/libc/gen/tcsetsid.3
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd May 4, 2009
+.Dd November 28, 2022
.Dt TCSETSID 3
.Os
.Sh NAME
@@ -33,7 +33,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
-.In sys/types.h
.In termios.h
.Ft int
.Fn tcsetsid "int fd" "pid_t pid"
diff --git a/lib/libc/gen/times.c b/lib/libc/gen/times.c
index d811b553b990..985c8266a0f8 100644
--- a/lib/libc/gen/times.c
+++ b/lib/libc/gen/times.c
@@ -45,8 +45,7 @@ __FBSDID("$FreeBSD$");
#define CONVTCK(r) (r.tv_sec * CLK_TCK + r.tv_usec / (1000000 / CLK_TCK))
clock_t
-times(tp)
- struct tms *tp;
+times(struct tms *tp)
{
struct rusage ru;
struct timespec t;
diff --git a/lib/libc/net/gai_strerror.3 b/lib/libc/net/gai_strerror.3
index d948083447db..2653fc6d371a 100644
--- a/lib/libc/net/gai_strerror.3
+++ b/lib/libc/net/gai_strerror.3
@@ -18,7 +18,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd December 23, 2018
+.Dd November 2, 2022
.Dt GAI_STRERROR 3
.Os
.Sh NAME
@@ -42,7 +42,9 @@ or
The following error codes and their meaning are defined in
.In netdb.h :
.Pp
-.Bl -tag -width ".Dv EAI_BADFLAGS" -offset indent -compact
+.Bl -tag -width ".Dv EAI_ADDRFAMILY" -offset indent -compact
+.It Dv EAI_ADDRFAMILY
+Address family for hostname not supported
.It Dv EAI_AGAIN
Name could not be resolved at this time
.It Dv EAI_BADFLAGS
@@ -56,6 +58,8 @@ Non-recoverable failure in name resolution
Address family was not recognized
.It Dv EAI_MEMORY
Memory allocation failure
+.It Dv EAI_NODATA
+No address associated with hostname
.It Dv EAI_NONAME
Name does not resolve
.It Dv EAI_OVERFLOW
@@ -83,7 +87,14 @@ is out of range, an implementation-specific error message string is returned.
.Xr getaddrinfo 3 ,
.Xr getnameinfo 3
.Sh STANDARDS
-.Bl -tag -width ".It RFC 2743"
+.Bl -tag -width ".It RFC 3493"
.It RFC 3493
Basic Socket Interface Extensions for IPv6
.El
+.Pp
+EAI_ADDRFAMILY and EAI_NODATA were in previous RFCs, but not in RFC 3493.
+They are not in POSIX (IEEE Std 1003.1-2017).
+They were in
+.Fx
+before 5.2, and were re-added for 14.0.
+EAI_BADHINTS, EAI_OVERFLOW, and EAI_PROTOCOL are not in RFC 3493 or POSIX.
diff --git a/lib/libc/net/gai_strerror.c b/lib/libc/net/gai_strerror.c
index f168c3093735..276ba91b95fd 100644
--- a/lib/libc/net/gai_strerror.c
+++ b/lib/libc/net/gai_strerror.c
@@ -44,17 +44,19 @@ __FBSDID("$FreeBSD$");
#endif
#include "un-namespace.h"
-/* Entries EAI_ADDRFAMILY (1) and EAI_NODATA (7) are obsoleted, but left */
-/* for backwards compatibility with userland code prior to RFC2553bis-02 */
+/*
+ * Entries EAI_ADDRFAMILY (1) and EAI_NODATA (7) were omitted from RFC 3493,
+ * but are or may be used as extensions or in old code.
+ */
static const char *ai_errlist[] = {
"Success", /* 0 */
- "Address family for hostname not supported", /* 1: Obsolete */
+ "Address family for hostname not supported", /* EAI_ADDRFAMILY */
"Name could not be resolved at this time", /* EAI_AGAIN */
"Flags parameter had an invalid value", /* EAI_BADFLAGS */
"Non-recoverable failure in name resolution", /* EAI_FAIL */
"Address family not recognized", /* EAI_FAMILY */
"Memory allocation failure", /* EAI_MEMORY */
- "No address associated with hostname", /* 7: Obsolete*/
+ "No address associated with hostname", /* EAI_NODATA*/
"Name does not resolve", /* EAI_NONAME */
"Service was not recognized for socket type", /* EAI_SERVICE */
"Intended socket type was not recognized", /* EAI_SOCKTYPE */
diff --git a/lib/libc/net/getaddrinfo.3 b/lib/libc/net/getaddrinfo.3
index a91a26973ecb..af68f808b059 100644
--- a/lib/libc/net/getaddrinfo.3
+++ b/lib/libc/net/getaddrinfo.3
@@ -353,7 +353,7 @@ structure created by a call to
.Fn getaddrinfo .
.Sh IMPLEMENTATION NOTES
The behavior of
-.Li freeadrinfo(NULL)
+.Li freeaddrinfo(NULL)
is left unspecified by both
.St -susv4
and
diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c
index a33f240bc376..14729087b82a 100644
--- a/lib/libc/net/getaddrinfo.c
+++ b/lib/libc/net/getaddrinfo.c
@@ -1953,6 +1953,9 @@ explore_fqdn(const struct addrinfo *pai, const char *hostname,
case NS_NOTFOUND:
error = EAI_NONAME;
goto free;
+ case NS_ADDRFAMILY:
+ error = EAI_ADDRFAMILY;
+ goto free;
case NS_SUCCESS:
error = 0;
for (cur = result; cur; cur = cur->ai_next) {
@@ -2091,7 +2094,7 @@ getanswer(const querybuf *answer, int anslen, const char *qname, int qtype,
} else if (type != qtype) {
#ifdef DEBUG
if (type != T_KEY && type != T_SIG &&
- type != ns_t_dname)
+ type != T_DNAME && type != T_RRSIG)
syslog(LOG_NOTICE|LOG_AUTH,
"gethostby*.getanswer: asked for \"%s %s %s\", got type \"%s\"",
qname, p_class(C_IN), p_type(qtype),
@@ -2341,7 +2344,9 @@ _dns_getaddrinfo(void *rv, void *cb_data, va_list ap)
if (res_searchN(hostname, &q, res) < 0) {
free(buf);
free(buf2);
- return NS_NOTFOUND;
+ if (res->res_h_errno == NO_DATA)
+ return (NS_ADDRFAMILY);
+ return (NS_NOTFOUND);
}
/* prefer IPv6 */
if (q.next) {
@@ -2363,15 +2368,16 @@ _dns_getaddrinfo(void *rv, void *cb_data, va_list ap)
if (sentinel.ai_next == NULL)
switch (res->res_h_errno) {
case HOST_NOT_FOUND:
+ return (NS_NOTFOUND);
case NO_DATA:
- return NS_NOTFOUND;
+ return (NS_ADDRFAMILY);
case TRY_AGAIN:
- return NS_TRYAGAIN;
+ return (NS_TRYAGAIN);
default:
- return NS_UNAVAIL;
+ return (NS_UNAVAIL);
}
*((struct addrinfo **)rv) = sentinel.ai_next;
- return NS_SUCCESS;
+ return (NS_SUCCESS);
}
static void
diff --git a/lib/libc/net/gethostbydns.c b/lib/libc/net/gethostbydns.c
index 09800b874f90..142b67f7ace9 100644
--- a/lib/libc/net/gethostbydns.c
+++ b/lib/libc/net/gethostbydns.c
@@ -292,11 +292,14 @@ gethostanswer(const querybuf *answer, int anslen, const char *qname, int qtype,
continue;
}
if (type != qtype) {
- if (type != T_SIG && type != ns_t_dname)
+#ifdef DEBUG
+ if (type != T_KEY && type != T_SIG &&
+ type != T_DNAME && type != T_RRSIG)
syslog(LOG_NOTICE|LOG_AUTH,
"gethostby*.gethostanswer: asked for \"%s %s %s\", got type \"%s\"",
qname, p_class(C_IN), p_type(qtype),
p_type(type));
+#endif
cp += n;
continue; /* XXX - had_error++ ? */
}
diff --git a/lib/libc/net/resolver.3 b/lib/libc/net/resolver.3
index 98778f746a03..419aed603c83 100644
--- a/lib/libc/net/resolver.3
+++ b/lib/libc/net/resolver.3
@@ -28,7 +28,7 @@
.\" @(#)resolver.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd June 27, 2022
+.Dd September 15, 2022
.Dt RESOLVER 3
.Os
.Sh NAME
@@ -450,9 +450,6 @@ see
.%T RFC1034 ,
.%T RFC1035 ,
.%T RFC974
-.Rs
-.%T "Name Server Operations Guide for BIND"
-.Re
.Sh HISTORY
The
.Nm
diff --git a/lib/libc/quad/qdivrem.c b/lib/libc/quad/qdivrem.c
index ea09e7f43f16..7dd7632d39ed 100644
--- a/lib/libc/quad/qdivrem.c
+++ b/lib/libc/quad/qdivrem.c
@@ -94,7 +94,7 @@ __qdivrem(u_quad_t uq, u_quad_t vq, u_quad_t *arq)
/*
* Take care of special cases: divide by zero, and u < v.
*/
- if (vq == 0) {
+ if (__predict_false(vq == 0)) {
/* divide by zero. */
static volatile const unsigned int zero = 0;
diff --git a/lib/libc/rpc/netnamer.c b/lib/libc/rpc/netnamer.c
index 591f6d5c91e5..8062c446dffe 100644
--- a/lib/libc/rpc/netnamer.c
+++ b/lib/libc/rpc/netnamer.c
@@ -64,7 +64,7 @@ static char *NETID = "netid.byname";
static char *NETIDFILE = "/etc/netid";
static int getnetid( char *, char * );
-static int _getgroups( char *, gid_t * );
+static int _getgroups( char *, gid_t [NGRPS] );
/*
* Convert network-name into unix credential
diff --git a/lib/libc/rpc/rpcb_clnt.c b/lib/libc/rpc/rpcb_clnt.c
index f39d99bfeee3..b44fd1c5e77b 100644
--- a/lib/libc/rpc/rpcb_clnt.c
+++ b/lib/libc/rpc/rpcb_clnt.c
@@ -742,6 +742,16 @@ __rpcb_findaddr_timed(rpcprog_t program, rpcvers_t version,
struct pmap pmapparms;
/*
+ * The comment below is now very old, having
+ * been committed to FreeBSD during an import
+ * from NetBSD in 2001. I do not believe there
+ * will still be any rpcbind servers that do
+ * UDP only and, since Azure requires use of
+ * TCP for NFSv3 mounts, comment this out
+ * so that NFSv3 mounts on Azure can work.
+ */
+#ifdef notnow
+ /*
* Try UDP only - there are some portmappers out
* there that use UDP only.
*/
@@ -754,9 +764,9 @@ __rpcb_findaddr_timed(rpcprog_t program, rpcvers_t version,
}
client = getclnthandle(host, newnconf, &parms.r_addr);
freenetconfigent(newnconf);
- } else {
+ } else
+#endif
client = getclnthandle(host, nconf, &parms.r_addr);
- }
if (client == NULL)
return (NULL);
diff --git a/lib/libc/stdio/fflush.c b/lib/libc/stdio/fflush.c
index decc974907f4..f59565abd369 100644
--- a/lib/libc/stdio/fflush.c
+++ b/lib/libc/stdio/fflush.c
@@ -136,7 +136,8 @@ __sflush(FILE *fp)
fp->_p += n;
if ((fp->_flags & (__SLBF | __SNBF)) == 0)
fp->_w -= n;
- } else if (p == fp->_p) { /* cond. to handle setvbuf */
+ /* conditional to handle setvbuf */
+ } else if (p == fp->_p && errno == EINTR) {
fp->_p = old_p;
fp->_w = old_w;
}
diff --git a/lib/libc/stdio/fvwrite.c b/lib/libc/stdio/fvwrite.c
index 2a161859afa9..b1b363e6f80d 100644
--- a/lib/libc/stdio/fvwrite.c
+++ b/lib/libc/stdio/fvwrite.c
@@ -38,6 +38,7 @@ static char sccsid[] = "@(#)fvwrite.c 8.1 (Berkeley) 6/4/93";
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -140,7 +141,7 @@ __sfvwrite(FILE *fp, struct __suio *uio)
fp->_p += w;
old_p = fp->_p;
if (__fflush(fp) == EOF) {
- if (old_p == fp->_p)
+ if (old_p == fp->_p && errno == EINTR)
fp->_p -= w;
goto err;
}
@@ -184,7 +185,7 @@ __sfvwrite(FILE *fp, struct __suio *uio)
fp->_p += w;
old_p = fp->_p;
if (__fflush(fp) == EOF) {
- if (old_p == fp->_p)
+ if (old_p == fp->_p && errno == EINTR)
fp->_p -= w;
goto err;
}
diff --git a/lib/libc/stdio/setvbuf.c b/lib/libc/stdio/setvbuf.c
index 03a3c7263125..8947e61e7c29 100644
--- a/lib/libc/stdio/setvbuf.c
+++ b/lib/libc/stdio/setvbuf.c
@@ -39,6 +39,7 @@ static char sccsid[] = "@(#)setvbuf.c 8.2 (Berkeley) 11/16/93";
__FBSDID("$FreeBSD$");
#include "namespace.h"
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include "un-namespace.h"
@@ -62,7 +63,7 @@ setvbuf(FILE * __restrict fp, char * __restrict buf, int mode, size_t size)
* when setting _IONBF.
*/
if (mode != _IONBF)
- if ((mode != _IOFBF && mode != _IOLBF) || (int)size < 0)
+ if ((mode != _IOFBF && mode != _IOLBF) || size > INT_MAX)
return (EOF);
FLOCKFILE_CANCELSAFE(fp);
diff --git a/lib/libc/stdio/wbuf.c b/lib/libc/stdio/wbuf.c
index 6cd75145a271..666bbf87aadd 100644
--- a/lib/libc/stdio/wbuf.c
+++ b/lib/libc/stdio/wbuf.c
@@ -82,7 +82,7 @@ __swbuf(int c, FILE *fp)
*/
n = fp->_p - fp->_bf._base;
if (n >= fp->_bf._size) {
- if (__fflush(fp))
+ if (__fflush(fp) != 0)
return (EOF);
n = 0;
}
@@ -90,8 +90,8 @@ __swbuf(int c, FILE *fp)
*fp->_p++ = c;
old_p = fp->_p;
if (++n == fp->_bf._size || (fp->_flags & __SLBF && c == '\n')) {
- if (__fflush(fp)) {
- if (fp->_p == old_p) {
+ if (__fflush(fp) != 0) {
+ if (fp->_p == old_p && errno == EINTR) {
fp->_p--;
fp->_w++;
}
diff --git a/lib/libc/stdlib/Makefile.inc b/lib/libc/stdlib/Makefile.inc
index a658fd78e862..8ace2c051b82 100644
--- a/lib/libc/stdlib/Makefile.inc
+++ b/lib/libc/stdlib/Makefile.inc
@@ -11,8 +11,8 @@ MISRCS+=C99_Exit.c a64l.c abort.c abs.c atexit.c atof.c atoi.c atol.c atoll.c \
getsubopt.c hcreate.c hcreate_r.c hdestroy_r.c heapsort.c heapsort_b.c \
hsearch_r.c imaxabs.c imaxdiv.c \
insque.c l64a.c labs.c ldiv.c llabs.c lldiv.c lsearch.c \
- merge.c mergesort_b.c ptsname.c qsort.c qsort_r.c qsort_s.c \
- quick_exit.c radixsort.c rand.c \
+ merge.c mergesort_b.c ptsname.c qsort.c qsort_r.c qsort_r_compat.c \
+ qsort_s.c quick_exit.c radixsort.c rand.c \
random.c reallocarray.c reallocf.c realpath.c remque.c \
set_constraint_handler_s.c strfmon.c strtoimax.c \
strtol.c strtold.c strtoll.c strtoq.c strtoul.c strtonum.c strtoull.c \
diff --git a/lib/libc/stdlib/Symbol.map b/lib/libc/stdlib/Symbol.map
index 6524c6097b96..7e0b141a21b6 100644
--- a/lib/libc/stdlib/Symbol.map
+++ b/lib/libc/stdlib/Symbol.map
@@ -49,7 +49,6 @@ FBSD_1.0 {
lfind;
mergesort;
putenv;
- qsort_r;
qsort;
radixsort;
sradixsort;
@@ -130,6 +129,7 @@ FBSD_1.6 {
FBSD_1.7 {
clearenv;
+ qsort_r;
};
FBSDprivate_1.0 {
diff --git a/lib/libc/stdlib/qsort.3 b/lib/libc/stdlib/qsort.3
index 606185f9baee..6449849fc490 100644
--- a/lib/libc/stdlib/qsort.3
+++ b/lib/libc/stdlib/qsort.3
@@ -32,7 +32,7 @@
.\" @(#)qsort.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd January 20, 2020
+.Dd September 30, 2022
.Dt QSORT 3
.Os
.Sh NAME
@@ -67,8 +67,8 @@
.Fa "void *base"
.Fa "size_t nmemb"
.Fa "size_t size"
+.Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *, void *\*[rp]"
.Fa "void *thunk"
-.Fa "int \*[lp]*compar\*[rp]\*[lp]void *, const void *, const void *\*[rp]"
.Fc
.Ft int
.Fo heapsort
@@ -157,7 +157,7 @@ function behaves identically to
.Fn qsort ,
except that it takes an additional argument,
.Fa thunk ,
-which is passed unchanged as the first argument to function pointed to
+which is passed unchanged as the last argument to function pointed to
.Fa compar .
This allows the comparison function to access additional
data without using global variables, and thus
@@ -436,3 +436,9 @@ K.3.6.3.2.
The variants of these functions that take blocks as arguments first appeared in
Mac OS X.
This implementation was created by David Chisnall.
+.Pp
+In
+.Fx 14.0 ,
+the prototype of
+.Fn qsort_r
+was updated to match POSIX.
diff --git a/lib/libc/stdlib/qsort.c b/lib/libc/stdlib/qsort.c
index 0b99c04507d3..11a3c5508143 100644
--- a/lib/libc/stdlib/qsort.c
+++ b/lib/libc/stdlib/qsort.c
@@ -42,6 +42,8 @@ __FBSDID("$FreeBSD$");
#include "libc_private.h"
#if defined(I_AM_QSORT_R)
+typedef int cmp_t(const void *, const void *, void *);
+#elif defined(I_AM_QSORT_R_COMPAT)
typedef int cmp_t(void *, const void *, const void *);
#elif defined(I_AM_QSORT_S)
typedef int cmp_t(const void *, const void *, void *);
@@ -72,6 +74,8 @@ swapfunc(char *a, char *b, size_t es)
if ((n) > 0) swapfunc(a, b, n)
#if defined(I_AM_QSORT_R)
+#define CMP(t, x, y) (cmp((x), (y), (t)))
+#elif defined(I_AM_QSORT_R_COMPAT)
#define CMP(t, x, y) (cmp((t), (x), (y)))
#elif defined(I_AM_QSORT_S)
#define CMP(t, x, y) (cmp((x), (y), (t)))
@@ -81,7 +85,7 @@ swapfunc(char *a, char *b, size_t es)
static inline char *
med3(char *a, char *b, char *c, cmp_t *cmp, void *thunk
-#if !defined(I_AM_QSORT_R) && !defined(I_AM_QSORT_S)
+#if !defined(I_AM_QSORT_R) && !defined(I_AM_QSORT_R_COMPAT) && !defined(I_AM_QSORT_S)
__unused
#endif
)
@@ -97,6 +101,8 @@ __unused
*/
#if defined(I_AM_QSORT_R)
#define local_qsort local_qsort_r
+#elif defined(I_AM_QSORT_R_COMPAT)
+#define local_qsort local_qsort_r_compat
#elif defined(I_AM_QSORT_S)
#define local_qsort local_qsort_s
#endif
@@ -211,10 +217,16 @@ loop:
#if defined(I_AM_QSORT_R)
void
-qsort_r(void *a, size_t n, size_t es, void *thunk, cmp_t *cmp)
+(qsort_r)(void *a, size_t n, size_t es, cmp_t *cmp, void *thunk)
{
local_qsort_r(a, n, es, cmp, thunk);
}
+#elif defined(I_AM_QSORT_R_COMPAT)
+void
+__qsort_r_compat(void *a, size_t n, size_t es, void *thunk, cmp_t *cmp)
+{
+ local_qsort_r_compat(a, n, es, cmp, thunk);
+}
#elif defined(I_AM_QSORT_S)
errno_t
qsort_s(void *a, rsize_t n, rsize_t es, cmp_t *cmp, void *thunk)
diff --git a/lib/libc/stdlib/qsort_r.c b/lib/libc/stdlib/qsort_r.c
index f489d31c2335..d86873604f59 100644
--- a/lib/libc/stdlib/qsort_r.c
+++ b/lib/libc/stdlib/qsort_r.c
@@ -4,16 +4,5 @@
*
* $FreeBSD$
*/
-#include "block_abi.h"
#define I_AM_QSORT_R
#include "qsort.c"
-
-typedef DECLARE_BLOCK(int, qsort_block, const void *, const void *);
-
-void
-qsort_b(void *base, size_t nel, size_t width, qsort_block compar)
-{
- qsort_r(base, nel, width, compar,
- (int (*)(void *, const void *, const void *))
- GET_BLOCK_FUNCTION(compar));
-}
diff --git a/lib/libc/stdlib/qsort_r_compat.c b/lib/libc/stdlib/qsort_r_compat.c
new file mode 100644
index 000000000000..239a5f307ceb
--- /dev/null
+++ b/lib/libc/stdlib/qsort_r_compat.c
@@ -0,0 +1,21 @@
+/*
+ * This file is in the public domain. Originally written by Garrett
+ * A. Wollman.
+ *
+ * $FreeBSD$
+ */
+#include "block_abi.h"
+#define I_AM_QSORT_R_COMPAT
+#include "qsort.c"
+
+typedef DECLARE_BLOCK(int, qsort_block, const void *, const void *);
+
+void
+qsort_b(void *base, size_t nel, size_t width, qsort_block compar)
+{
+ __qsort_r_compat(base, nel, width, compar,
+ (int (*)(void *, const void *, const void *))
+ GET_BLOCK_FUNCTION(compar));
+}
+
+__sym_compat(qsort_r, __qsort_r_compat, FBSD_1.0);
diff --git a/lib/libc/stdlib/strfmon.3 b/lib/libc/stdlib/strfmon.3
index 47f7131b677c..924c82109a68 100644
--- a/lib/libc/stdlib/strfmon.3
+++ b/lib/libc/stdlib/strfmon.3
@@ -24,11 +24,12 @@
.\"
.\" $FreeBSD$
.\"
-.Dd June 25, 2012
+.Dd October 28, 2022
.Dt STRFMON 3
.Os
.Sh NAME
-.Nm strfmon
+.Nm strfmon ,
+.Nm strfmon_l
.Nd convert monetary value to string
.Sh LIBRARY
.Lb libc
@@ -98,12 +99,18 @@ By default, there is no minimum width.
A
.Sq Cm #
sign followed by a decimal number specifying the maximum
-expected number of digits after the radix character.
+expected number of digits before the radix character.
+When this option is used, values that do not exceed the
+specified number of digits are formatted so they will be
+correctly aligned with other values printed using the same
+format.
+This includes always leaving space for a possible sign
+indicator, even if none is needed for a particular value.
.It
A
.Sq Cm \&.
character followed by a decimal number specifying the number
-the number of digits after the radix character.
+of digits after the radix character.
.It
One of the following conversion specifiers:
.Bl -tag -width "XXX"
@@ -155,7 +162,8 @@ The format string is invalid.
Not enough memory for temporary buffers.
.El
.Sh SEE ALSO
-.Xr localeconv 3
+.Xr localeconv 3 ,
+.Xr xlocale 3
.Sh STANDARDS
The
.Fn strfmon
diff --git a/lib/libc/stdlib/strfmon.c b/lib/libc/stdlib/strfmon.c
index 5829dd2d801c..ba02544eb2ec 100644
--- a/lib/libc/stdlib/strfmon.c
+++ b/lib/libc/stdlib/strfmon.c
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+
#include "xlocale_private.h"
/* internal flags */
@@ -52,27 +53,27 @@ __FBSDID("$FreeBSD$");
#define SIGN_POSN_USED 0x02 /* '+' or '(' usage flag */
#define LOCALE_POSN 0x04 /* use locale defined +/- (default) */
#define PARENTH_POSN 0x08 /* enclose negative amount in () */
-#define SUPRESS_CURR_SYMBOL 0x10 /* suppress the currency from output */
+#define SUPPRESS_CURR_SYMBOL 0x10 /* suppress the currency from output */
#define LEFT_JUSTIFY 0x20 /* left justify */
#define USE_INTL_CURRENCY 0x40 /* use international currency symbol */
-#define IS_NEGATIVE 0x80 /* is argument value negative ? */
+#define IS_NEGATIVE 0x80 /* is argument value negative ? */
/* internal macros */
-#define PRINT(CH) do { \
- if (dst >= s + maxsize) \
+#define PRINT(CH) do { \
+ if (dst >= s + maxsize) \
goto e2big_error; \
*dst++ = CH; \
} while (0)
-#define PRINTS(STR) do { \
+#define PRINTS(STR) do { \
char *tmps = STR; \
while (*tmps != '\0') \
PRINT(*tmps++); \
} while (0)
-#define GET_NUMBER(VAR) do { \
+#define GET_NUMBER(VAR, LOC) do { \
VAR = 0; \
- while (isdigit((unsigned char)*fmt)) { \
+ while (isdigit_l((unsigned char)*fmt, LOC)) { \
if (VAR > INT_MAX / 10) \
goto e2big_error; \
VAR *= 10; \
@@ -83,31 +84,32 @@ __FBSDID("$FreeBSD$");
} \
} while (0)
-#define GRPCPY(howmany) do { \
+#define GRPCPY(howmany) do { \
int i = howmany; \
while (i-- > 0) { \
avalue_size--; \
- *--bufend = *(avalue+avalue_size+padded); \
+ *--bufend = *(avalue + avalue_size + padded); \
} \
} while (0)
-#define GRPSEP do { \
+#define GRPSEP do { \
bufend -= thousands_sep_size; \
memcpy(bufend, thousands_sep, thousands_sep_size); \
groups++; \
} while (0)
-static void __setup_vars(int, char *, char *, char *, char **);
-static int __calc_left_pad(int, char *);
-static char *__format_grouped_double(double, int *, int, int, int);
+static void __setup_vars(int, char *, char *, char *, char **, struct lconv *);
+static int __calc_left_pad(int, char *, struct lconv *);
+static char *__format_grouped_double(double, int *, int, int, int,
+ struct lconv *, locale_t);
static ssize_t
vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
- const char * __restrict format, va_list ap)
+ const char * __restrict format, va_list ap)
{
- char *dst; /* output destination pointer */
- const char *fmt; /* current format poistion pointer */
- struct lconv *lc; /* pointer to lconv structure */
+ char *dst; /* output destination pointer */
+ const char *fmt; /* current format poistion pointer */
+ struct lconv *lc; /* pointer to lconv structure */
char *asciivalue; /* formatted double pointer */
int flags; /* formatting options */
@@ -129,13 +131,11 @@ vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
int sverrno;
FIX_LOCALE(loc);
-
lc = localeconv_l(loc);
dst = s;
fmt = format;
asciivalue = NULL;
currency_symbol = NULL;
- pad_size = 0;
while (*fmt) {
/* pass nonformating characters AS IS */
@@ -145,7 +145,7 @@ vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
/* '%' found ! */
/* "%%" mean just '%' */
- if (*(fmt+1) == '%') {
+ if (*(fmt + 1) == '%') {
fmt++;
literal:
PRINT(*fmt++);
@@ -155,6 +155,7 @@ vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
/* set up initial values */
flags = (NEED_GROUPING|LOCALE_POSN);
pad_char = ' '; /* padding character is "space" */
+ pad_size = 0; /* no padding initially */
left_prec = -1; /* no left precision specified */
right_prec = -1; /* no right precision specified */
width = -1; /* no width specified */
@@ -182,7 +183,7 @@ vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
flags |= (SIGN_POSN_USED|PARENTH_POSN);
continue;
case '!': /* suppress currency symbol */
- flags |= SUPRESS_CURR_SYMBOL;
+ flags |= SUPPRESS_CURR_SYMBOL;
continue;
case '-': /* alignment (left) */
flags |= LEFT_JUSTIFY;
@@ -194,8 +195,8 @@ vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
}
/* field Width */
- if (isdigit((unsigned char)*fmt)) {
- GET_NUMBER(width);
+ if (isdigit_l((unsigned char)*fmt, loc)) {
+ GET_NUMBER(width, loc);
/* Do we have enough space to put number with
* required width ?
*/
@@ -205,18 +206,18 @@ vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
/* Left precision */
if (*fmt == '#') {
- if (!isdigit((unsigned char)*++fmt))
+ if (!isdigit_l((unsigned char)*++fmt, loc))
goto format_error;
- GET_NUMBER(left_prec);
+ GET_NUMBER(left_prec, loc);
if ((unsigned int)left_prec >= maxsize - (dst - s))
goto e2big_error;
}
/* Right precision */
if (*fmt == '.') {
- if (!isdigit((unsigned char)*++fmt))
+ if (!isdigit_l((unsigned char)*++fmt, loc))
goto format_error;
- GET_NUMBER(right_prec);
+ GET_NUMBER(right_prec, loc);
if ((unsigned int)right_prec >= maxsize - (dst - s) -
left_prec)
goto e2big_error;
@@ -224,7 +225,7 @@ vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
/* Conversion Characters */
switch (*fmt++) {
- case 'i': /* use internaltion currency format */
+ case 'i': /* use international currency format */
flags |= USE_INTL_CURRENCY;
break;
case 'n': /* use national currency format */
@@ -239,8 +240,11 @@ vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
free(currency_symbol);
if (flags & USE_INTL_CURRENCY) {
currency_symbol = strdup(lc->int_curr_symbol);
- if (currency_symbol != NULL)
- space_char = *(currency_symbol+3);
+ if (currency_symbol != NULL &&
+ strlen(currency_symbol) > 3) {
+ space_char = currency_symbol[3];
+ currency_symbol[3] = '\0';
+ }
} else
currency_symbol = strdup(lc->currency_symbol);
@@ -259,8 +263,8 @@ vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
/* fill left_prec with amount of padding chars */
if (left_prec >= 0) {
pad_size = __calc_left_pad((flags ^ IS_NEGATIVE),
- currency_symbol) -
- __calc_left_pad(flags, currency_symbol);
+ currency_symbol, lc) -
+ __calc_left_pad(flags, currency_symbol, lc);
if (pad_size < 0)
pad_size = 0;
}
@@ -268,14 +272,14 @@ vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
if (asciivalue != NULL)
free(asciivalue);
asciivalue = __format_grouped_double(value, &flags,
- left_prec, right_prec, pad_char);
+ left_prec, right_prec, pad_char, lc, loc);
if (asciivalue == NULL)
goto end_error; /* errno already set */
/* to ENOMEM by malloc() */
/* set some variables for later use */
__setup_vars(flags, &cs_precedes, &sep_by_space,
- &sign_posn, &signstr);
+ &sign_posn, &signstr, lc);
/*
* Description of some LC_MONETARY's values:
@@ -287,25 +291,26 @@ vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
* = 0 - symbol succeeds the value
*
* p_sep_by_space & n_sep_by_space
- *
+ *
* = 0 - no space separates $currency_symbol
* from the value for a monetary quantity with a
- * non-negative value
+ * non-negative value
* = 1 - space separates the symbol from the value
* = 2 - space separates the symbol and the sign string,
- * if adjacent.
- *
+ * if adjacent; otherwise, a space separates
+ * the sign string from the value
+ *
* p_sign_posn & n_sign_posn
- *
+ *
* = 0 - parentheses enclose the quantity and the
- * $currency_symbol
- * = 1 - the sign string precedes the quantity and the
* $currency_symbol
- * = 2 - the sign string succeeds the quantity and the
+ * = 1 - the sign string precedes the quantity and the
+ * $currency_symbol
+ * = 2 - the sign string succeeds the quantity and the
* $currency_symbol
* = 3 - the sign string precedes the $currency_symbol
* = 4 - the sign string succeeds the $currency_symbol
- *
+ *
*/
tmpptr = dst;
@@ -319,11 +324,11 @@ vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
if (cs_precedes == 1) {
if (sign_posn == 1 || sign_posn == 3) {
PRINTS(signstr);
- if (sep_by_space == 2) /* XXX: ? */
+ if (sep_by_space == 2)
PRINT(' ');
}
- if (!(flags & SUPRESS_CURR_SYMBOL)) {
+ if (!(flags & SUPPRESS_CURR_SYMBOL)) {
PRINTS(currency_symbol);
if (sign_posn == 4) {
@@ -335,8 +340,11 @@ vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
} else if (sep_by_space == 1)
PRINT(space_char);
}
- } else if (sign_posn == 1)
+ } else if (sign_posn == 1) {
PRINTS(signstr);
+ if (sep_by_space == 2)
+ PRINT(' ');
+ }
PRINTS(asciivalue);
@@ -347,7 +355,7 @@ vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
PRINTS(signstr);
}
- if (!(flags & SUPRESS_CURR_SYMBOL)) {
+ if (!(flags & SUPPRESS_CURR_SYMBOL)) {
if ((sign_posn == 3 && sep_by_space == 2)
|| (sep_by_space == 1
&& (sign_posn == 0
@@ -355,7 +363,7 @@ vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
|| sign_posn == 2
|| sign_posn == 4)))
PRINT(space_char);
- PRINTS(currency_symbol); /* XXX: len */
+ PRINTS(currency_symbol);
if (sign_posn == 4) {
if (sep_by_space == 2)
PRINT(' ');
@@ -370,19 +378,23 @@ vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
PRINTS(signstr);
}
- if (sign_posn == 0 && (flags & IS_NEGATIVE))
- PRINT(')');
+ if (sign_posn == 0) {
+ if (flags & IS_NEGATIVE)
+ PRINT(')');
+ else if (left_prec >= 0)
+ PRINT(' ');
+ }
if (dst - tmpptr < width) {
if (flags & LEFT_JUSTIFY) {
while (dst - tmpptr < width)
PRINT(' ');
} else {
- pad_size = dst-tmpptr;
- memmove(tmpptr + width-pad_size, tmpptr,
+ pad_size = dst - tmpptr;
+ memmove(tmpptr + width - pad_size, tmpptr,
pad_size);
- memset(tmpptr, ' ', width-pad_size);
- dst += width-pad_size;
+ memset(tmpptr, ' ', width - pad_size);
+ dst += width - pad_size;
}
}
}
@@ -408,37 +420,11 @@ end_error:
errno = sverrno;
return (-1);
}
-ssize_t
-strfmon_l(char * __restrict s, size_t maxsize, locale_t loc, const char * __restrict format,
- ...)
-{
- size_t ret;
- va_list ap;
- va_start(ap, format);
- ret = vstrfmon_l(s, maxsize, loc, format, ap);
- va_end(ap);
- return ret;
-}
-
-ssize_t
-strfmon(char * __restrict s, size_t maxsize, const char * __restrict format,
- ...)
-{
- size_t ret;
- va_list ap;
- va_start(ap, format);
- ret = vstrfmon_l(s, maxsize, __get_locale(), format, ap);
- va_end(ap);
- return ret;
-}
-
static void
__setup_vars(int flags, char *cs_precedes, char *sep_by_space,
- char *sign_posn, char **signstr) {
-
- struct lconv *lc = localeconv();
-
+ char *sign_posn, char **signstr, struct lconv *lc)
+{
if ((flags & IS_NEGATIVE) && (flags & USE_INTL_CURRENCY)) {
*cs_precedes = lc->int_n_cs_precedes;
*sep_by_space = lc->int_n_sep_by_space;
@@ -463,7 +449,7 @@ __setup_vars(int flags, char *cs_precedes, char *sep_by_space,
*signstr = lc->positive_sign;
}
- /* Set defult values for unspecified information. */
+ /* Set default values for unspecified information. */
if (*cs_precedes != 0)
*cs_precedes = 1;
if (*sep_by_space == CHAR_MAX)
@@ -473,12 +459,13 @@ __setup_vars(int flags, char *cs_precedes, char *sep_by_space,
}
static int
-__calc_left_pad(int flags, char *cur_symb) {
-
+__calc_left_pad(int flags, char *cur_symb, struct lconv *lc)
+{
char cs_precedes, sep_by_space, sign_posn, *signstr;
int left_chars = 0;
- __setup_vars(flags, &cs_precedes, &sep_by_space, &sign_posn, &signstr);
+ __setup_vars(flags, &cs_precedes, &sep_by_space, &sign_posn,
+ &signstr, lc);
if (cs_precedes != 0) {
left_chars += strlen(cur_symb);
@@ -487,6 +474,10 @@ __calc_left_pad(int flags, char *cur_symb) {
}
switch (sign_posn) {
+ case 0:
+ if (flags & IS_NEGATIVE)
+ left_chars++;
+ break;
case 1:
left_chars += strlen(signstr);
break;
@@ -499,8 +490,8 @@ __calc_left_pad(int flags, char *cur_symb) {
}
static int
-get_groups(int size, char *grouping) {
-
+get_groups(int size, char *grouping)
+{
int chars = 0;
if (*grouping == CHAR_MAX || *grouping <= 0) /* no grouping ? */
@@ -524,7 +515,8 @@ get_groups(int size, char *grouping) {
/* convert double to locale-encoded string */
static char *
__format_grouped_double(double value, int *flags,
- int left_prec, int right_prec, int pad_char) {
+ int left_prec, int right_prec, int pad_char, struct lconv *lc, locale_t loc)
+{
char *rslt;
char *avalue;
@@ -535,7 +527,6 @@ __format_grouped_double(double value, int *flags,
int padded;
- struct lconv *lc = localeconv();
char *grouping;
const char *decimal_point;
const char *thousands_sep;
@@ -561,10 +552,10 @@ __format_grouped_double(double value, int *flags,
/* fill right_prec with default value */
if (right_prec == -1) {
- if (*flags & USE_INTL_CURRENCY)
- right_prec = lc->int_frac_digits;
- else
- right_prec = lc->frac_digits;
+ if (*flags & USE_INTL_CURRENCY)
+ right_prec = lc->int_frac_digits;
+ else
+ right_prec = lc->frac_digits;
if (right_prec == CHAR_MAX) /* POSIX locale ? */
right_prec = 2;
@@ -574,8 +565,8 @@ __format_grouped_double(double value, int *flags,
left_prec += get_groups(left_prec, grouping);
/* convert to string */
- avalue_size = asprintf(&avalue, "%*.*f", left_prec + right_prec + 1,
- right_prec, value);
+ avalue_size = asprintf_l(&avalue, loc, "%*.*f",
+ left_prec + right_prec + 1, right_prec, value);
if (avalue_size < 0)
return (NULL);
@@ -598,7 +589,7 @@ __format_grouped_double(double value, int *flags,
if (right_prec > 0) {
bufend -= right_prec;
- memcpy(bufend, avalue + avalue_size+padded-right_prec,
+ memcpy(bufend, avalue + avalue_size + padded - right_prec,
right_prec);
bufend -= decimal_point_size;
memcpy(bufend, decimal_point, decimal_point_size);
@@ -606,7 +597,7 @@ __format_grouped_double(double value, int *flags,
}
if ((*flags & NEED_GROUPING) &&
- thousands_sep_size > 0 && /* XXX: need investigation */
+ thousands_sep_size > 0 &&
*grouping != CHAR_MAX &&
*grouping > 0) {
while (avalue_size > (int)*grouping) {
@@ -630,10 +621,9 @@ __format_grouped_double(double value, int *flags,
if (avalue_size != 0)
GRPCPY(avalue_size);
padded -= groups;
-
} else {
bufend -= avalue_size;
- memcpy(bufend, avalue+padded, avalue_size);
+ memcpy(bufend, avalue + padded, avalue_size);
/* decrease assumed $decimal_point */
if (right_prec == 0)
padded -= decimal_point_size;
@@ -650,3 +640,31 @@ __format_grouped_double(double value, int *flags,
free(avalue);
return (rslt);
}
+
+ssize_t
+strfmon(char * __restrict s, size_t maxsize, const char * __restrict format,
+ ...)
+{
+ size_t ret;
+ va_list ap;
+
+ va_start(ap, format);
+ ret = vstrfmon_l(s, maxsize, __get_locale(), format, ap);
+ va_end(ap);
+
+ return (ret);
+}
+
+ssize_t
+strfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
+ const char * __restrict format, ...)
+{
+ size_t ret;
+ va_list ap;
+
+ va_start(ap, format);
+ ret = vstrfmon_l(s, maxsize, loc, format, ap);
+ va_end(ap);
+
+ return (ret);
+}
diff --git a/lib/libc/string/Makefile.inc b/lib/libc/string/Makefile.inc
index 1df3d40e329f..afc113eeb867 100644
--- a/lib/libc/string/Makefile.inc
+++ b/lib/libc/string/Makefile.inc
@@ -16,7 +16,7 @@ MISRCS+=bcmp.c bcopy.c bzero.c explicit_bzero.c \
strcspn.c strdup.c strerror.c strlcat.c strlcpy.c strlen.c strmode.c \
strncat.c strncmp.c strncpy.c strndup.c strnlen.c strnstr.c \
strpbrk.c strrchr.c strsep.c strsignal.c strspn.c strstr.c strtok.c \
- strxfrm.c swab.c \
+ strverscmp.c strxfrm.c swab.c \
timingsafe_bcmp.c \
timingsafe_memcmp.c \
wcpcpy.c wcpncpy.c wcscasecmp.c wcscat.c \
@@ -46,7 +46,7 @@ MAN+= bcmp.3 bcopy.3 bstring.3 bzero.3 ffs.3 index.3 memccpy.3 memchr.3 \
memcmp.3 memcpy.3 memmem.3 memmove.3 memset.3 strcasecmp.3 strcat.3 \
strchr.3 strcmp.3 strcoll.3 strcpy.3 strdup.3 strerror.3 \
string.3 strlcpy.3 strlen.3 strmode.3 strpbrk.3 strsep.3 \
- strspn.3 strstr.3 strtok.3 strxfrm.3 swab.3 \
+ strspn.3 strstr.3 strtok.3 strverscmp.3 strxfrm.3 swab.3 \
timingsafe_bcmp.3 \
wcscoll.3 wcstok.3 \
wcswidth.3 wcsxfrm.3 wmemchr.3
diff --git a/lib/libc/string/Symbol.map b/lib/libc/string/Symbol.map
index ec45d7fd7ddb..4fcd194bafd8 100644
--- a/lib/libc/string/Symbol.map
+++ b/lib/libc/string/Symbol.map
@@ -116,6 +116,7 @@ FBSD_1.6 {
FBSD_1.7 {
mempcpy;
+ strverscmp;
wmempcpy;
};
diff --git a/lib/libc/string/strverscmp.3 b/lib/libc/string/strverscmp.3
new file mode 100644
index 000000000000..e4413fb96e36
--- /dev/null
+++ b/lib/libc/string/strverscmp.3
@@ -0,0 +1,56 @@
+.\" SPDX-License-Identifier: BSD-2-Clause
+.\" Copyright (c) 2022 Aymeric Wibo <obiwac@gmail.com>
+.Dd July 11, 2022
+.Dt STRVERSCMP 3
+.Os
+.Sh NAME
+.Nm strverscmp
+.Nd compare strings according to natural order
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In string.h
+.Ft int
+.Fn strverscmp "const char *s1" "const char *s2"
+.Sh DESCRIPTION
+The
+.Fn strverscmp
+function
+compares the null-terminated strings
+.Fa s1
+and
+.Fa s2
+according to their natural order
+and returns an integer greater than, equal to, or less than 0,
+depending on whether
+.Fa s1
+is greater than, equal to, or less than
+.Fa s2 .
+.Pp
+More specifically, this natural order is found by iterating over both
+strings until a difference is found.
+If the difference is between non-decimal characters,
+.Fn strverscmp
+acts like
+.Xr strcmp 3
+(thus, the ordering would be "a", "b", "train").
+If a decimal digit is found, the whole number is read and compared
+(thus, the ordering would be "9", "10", "420" which is different to lexicographic order,
+what
+.Xr strcmp 3
+would have done).
+Numbers with leading zeroes are interpreted as fractional parts (even without a decimal point),
+and numbers with more leading zeroes are placed before numbers with fewer leading zeroes
+(thus, the ordering would be "000", "00", "01", "010", "09", "0", "1", "9", "10").
+.Sh SEE ALSO
+.Xr strcmp 3 ,
+.Xr versionsort 3
+.Sh STANDARDS
+The
+.Fn strverscmp
+function is a GNU extension and conforms to no standard.
+.Sh HISTORY
+The
+.Fn strverscmp
+function was added in
+.Fx 14.0 .
diff --git a/lib/libc/string/strverscmp.c b/lib/libc/string/strverscmp.c
new file mode 100644
index 000000000000..6051adb35499
--- /dev/null
+++ b/lib/libc/string/strverscmp.c
@@ -0,0 +1,91 @@
+/*-
+* SPDX-License-Identifier: BSD-2-Clause
+* Copyright (c) 2022 Aymeric Wibo <obiwac@gmail.com>
+*/
+
+#include <ctype.h>
+#include <stddef.h>
+
+int
+strverscmp(const char *s1, const char *s2)
+{
+ size_t digit_count_1, digit_count_2;
+ size_t zeros_count_1, zeros_count_2;
+ const unsigned char *num_1, *num_2;
+ const unsigned char *u1 = __DECONST(const unsigned char *, s1);
+ const unsigned char *u2 = __DECONST(const unsigned char *, s2);
+
+ /*
+ * If pointers are the same, no need to go through to process of
+ * comparing them.
+ */
+ if (s1 == s2)
+ return (0);
+
+ while (*u1 != '\0' && *u2 != '\0') {
+ /* If either character is not a digit, act like strcmp(3). */
+
+ if (!isdigit(*u1) || !isdigit(*u2)) {
+ if (*u1 != *u2)
+ return (*u1 - *u2);
+ u1++;
+ u2++;
+ continue;
+ }
+ if (*u1 == '0' || *u2 == '0') {
+ /*
+ * Treat leading zeros as if they were the fractional
+ * part of a number, i.e. as if they had a decimal point
+ * in front. First, count the leading zeros (more zeros
+ * == smaller number).
+ */
+ zeros_count_1 = 0;
+ zeros_count_2 = 0;
+ for (; *u1 == '0'; u1++)
+ zeros_count_1++;
+ for (; *u2 == '0'; u2++)
+ zeros_count_2++;
+ if (zeros_count_1 != zeros_count_2)
+ return (zeros_count_2 - zeros_count_1);
+
+ /* Handle the case where 0 < 09. */
+ if (!isdigit(*u1) && isdigit(*u2))
+ return (1);
+ if (!isdigit(*u2) && isdigit(*u1))
+ return (-1);
+ } else {
+ /*
+ * No leading zeros; we're simply comparing two numbers.
+ * It is necessary to first count how many digits there
+ * are before going back to compare each digit, so that
+ * e.g. 7 is not considered larger than 60.
+ */
+ num_1 = u1;
+ num_2 = u2;
+
+ /* Count digits (more digits == larger number). */
+ for (; isdigit(*u1); u1++)
+ ;
+ for (; isdigit(*u2); u2++)
+ ;
+ digit_count_1 = u1 - num_1;
+ digit_count_2 = u2 - num_2;
+ if (digit_count_1 != digit_count_2)
+ return (digit_count_1 - digit_count_2);
+
+ /*
+ * If there are the same number of digits, go back to
+ * the start of the number.
+ */
+ u1 = num_1;
+ u2 = num_2;
+ }
+
+ /* Compare each digit until there are none left. */
+ for (; isdigit(*u1) && isdigit(*u2); u1++, u2++) {
+ if (*u1 != *u2)
+ return (*u1 - *u2);
+ }
+ }
+ return (*u1 - *u2);
+}
diff --git a/lib/libc/sys/getsockopt.2 b/lib/libc/sys/getsockopt.2
index 3ff971a0e5db..c44c32ed2579 100644
--- a/lib/libc/sys/getsockopt.2
+++ b/lib/libc/sys/getsockopt.2
@@ -214,14 +214,14 @@ This option permits multiple instances of a program to each
receive UDP/IP multicast or broadcast datagrams destined for the bound port.
.Pp
.Dv SO_REUSEPORT_LB
-allows completely duplicate bindings by multiple processes
+allows completely duplicate bindings by multiple sockets
if they all set
.Dv SO_REUSEPORT_LB
before binding the port.
-Incoming TCP and UDP connections are distributed among the sharing
-processes based on a hash function of local port number, foreign IP
+Incoming TCP and UDP connections are distributed among the participating
+listening sockets based on a hash function of local port number, and foreign IP
address and port number.
-A maximum of 256 processes can share one socket.
+A maximum of 256 sockets can be bound to the same load-balancing group.
.Pp
.Dv SO_KEEPALIVE
enables the
diff --git a/lib/libc/sys/ktrace.2 b/lib/libc/sys/ktrace.2
index ffe967e35ed8..785d6395e029 100644
--- a/lib/libc/sys/ktrace.2
+++ b/lib/libc/sys/ktrace.2
@@ -28,7 +28,7 @@
.\" @(#)ktrace.2 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd March 30, 2020
+.Dd November 2, 2022
.Dt KTRACE 2
.Os
.Sh NAME
@@ -96,6 +96,7 @@ generate much output).
.It KTRFAC_CAPFAIL Ta "Trace capability failures."
.It KTRFAC_FAULT Ta "Trace page faults."
.It KTRFAC_FAULTEND Ta "Trace the end of page faults."
+.It KTRFAC_STRUCT_ARRAY Ta "Trace arrays of certain data structures."
.It KTRFAC_INHERIT Ta "Inherit tracing to future children."
.El
.Pp
@@ -109,7 +110,7 @@ struct ktr_header {
pid_t ktr_pid; /* process id */
char ktr_comm[MAXCOMLEN+1]; /* command name */
struct timeval ktr_time; /* timestamp */
- intptr_t ktr_tid; /* was ktr_buffer */
+ long ktr_tid; /* thread id */
};
.Ed
.Pp
diff --git a/lib/libc/sys/socket.2 b/lib/libc/sys/socket.2
index b23d207c9730..1eceabbf6fd4 100644
--- a/lib/libc/sys/socket.2
+++ b/lib/libc/sys/socket.2
@@ -28,7 +28,7 @@
.\" From: @(#)socket.2 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd August 19, 2018
+.Dd August 30, 2022
.Dt SOCKET 2
.Os
.Sh NAME
@@ -60,15 +60,13 @@ PF_LOCAL Host-internal protocols (alias for PF_UNIX),
PF_UNIX Host-internal protocols,
PF_INET Internet version 4 protocols,
PF_INET6 Internet version 6 protocols,
+PF_DIVERT Firewall packet diversion/re-injection,
PF_ROUTE Internal routing protocol,
-PF_LINK Link layer interface,
PF_KEY Internal key-management function,
-PF_NATM Asynchronous transfer mode protocols,
PF_NETGRAPH Netgraph sockets,
-PF_IEEE80211 IEEE 802.11 wireless link-layer protocols (WiFi),
PF_BLUETOOTH Bluetooth protocols,
PF_INET_SDP OFED socket direct protocol (IPv4),
-PF_INET6_SDP OFED socket direct protocol (IPv6)
+AF_HYPERV HyperV sockets
.Ed
.Pp
Each protocol family is connected to an address family, which has the
@@ -90,7 +88,6 @@ defined types are:
SOCK_STREAM Stream socket,
SOCK_DGRAM Datagram socket,
SOCK_RAW Raw-protocol interface,
-SOCK_RDM Reliably-delivered packet,
SOCK_SEQPACKET Sequenced packet stream
.Ed
.Pp
@@ -113,12 +110,12 @@ an entire packet with each read system call.
This facility may have protocol-specific properties.
.Dv SOCK_RAW
sockets provide access to internal network protocols and interfaces.
-The types
-.Dv SOCK_RAW ,
-which is available only to the super-user, and
-.Dv SOCK_RDM ,
-which is planned,
-but not yet implemented, are not described here.
+The
+.Dv SOCK_RAW
+type is available only to the super-user and is described in
+.Xr ip 4
+and
+.Xr ip6 4 .
.Pp
Additionally, the following flags are allowed in the
.Fa type
@@ -287,10 +284,13 @@ The socket type is not supported by the protocol.
.Xr accept 2 ,
.Xr bind 2 ,
.Xr connect 2 ,
+.Xr divert 4 ,
.Xr getpeername 2 ,
.Xr getsockname 2 ,
.Xr getsockopt 2 ,
.Xr ioctl 2 ,
+.Xr ip 4 ,
+.Xr ip6 4 ,
.Xr listen 2 ,
.Xr read 2 ,
.Xr recv 2 ,
diff --git a/lib/libc/sys/thr_new.2 b/lib/libc/sys/thr_new.2
index 5516dd1ae4ac..ef6722b54e58 100644
--- a/lib/libc/sys/thr_new.2
+++ b/lib/libc/sys/thr_new.2
@@ -213,11 +213,11 @@ scheduling policy.
Creation of the new thread would exceed the
.Dv RACCT_NTHR
limit, see
-.Xr racct 2 .
+.Xr rctl_get_racct 2 .
.It Bq Er EPROCLIM
Creation of the new thread would exceed the
.Dv kern.threads.max_threads_per_proc
-.Xr sysctl 2
+.Xr sysctl 3
limit.
.It Bq Er ENOMEM
There was not enough kernel memory to allocate the new thread structures.
@@ -226,7 +226,7 @@ There was not enough kernel memory to allocate the new thread structures.
.Xr ps 1 ,
.Xr _umtx_op 2 ,
.Xr execve 2 ,
-.Xr racct 2 ,
+.Xr rctl_get_racct 2 ,
.Xr thr_exit 2 ,
.Xr thr_kill 2 ,
.Xr thr_kill2 2 ,
diff --git a/lib/libc/tests/locale/c16rtomb_test.c b/lib/libc/tests/locale/c16rtomb_test.c
index ea1f64f7d308..7356e69f82f6 100644
--- a/lib/libc/tests/locale/c16rtomb_test.c
+++ b/lib/libc/tests/locale/c16rtomb_test.c
@@ -127,6 +127,9 @@ ATF_TC_WITHOUT_HEAD(c16rtomb_utf_8_test);
ATF_TC_BODY(c16rtomb_utf_8_test, tc)
{
+ if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false))
+ atf_tc_skip("https://bugs.freebsd.org/265871");
+
require_lc_ctype("en_US.UTF-8");
/* Unicode character 'Pile of poo'. */
diff --git a/lib/libc/tests/stdlib/Makefile b/lib/libc/tests/stdlib/Makefile
index ffba83443a9e..e4c0cfea73fe 100644
--- a/lib/libc/tests/stdlib/Makefile
+++ b/lib/libc/tests/stdlib/Makefile
@@ -7,6 +7,10 @@ ATF_TESTS_C+= dynthr_test
ATF_TESTS_C+= heapsort_test
ATF_TESTS_C+= mergesort_test
ATF_TESTS_C+= qsort_test
+.if ${COMPILER_TYPE} == "clang"
+ATF_TESTS_C+= qsort_b_test
+.endif
+ATF_TESTS_C+= qsort_r_compat_test
ATF_TESTS_C+= qsort_r_test
ATF_TESTS_C+= qsort_s_test
ATF_TESTS_C+= set_constraint_handler_s_test
@@ -59,6 +63,12 @@ CXXSTD.cxa_thread_atexit_test= c++11
CXXSTD.cxa_thread_atexit_nothr_test= c++11
LIBADD.cxa_thread_atexit_test+= pthread
+# Tests that requires Blocks feature
+.for t in qsort_b_test
+CFLAGS.${t}.c+= -fblocks
+LIBADD.${t}+= BlocksRuntime
+.endfor
+
.for t in h_getopt h_getopt_long
CFLAGS.$t+= -I${LIBNETBSD_SRCDIR} -I${SRCTOP}/contrib/netbsd-tests
LDFLAGS.$t+= -L${LIBNETBSD_OBJDIR}
diff --git a/lib/libc/tests/stdlib/qsort_b_test.c b/lib/libc/tests/stdlib/qsort_b_test.c
new file mode 100644
index 000000000000..60cd30ac222a
--- /dev/null
+++ b/lib/libc/tests/stdlib/qsort_b_test.c
@@ -0,0 +1,76 @@
+/*-
+ * Copyright (C) 2004 Maxim Sobolev <sobomax@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Test for qsort_b() routine.
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "test-sort.h"
+
+ATF_TC_WITHOUT_HEAD(qsort_b_test);
+ATF_TC_BODY(qsort_b_test, tc)
+{
+ int testvector[IVEC_LEN];
+ int sresvector[IVEC_LEN];
+ int i, j;
+
+ for (j = 2; j < IVEC_LEN; j++) {
+ /* Populate test vectors */
+ for (i = 0; i < j; i++)
+ testvector[i] = sresvector[i] = initvector[i];
+
+ /* Sort using qsort_b(3) */
+ qsort_b(testvector, j, sizeof(testvector[0]),
+ ^(const void* a, const void* b) {
+ if (*(int *)a > *(int *)b)
+ return (1);
+ else if (*(int *)a < *(int *)b)
+ return (-1);
+ else
+ return (0);
+ });
+ /* Sort using reference slow sorting routine */
+ ssort(sresvector, j);
+
+ /* Compare results */
+ for (i = 0; i < j; i++)
+ ATF_CHECK_MSG(testvector[i] == sresvector[i],
+ "item at index %d didn't match: %d != %d",
+ i, testvector[i], sresvector[i]);
+ }
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+ ATF_TP_ADD_TC(tp, qsort_b_test);
+
+ return (atf_no_error());
+}
diff --git a/lib/libc/tests/stdlib/qsort_r_compat_test.c b/lib/libc/tests/stdlib/qsort_r_compat_test.c
new file mode 100644
index 000000000000..84fd1b116b82
--- /dev/null
+++ b/lib/libc/tests/stdlib/qsort_r_compat_test.c
@@ -0,0 +1,92 @@
+/*-
+ * Copyright (C) 2020 Edward Tomasz Napierala <trasz@FreeBSD.org>
+ * Copyright (C) 2004 Maxim Sobolev <sobomax@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Test for historical qsort_r(3) routine.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "test-sort.h"
+
+#define THUNK 42
+
+static int
+sorthelp_r(void *thunk, const void *a, const void *b)
+{
+ const int *oa, *ob;
+
+ ATF_REQUIRE_EQ(*(int *)thunk, THUNK);
+
+ oa = a;
+ ob = b;
+ /* Don't use "return *oa - *ob" since it's easy to cause overflow! */
+ if (*oa > *ob)
+ return (1);
+ if (*oa < *ob)
+ return (-1);
+ return (0);
+}
+
+ATF_TC_WITHOUT_HEAD(qsort_r_compat_test);
+ATF_TC_BODY(qsort_r_compat_test, tc)
+{
+ int testvector[IVEC_LEN];
+ int sresvector[IVEC_LEN];
+ int i, j;
+ int thunk = THUNK;
+
+ for (j = 2; j < IVEC_LEN; j++) {
+ /* Populate test vectors */
+ for (i = 0; i < j; i++)
+ testvector[i] = sresvector[i] = initvector[i];
+
+ /* Sort using qsort_r(3) */
+ qsort_r(testvector, j, sizeof(testvector[0]), &thunk,
+ sorthelp_r);
+ /* Sort using reference slow sorting routine */
+ ssort(sresvector, j);
+
+ /* Compare results */
+ for (i = 0; i < j; i++)
+ ATF_CHECK_MSG(testvector[i] == sresvector[i],
+ "item at index %d didn't match: %d != %d",
+ i, testvector[i], sresvector[i]);
+ }
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+ ATF_TP_ADD_TC(tp, qsort_r_compat_test);
+
+ return (atf_no_error());
+}
diff --git a/lib/libc/tests/stdlib/qsort_r_test.c b/lib/libc/tests/stdlib/qsort_r_test.c
index c27e6d92d587..c55563eaea8a 100644
--- a/lib/libc/tests/stdlib/qsort_r_test.c
+++ b/lib/libc/tests/stdlib/qsort_r_test.c
@@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$");
#define THUNK 42
static int
-sorthelp_r(void *thunk, const void *a, const void *b)
+sorthelp_r(const void *a, const void *b, void *thunk)
{
const int *oa, *ob;
@@ -70,8 +70,8 @@ ATF_TC_BODY(qsort_r_test, tc)
testvector[i] = sresvector[i] = initvector[i];
/* Sort using qsort_r(3) */
- qsort_r(testvector, j, sizeof(testvector[0]), &thunk,
- sorthelp_r);
+ qsort_r(testvector, j, sizeof(testvector[0]), sorthelp_r,
+ &thunk);
/* Sort using reference slow sorting routine */
ssort(sresvector, j);
diff --git a/lib/libc/tests/stdlib/strfmon_test.c b/lib/libc/tests/stdlib/strfmon_test.c
index 35825ec31b5b..224b3f44911e 100644
--- a/lib/libc/tests/stdlib/strfmon_test.c
+++ b/lib/libc/tests/stdlib/strfmon_test.c
@@ -10,7 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -27,6 +27,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <sys/param.h>
+
#include <locale.h>
#include <monetary.h>
#include <stdio.h>
@@ -53,19 +55,201 @@ ATF_TC_BODY(strfmon_locale_thousands, tc)
atf_tc_skip("multi-byte thousands-separator not found");
n = 1234.56;
- strfmon(actual, sizeof(actual), "%i", n);
+ strfmon(actual, sizeof(actual) - 1, "%i", n);
strcpy(expected, "1");
strlcat(expected, ts, sizeof(expected));
strlcat(expected, "234", sizeof(expected));
- /* We're just testing the thousands separator, not all of strmon. */
+ /* We're just testing the thousands separator, not all of strfmon. */
actual[strlen(expected)] = '\0';
ATF_CHECK_STREQ(expected, actual);
}
+ATF_TC_WITHOUT_HEAD(strfmon_examples);
+ATF_TC_BODY(strfmon_examples, tc)
+{
+ const struct {
+ const char *format;
+ const char *expected;
+ } tests[] = {
+ { "%n", "[$123.45] [-$123.45] [$3,456.78]" },
+ { "%11n", "[ $123.45] [ -$123.45] [ $3,456.78]" },
+ { "%#5n", "[ $ 123.45] [-$ 123.45] [ $ 3,456.78]" },
+ { "%=*#5n", "[ $***123.45] [-$***123.45] [ $*3,456.78]" },
+ { "%=0#5n", "[ $000123.45] [-$000123.45] [ $03,456.78]" },
+ { "%^#5n", "[ $ 123.45] [-$ 123.45] [ $ 3456.78]" },
+ { "%^#5.0n", "[ $ 123] [-$ 123] [ $ 3457]" },
+ { "%^#5.4n", "[ $ 123.4500] [-$ 123.4500] [ $ 3456.7810]" },
+ { "%(#5n", "[ $ 123.45 ] [($ 123.45)] [ $ 3,456.78 ]" },
+ { "%!(#5n", "[ 123.45 ] [( 123.45)] [ 3,456.78 ]" },
+ { "%-14#5.4n", "[ $ 123.4500 ] [-$ 123.4500 ] [ $ 3,456.7810 ]" },
+ { "%14#5.4n", "[ $ 123.4500] [ -$ 123.4500] [ $ 3,456.7810]" },
+ };
+ size_t i;
+ char actual[100], format[50];
+
+ if (setlocale(LC_MONETARY, "en_US.UTF-8") == NULL)
+ atf_tc_skip("unable to setlocale()");
+
+ for (i = 0; i < nitems(tests); ++i) {
+ snprintf(format, sizeof(format), "[%s] [%s] [%s]",
+ tests[i].format, tests[i].format, tests[i].format);
+ strfmon(actual, sizeof(actual) - 1, format,
+ 123.45, -123.45, 3456.781);
+ ATF_CHECK_STREQ_MSG(tests[i].expected, actual,
+ "[%s]", tests[i].format);
+ }
+}
+
+ATF_TC(strfmon_cs_precedes_0);
+ATF_TC_HEAD(strfmon_cs_precedes_0, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "sep_by_space x sign_posn when cs_precedes = 0");
+}
+ATF_TC_BODY(strfmon_cs_precedes_0, tc)
+{
+ const struct {
+ const char *expected;
+ } tests[] = {
+ /* sep_by_space x sign_posn */
+ { "[(123.00$)] [-123.00$] [123.00$-] [123.00-$] [123.00$-]" },
+ { "[(123.00 $)] [-123.00 $] [123.00 $-] [123.00 -$] [123.00 $-]" },
+ { "[(123.00$)] [- 123.00$] [123.00$ -] [123.00- $] [123.00$ -]" },
+ };
+ size_t i, j;
+ struct lconv *lc;
+ char actual[100], buf[100];
+
+ if (setlocale(LC_MONETARY, "en_US.UTF-8") == NULL)
+ atf_tc_skip("unable to setlocale()");
+
+ lc = localeconv();
+ lc->n_cs_precedes = 0;
+
+ for (i = 0; i < nitems(tests); ++i) {
+ actual[0] = '\0';
+ lc->n_sep_by_space = i;
+
+ for (j = 0; j < 5; ++j) {
+ lc->n_sign_posn = j;
+
+ strfmon(buf, sizeof(buf) - 1, "[%n] ", -123.0);
+ strlcat(actual, buf, sizeof(actual));
+ }
+
+ actual[strlen(actual) - 1] = '\0';
+ ATF_CHECK_STREQ_MSG(tests[i].expected, actual,
+ "sep_by_space = %zu", i);
+ }
+}
+
+ATF_TC(strfmon_cs_precedes_1);
+ATF_TC_HEAD(strfmon_cs_precedes_1, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "sep_by_space x sign_posn when cs_precedes = 1");
+}
+ATF_TC_BODY(strfmon_cs_precedes_1, tc)
+{
+ const struct {
+ const char *expected;
+ } tests[] = {
+ /* sep_by_space x sign_posn */
+ { "[($123.00)] [-$123.00] [$123.00-] [-$123.00] [$-123.00]" },
+ { "[($ 123.00)] [-$ 123.00] [$ 123.00-] [-$ 123.00] [$- 123.00]" },
+ { "[($123.00)] [- $123.00] [$123.00 -] [- $123.00] [$ -123.00]" },
+ };
+ size_t i, j;
+ struct lconv *lc;
+ char actual[100], buf[100];
+
+ if (setlocale(LC_MONETARY, "en_US.UTF-8") == NULL)
+ atf_tc_skip("unable to setlocale()");
+
+ lc = localeconv();
+ lc->n_cs_precedes = 1;
+
+ for (i = 0; i < nitems(tests); ++i) {
+ actual[0] = '\0';
+ lc->n_sep_by_space = i;
+
+ for (j = 0; j < 5; ++j) {
+ lc->n_sign_posn = j;
+
+ strfmon(buf, sizeof(buf) - 1, "[%n] ", -123.0);
+ strlcat(actual, buf, sizeof(actual));
+ }
+
+ actual[strlen(actual) - 1] = '\0';
+ ATF_CHECK_STREQ_MSG(tests[i].expected, actual,
+ "sep_by_space = %zu", i);
+ }
+}
+
+ATF_TC_WITHOUT_HEAD(strfmon_international_currency_code);
+ATF_TC_BODY(strfmon_international_currency_code, tc)
+{
+ const struct {
+ const char *locale;
+ const char *expected;
+ } tests[] = {
+ { "en_US.UTF-8", "[USD123.45]" },
+ { "de_DE.UTF-8", "[123,45 EUR]" },
+ { "C", "[123.45]" },
+ };
+ size_t i;
+ char actual[100];
+
+ for (i = 0; i < nitems(tests); ++i) {
+ if (setlocale(LC_MONETARY, tests[i].locale) == NULL)
+ atf_tc_skip("unable to setlocale()");
+
+ strfmon(actual, sizeof(actual) - 1, "[%i]", 123.45);
+ ATF_CHECK_STREQ(tests[i].expected, actual);
+ }
+}
+
+ATF_TC(strfmon_l);
+ATF_TC_HEAD(strfmon_l, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "checks strfmon_l under different locales");
+}
+ATF_TC_BODY(strfmon_l, tc)
+{
+ const struct {
+ const char *locale;
+ const char *expected;
+ } tests[] = {
+ { "C", "[ **1234.57 ] [ **1234.57 ]" },
+ { "de_DE.UTF-8", "[ **1234,57 €] [ **1.234,57 EUR]" },
+ { "en_GB.UTF-8", "[ £**1234.57] [ GBP**1,234.57]" },
+ };
+ locale_t loc;
+ size_t i;
+ char buf[100];
+
+ for (i = 0; i < nitems(tests); ++i) {
+ loc = newlocale(LC_MONETARY_MASK, tests[i].locale, NULL);
+ ATF_REQUIRE(loc != NULL);
+
+ strfmon_l(buf, sizeof(buf) - 1, loc, "[%^=*#6n] [%=*#6i]",
+ 1234.567, 1234.567);
+ ATF_REQUIRE_STREQ(tests[i].expected, buf);
+
+ freelocale(loc);
+ }
+}
+
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, strfmon_locale_thousands);
+ ATF_TP_ADD_TC(tp, strfmon_examples);
+ ATF_TP_ADD_TC(tp, strfmon_cs_precedes_0);
+ ATF_TP_ADD_TC(tp, strfmon_cs_precedes_1);
+ ATF_TP_ADD_TC(tp, strfmon_international_currency_code);
+ ATF_TP_ADD_TC(tp, strfmon_l);
return (atf_no_error());
}
diff --git a/lib/libc/tests/string/Makefile b/lib/libc/tests/string/Makefile
index c6a98572564d..eacf7e15c27c 100644
--- a/lib/libc/tests/string/Makefile
+++ b/lib/libc/tests/string/Makefile
@@ -4,10 +4,11 @@ ATF_TESTS_C+= memcmp_test
ATF_TESTS_C+= memset_s_test
ATF_TESTS_C+= stpncpy_test
ATF_TESTS_C+= strerror2_test
-ATF_TESTS_C+= wcscasecmp_test
-ATF_TESTS_C+= wcsnlen_test
+ATF_TESTS_C+= strverscmp_test
ATF_TESTS_C+= strxfrm_test
+ATF_TESTS_C+= wcscasecmp_test
ATF_TESTS_C+= wcscoll_test
+ATF_TESTS_C+= wcsnlen_test
# TODO: popcount, stresep
diff --git a/lib/libc/tests/string/strverscmp_test.c b/lib/libc/tests/string/strverscmp_test.c
new file mode 100644
index 000000000000..fd6a2620cb48
--- /dev/null
+++ b/lib/libc/tests/string/strverscmp_test.c
@@ -0,0 +1,93 @@
+/*-
+* SPDX-License-Identifier: BSD-2-Clause
+* Copyright (c) 2022 Aymeric Wibo <obiwac@gmail.com>
+*/
+
+#include <atf-c.h>
+#include <string.h>
+
+static void
+check_all(size_t len, const char *ordered[len])
+{
+ const char *a, *b;
+
+ for (size_t i = 0; i < len; i++) {
+ for (size_t j = 0; j < len; j++) {
+ a = ordered[i];
+ b = ordered[j];
+
+ if (i == j)
+ ATF_CHECK_MSG(
+ strverscmp(a, b) == 0,
+ "strverscmp(\"%s\", \"%s\") == 0",
+ a, b
+ );
+ else if (i < j)
+ ATF_CHECK_MSG(
+ strverscmp(a, b) < 0,
+ "strverscmp(\"%s\", \"%s\") < 0",
+ a, b
+ );
+ else if (i > j)
+ ATF_CHECK_MSG(
+ strverscmp(a, b) > 0,
+ "strverscmp(\"%s\", \"%s\") > 0",
+ a, b
+ );
+ }
+ }
+}
+
+#define CHECK_ALL(...) do { \
+ const char *ordered[] = { __VA_ARGS__ }; \
+ check_all(sizeof(ordered) / sizeof(*ordered), ordered); \
+} while (0)
+
+ATF_TC_WITHOUT_HEAD(strcmp_functionality);
+ATF_TC_BODY(strcmp_functionality, tc)
+{
+ CHECK_ALL("", "a", "b");
+}
+
+/* from Linux man page strverscmp(3) */
+
+ATF_TC_WITHOUT_HEAD(vers_ordering);
+ATF_TC_BODY(vers_ordering, tc)
+{
+ CHECK_ALL("000", "00", "01", "010", "09", "0", "1", "9", "10");
+}
+
+ATF_TC_WITHOUT_HEAD(natural_ordering);
+ATF_TC_BODY(natural_ordering, tc)
+{
+ CHECK_ALL("jan1", "jan2", "jan9", "jan10", "jan11", "jan19", "jan20");
+}
+
+/* https://sourceware.org/bugzilla/show_bug.cgi?id=9913 */
+
+ATF_TC_WITHOUT_HEAD(glibc_bug_9913);
+ATF_TC_BODY(glibc_bug_9913, tc)
+{
+ CHECK_ALL(
+ "B0075022800016.gbp.corp.com",
+ "B007502280067.gbp.corp.com",
+ "B007502357019.GBP.CORP.COM"
+ );
+}
+
+ATF_TC_WITHOUT_HEAD(semver_ordering);
+ATF_TC_BODY(semver_ordering, tc)
+{
+ CHECK_ALL("2.6.20", "2.6.21");
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ ATF_TP_ADD_TC(tp, strcmp_functionality);
+ ATF_TP_ADD_TC(tp, vers_ordering);
+ ATF_TP_ADD_TC(tp, natural_ordering);
+ ATF_TP_ADD_TC(tp, glibc_bug_9913);
+ ATF_TP_ADD_TC(tp, semver_ordering);
+
+ return (atf_no_error());
+}
diff --git a/lib/libc_nonshared/Makefile b/lib/libc_nonshared/Makefile
index 261828072e74..8ecf1699ba74 100644
--- a/lib/libc_nonshared/Makefile
+++ b/lib/libc_nonshared/Makefile
@@ -10,6 +10,7 @@ NO_PIC=
# -fpic on some platforms, -fPIC on others.
CFLAGS+=${PICFLAG} -DPIC -fvisibility=hidden
+PACKAGE= clibs
LIB= c_nonshared
LIBC_NONSHARED_SRCS=
diff --git a/lib/libcasper/libcasper/libcasper.3 b/lib/libcasper/libcasper/libcasper.3
index 2151131e29ec..a53ebed0dff1 100644
--- a/lib/libcasper/libcasper/libcasper.3
+++ b/lib/libcasper/libcasper/libcasper.3
@@ -28,7 +28,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd November 15, 2021
+.Dd September 29, 2022
.Dt LIBCASPER 3
.Os
.Sh NAME
@@ -219,6 +219,8 @@ provides a
compatible API
.It system.net
provides a libc compatible network API
+.It system.netdb
+provides libc compatible network proto API
.It system.pwd
provides a
.Xr getpwent 3
@@ -273,6 +275,7 @@ functions always succeed.
.Xr cap_dns 3 ,
.Xr cap_grp 3 ,
.Xr cap_net 3 ,
+.Xr cap_netdb 3 ,
.Xr cap_pwd 3 ,
.Xr cap_sysctl 3 ,
.Xr cap_syslog 3 ,
diff --git a/lib/libcasper/libcasper/libcasper_service.3 b/lib/libcasper/libcasper/libcasper_service.3
index 8ddc41f3d617..885852d9af8e 100644
--- a/lib/libcasper/libcasper/libcasper_service.3
+++ b/lib/libcasper/libcasper/libcasper_service.3
@@ -95,7 +95,7 @@ from the process it was spawned from.
The whole casper communication is using an
.Xr nvlist 9
with the
-.Xr NVLIST_NO_UNIQ 9
+.Dv NV_FLAG_NO_UNIQUE
flag.
.El
.Sh SEE ALSO
diff --git a/lib/libcasper/services/cap_netdb/cap_netdb.3 b/lib/libcasper/services/cap_netdb/cap_netdb.3
index 6df34559224c..cfbfc17da1ac 100644
--- a/lib/libcasper/services/cap_netdb/cap_netdb.3
+++ b/lib/libcasper/services/cap_netdb/cap_netdb.3
@@ -23,7 +23,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd May 12, 2020
+.Dd September 29, 2022
.Dt CAP_NETDB 3
.Os
.Sh NAME
@@ -38,7 +38,6 @@
.Ft "struct protoent *"
.Fn cap_getprotobyname "const cap_channel_t *chan" "const char *name"
.Sh DESCRIPTION
-.Bf -symbolic
The function
.Fn cap_getprotobyname
is equivalent to
diff --git a/lib/libdevinfo/Makefile b/lib/libdevinfo/Makefile
index 7995660fb7fd..7edfaecb53b2 100644
--- a/lib/libdevinfo/Makefile
+++ b/lib/libdevinfo/Makefile
@@ -1,5 +1,6 @@
# $FreeBSD$
+PACKAGE= devmatch
LIB= devinfo
SRCS= devinfo.c
INCS= devinfo.h
diff --git a/lib/libdpv/dpv.3 b/lib/libdpv/dpv.3
index a2f99b2f7af1..62dd2e94d736 100644
--- a/lib/libdpv/dpv.3
+++ b/lib/libdpv/dpv.3
@@ -55,8 +55,7 @@ library can display progress with one of
.Xr dialog 3 ,
.Xr dialog 1 ,
or
-.Xr Xdialog 1
-.Pq x11/xdialog from the ports tree .
+.Xr Xdialog 1 Pq Pa ports/x11/xdialog .
.Pp
The
.Fn dpv
@@ -152,7 +151,7 @@ argument will bump the width of the gauge widget.
Prompts wider than the maximum width will wrap
.Po
unless using
-.Xr Xdialog 1 ;
+.Xr Xdialog 1 Pq Pa ports/x11/xdialog ;
see BUGS section below
.Pc .
.It Dv DPV_NO_LABELS
@@ -405,7 +404,7 @@ Override command string used to launch
.Xr dialog 1
.Pq requires Dv DPV_DISPLAY_DIALOG
or
-.Xr Xdialog 1
+.Xr Xdialog 1 Pq Pa ports/x11/xdialog
.Pq requires Dv DPV_DISPLAY_XDIALOG ;
default is either
.Ql dialog
@@ -428,8 +427,9 @@ used as a prefix to
.It Ev USE_COLOR
If set and NULL,
disables the use of color when using
-.Xr dialog 1
-.Pq does not apply to Xr Xdialog 1 .
+.Xr dialog 1 .
+Does not apply to
+.Xr Xdialog 1 Pq Pa ports/x11/xdialog .
.It Ev msg_done Ev msg_fail Ev msg_pending
Internationalization strings for overriding the default English strings
.Ql Done ,
@@ -456,7 +456,7 @@ or desired values.
.El
.Sh SEE ALSO
.Xr dialog 1 ,
-.Xr Xdialog 1 ,
+.Xr Xdialog 1 Pq Pa ports/x11/xdialog ,
.Xr dialog 3
.Sh HISTORY
The
@@ -466,7 +466,7 @@ library first appeared in
.Sh AUTHORS
.An Devin Teske Aq dteske@FreeBSD.org
.Sh BUGS
-.Xr Xdialog 1 ,
+.Xr Xdialog 1 Pq Pa ports/x11/xdialog ,
when given both
.Ql Fl -title Ar title
.Po
@@ -485,12 +485,12 @@ member of
.Pc ,
displays the backtitle in place of the title and vice-versa.
.Pp
-.Xr Xdialog 1
+.Xr Xdialog 1 Pq Pa ports/x11/xdialog
does not wrap long prompt texts received after initial launch.
This is a known issue with the
.Ql --gauge
widget in
-.Xr Xdialog 1 .
+.Xr Xdialog 1 Pq Pa ports/x11/xdialog .
Embed escaped newlines within prompt text to force line breaks.
.Pp
.Xr dialog 1
@@ -501,7 +501,7 @@ This is a known issue with
and does not affect
.Xr dialog 3
or
-.Xr Xdialog 1 .
+.Xr Xdialog 1 Pq Pa ports/x11/xdialog .
.Pp
If an application ignores
.Ev USE_COLOR
@@ -520,7 +520,7 @@ to unset
.Ev USE_COLOR ,
forcing interpretation of color sequences.
This does not effect
-.Xr Xdialog 1 ,
+.Xr Xdialog 1 Pq Pa ports/x11/xdialog ,
which renders the color escape sequences as plain text.
See
.Do
diff --git a/lib/libedit/Makefile b/lib/libedit/Makefile
index 28014feafab7..4e33320cab70 100644
--- a/lib/libedit/Makefile
+++ b/lib/libedit/Makefile
@@ -97,3 +97,5 @@ test: tc1.o libedit.a ${DPADD} ${LIBTERMCAP}
${CC} ${CFLAGS} ${.ALLSRC} -o ${.TARGET} libedit.a ${LDADD}
.include <bsd.lib.mk>
+
+CWARNFLAGS.chartype.c= ${NO_WUSE_AFTER_FREE}
diff --git a/lib/libefivar/efivar-dp-format.c b/lib/libefivar/efivar-dp-format.c
index 9003b156f7fe..186f1cd5f103 100644
--- a/lib/libefivar/efivar-dp-format.c
+++ b/lib/libefivar/efivar-dp-format.c
@@ -1049,8 +1049,9 @@ DevPathToTextUsbWWID (
//
// In case no NULL terminator in SerialNumber, create a new one with NULL terminator
//
- NewStr = AllocateCopyPool ((Length + 1) * sizeof (CHAR16), SerialNumberStr);
+ NewStr = AllocatePool ((Length + 1) * sizeof (CHAR16));
ASSERT (NewStr != NULL);
+ CopyMem (NewStr, SerialNumberStr, Length * sizeof (CHAR16));
NewStr[Length] = 0;
SerialNumberStr = NewStr;
}
diff --git a/lib/libexpat/expat_config.h b/lib/libexpat/expat_config.h
index e2ffcb15c7ef..369cebcbe451 100644
--- a/lib/libexpat/expat_config.h
+++ b/lib/libexpat/expat_config.h
@@ -1,6 +1,9 @@
/* expat_config.h. Generated from expat_config.h.in by configure. */
/* expat_config.h.in. Generated from configure.ac by autoheader. */
+#ifndef EXPAT_CONFIG_H
+#define EXPAT_CONFIG_H 1
+
#include <machine/endian.h>
/* Define if building universal (internal helper macro) */
@@ -83,7 +86,7 @@
#define PACKAGE_NAME "expat"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "expat 2.4.3"
+#define PACKAGE_STRING "expat 2.5.0"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "expat"
@@ -92,7 +95,7 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
-#define PACKAGE_VERSION "2.4.3"
+#define PACKAGE_VERSION "2.5.0"
/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
@@ -100,7 +103,7 @@
#define STDC_HEADERS 1
/* Version number of package */
-#define VERSION "2.4.3"
+#define VERSION "2.5.0"
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
@@ -139,3 +142,5 @@
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */
+
+#endif // ndef EXPAT_CONFIG_H
diff --git a/lib/libexpat/libbsdxml.3 b/lib/libexpat/libbsdxml.3
index 87de2adf2854..f162ddadfd2b 100644
--- a/lib/libexpat/libbsdxml.3
+++ b/lib/libexpat/libbsdxml.3
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"/
-.Dd November 25, 2019
+.Dd November 18, 2022
.Dt LIBBSDXML 3
.Os
.Sh NAME
@@ -36,7 +36,7 @@
.Sh DESCRIPTION
The
.Nm
-library is a verbatim copy of the eXpat XML library version 2.2.9.
+library is a verbatim copy of the eXpat XML library version 2.5.0.
.Pp
The
.Nm
diff --git a/lib/libfetch/common.c b/lib/libfetch/common.c
index 628ab69612f7..7bf487b0db1d 100644
--- a/lib/libfetch/common.c
+++ b/lib/libfetch/common.c
@@ -67,12 +67,15 @@ __FBSDID("$FreeBSD$");
* Error messages for resolver errors
*/
static struct fetcherr netdb_errlist[] = {
+#ifdef EAI_ADDRFAMILY
+ { EAI_ADDRFAMILY, FETCH_RESOLV, "Address family for host not supported" },
+#endif
#ifdef EAI_NODATA
- { EAI_NODATA, FETCH_RESOLV, "Host not found" },
+ { EAI_NODATA, FETCH_RESOLV, "No address for host" },
#endif
{ EAI_AGAIN, FETCH_TEMP, "Transient resolver failure" },
{ EAI_FAIL, FETCH_RESOLV, "Non-recoverable resolver failure" },
- { EAI_NONAME, FETCH_RESOLV, "No address record" },
+ { EAI_NONAME, FETCH_RESOLV, "Host does not resolve" },
{ -1, FETCH_UNKNOWN, "Unknown resolver error" }
};
@@ -456,7 +459,7 @@ fetch_socks5_init(conn_t *conn, const char *host, int port, int verbose)
goto fail;
}
*ptr++ = strlen(host);
- strncpy(ptr, host, strlen(host));
+ memcpy(ptr, host, strlen(host));
ptr = ptr + strlen(host);
port = htons(port);
diff --git a/lib/libfetch/fetch.3 b/lib/libfetch/fetch.3
index cb37c08593d6..81db72529c4c 100644
--- a/lib/libfetch/fetch.3
+++ b/lib/libfetch/fetch.3
@@ -457,8 +457,7 @@ the environment variable
.Ev SSL_CLIENT_KEY_FILE
can be set to point to the key file.
In case the key uses a password, the user will be prompted on standard
-input (see
-.Xr PEM 3 ) .
+input.
.Pp
By default
.Nm libfetch
diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c
index c1d92d08b317..d4605aeccd9f 100644
--- a/lib/libfetch/http.c
+++ b/lib/libfetch/http.c
@@ -1281,9 +1281,10 @@ http_digest_auth(conn_t *conn, const char *hdr, http_auth_challenge_t *c,
DigestCalcHA1(c->algo, parms->user, c->realm,
parms->password, c->nonce, cnonce, HA1);
DEBUGF("HA1: [%s]\n", HA1);
- HASHHEX digest;
+ HASHHEX digest, null;
+ memset(null, 0, sizeof(null));
DigestCalcResponse(HA1, c->nonce, noncecount, cnonce, c->qop,
- "GET", url->doc, "", digest);
+ "GET", url->doc, null, digest);
if (c->qop[0]) {
r = http_cmd(conn, "%s: Digest username=\"%s\",realm=\"%s\","
diff --git a/lib/libgeom/libgeom.3 b/lib/libgeom/libgeom.3
index e1a3a35b7062..79977630c90d 100644
--- a/lib/libgeom/libgeom.3
+++ b/lib/libgeom/libgeom.3
@@ -298,7 +298,7 @@ that fetches the
.Ar kern.geom.confxml
OID, and returns it's value.
The allocated memory should be released with
-.Xr free 2
+.Xr free 3
after use.
.Pp
The
diff --git a/lib/libiconv_modules/VIQR/citrus_viqr.c b/lib/libiconv_modules/VIQR/citrus_viqr.c
index 8a81a7d12b01..f40910d8edf3 100644
--- a/lib/libiconv_modules/VIQR/citrus_viqr.c
+++ b/lib/libiconv_modules/VIQR/citrus_viqr.c
@@ -195,9 +195,9 @@ mnemonic_append_child(mnemonic_t *m, const char *s,
static void
mnemonic_destroy(mnemonic_t *m)
{
- mnemonic_t *m0;
+ mnemonic_t *m0, *n;
- TAILQ_FOREACH(m0, &m->child, entry)
+ TAILQ_FOREACH_SAFE(m0, &m->child, entry, n)
mnemonic_destroy(m0);
free(m);
}
diff --git a/lib/libifconfig/libifconfig.h b/lib/libifconfig/libifconfig.h
index e1cd6d1821a5..c8bbb5edd3bb 100644
--- a/lib/libifconfig/libifconfig.h
+++ b/lib/libifconfig/libifconfig.h
@@ -129,7 +129,7 @@ ifconfig_handle_t *ifconfig_open(void);
*/
void ifconfig_close(ifconfig_handle_t *h);
-/** Identifies what kind of error occured. */
+/** Identifies what kind of error occurred. */
ifconfig_errtype ifconfig_err_errtype(ifconfig_handle_t *h);
/** Retrieves the errno associated with the error, if any. */
@@ -285,7 +285,7 @@ int ifconfig_carp_get_info(ifconfig_handle_t *h, const char *name,
/** Retrieve additional information about an inet address
* @param h An open ifconfig state object
* @param name The interface name
- * @param ifa Pointer to the the address structure of interest
+ * @param ifa Pointer to the address structure of interest
* @param addr Return argument. It will be filled with additional information
* about the address.
* @return 0 on success, nonzero on failure.
@@ -296,7 +296,7 @@ int ifconfig_inet_get_addrinfo(ifconfig_handle_t *h,
/** Retrieve additional information about an inet6 address
* @param h An open ifconfig state object
* @param name The interface name
- * @param ifa Pointer to the the address structure of interest
+ * @param ifa Pointer to the address structure of interest
* @param addr Return argument. It will be filled with additional information
* about the address.
* @return 0 on success, nonzero on failure.
diff --git a/lib/libifconfig/libifconfig_internal.h b/lib/libifconfig/libifconfig_internal.h
index d9803a05c675..77add7574fa8 100644
--- a/lib/libifconfig/libifconfig_internal.h
+++ b/lib/libifconfig/libifconfig_internal.h
@@ -38,13 +38,13 @@ struct errstate {
ifconfig_errtype errtype;
/**
- * The error occured in this ioctl() request.
+ * The error occurred in this ioctl() request.
* Populated if errtype = IOCTL
*/
unsigned long ioctl_request;
/**
- * The value of the global errno variable when the error occured.
+ * The value of the global errno variable when the error occurred.
*/
int errcode;
};
diff --git a/lib/libipsec/pfkey_dump.c b/lib/libipsec/pfkey_dump.c
index f4a003b94905..99a02ae24bc4 100644
--- a/lib/libipsec/pfkey_dump.c
+++ b/lib/libipsec/pfkey_dump.c
@@ -150,6 +150,9 @@ static struct val2str str_alg_auth[] = {
#ifdef SADB_X_AALG_AES_XCBC_MAC
{ SADB_X_AALG_AES_XCBC_MAC, "aes-xcbc-mac", },
#endif
+#ifdef SADB_X_AALG_CHACHA20POLY1305
+ { SADB_X_AALG_CHACHA20POLY1305, "chacha20-poly1305", },
+#endif
{ -1, NULL, },
};
@@ -171,6 +174,9 @@ static struct val2str str_alg_enc[] = {
#ifdef SADB_X_EALG_AESGCM16
{ SADB_X_EALG_AESGCM16, "aes-gcm-16", },
#endif
+#ifdef SADB_X_EALG_CHACHA20POLY1305
+ { SADB_X_EALG_CHACHA20POLY1305, "chacha20-poly1305", },
+#endif
{ -1, NULL, },
};
diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c
index b98f2f25e619..4b886171a7d6 100644
--- a/lib/libkvm/kvm.c
+++ b/lib/libkvm/kvm.c
@@ -303,7 +303,7 @@ kvm_close(kvm_t *kd)
free(kd->pt_map);
if (kd->page_map != NULL)
free(kd->page_map);
- if (kd->sparse_map != MAP_FAILED)
+ if (kd->sparse_map != MAP_FAILED && kd->sparse_map != NULL)
munmap(kd->sparse_map, kd->pt_sparse_size);
free((void *)kd);
diff --git a/lib/libldns/Makefile b/lib/libldns/Makefile
index 34ffe7d2ed73..40efe0ff0fda 100644
--- a/lib/libldns/Makefile
+++ b/lib/libldns/Makefile
@@ -23,4 +23,6 @@ LIBADD= ssl crypto
WARNS ?= 3
+CWARNFLAGS.sha2.c= ${NO_WARRAY_PARAMETER}
+
.include <bsd.lib.mk>
diff --git a/lib/liblzma/Makefile b/lib/liblzma/Makefile
index 4f38ef391e4a..0bdcc6af5ddc 100644
--- a/lib/liblzma/Makefile
+++ b/lib/liblzma/Makefile
@@ -159,8 +159,9 @@ PCFILES= liblzma.pc
liblzma.pc: liblzma.pc.in
sed -e 's,@prefix@,/usr,g ; \
s,@exec_prefix@,/usr,g ; \
- s,@libdir@,/usr/lib,g ; \
- s,@includedir@,/usr/include,g ; \
+ s,@libdir@,${LIBDIR},g ; \
+ s,@sharedlibdir@,${SHLIBDIR},g ; \
+ s,@includedir@,${INCLUDEDIR},g ; \
s,@LIBS@,-pthread -lmd,g ; \
s,@PACKAGE_URL@,https://tukaani.org/xz/,g ; \
s,@PACKAGE_VERSION@,${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH},g ; \
diff --git a/lib/liblzma/Symbol.map b/lib/liblzma/Symbol.map
index f49f29f24987..c3208527764d 100644
--- a/lib/liblzma/Symbol.map
+++ b/lib/liblzma/Symbol.map
@@ -1,7 +1,3 @@
-/*
- * $FreeBSD$
- */
-
XZ_5.0 {
lzma_alone_decoder;
lzma_alone_encoder;
@@ -100,7 +96,7 @@ XZ_5.0 {
XZ_5.2 {
lzma_block_uncomp_encode;
- lzma_cputhreads;
+ lzma_cputhreads;
lzma_get_progress;
lzma_stream_encoder_mt;
lzma_stream_encoder_mt_memusage;
diff --git a/lib/liblzma/config.h b/lib/liblzma/config.h
index f674cbf66fdb..467ed68ce57d 100644
--- a/lib/liblzma/config.h
+++ b/lib/liblzma/config.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
@@ -34,10 +33,6 @@
/* Define to 1 if you have the `CC_SHA256_Init' function. */
/* #undef HAVE_CC_SHA256_INIT */
-/* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the
- CoreFoundation framework. */
-/* #undef HAVE_CFLOCALECOPYCURRENT */
-
/* Define to 1 if you have the Mac OS X function
CFLocaleCopyPreferredLanguages in the CoreFoundation framework. */
/* #undef HAVE_CFLOCALECOPYPREFERREDLANGUAGES */
@@ -177,9 +172,6 @@
/* Define to 1 if mbrtowc and mbstate_t are properly declared. */
#define HAVE_MBRTOWC 1
-/* Define to 1 if you have the <memory.h> header file. */
-#define HAVE_MEMORY_H 1
-
/* Define to 1 to enable bt2 match finder. */
#define HAVE_MF_BT2 1
@@ -195,6 +187,9 @@
/* Define to 1 to enable hc4 match finder. */
#define HAVE_MF_HC4 1
+/* Define to 1 if you have the <minix/config.h> header file. */
+/* #undef HAVE_MINIX_CONFIG_H */
+
/* Define to 1 if getopt.h declares extern int optreset. */
#define HAVE_OPTRESET 1
@@ -234,6 +229,9 @@
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
+/* Define to 1 if you have the <stdio.h> header file. */
+#define HAVE_STDIO_H 1
+
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
@@ -258,6 +256,10 @@
/* Define to 1 if `st_uatime' is a member of `struct stat'. */
/* #undef HAVE_STRUCT_STAT_ST_UATIME */
+/* Define to 1 to if GNU/Linux-specific details are wanted for symbol
+ versioning. This must be used together with liblzma_linux.map. */
+/* #undef HAVE_SYMBOL_VERSIONS_LINUX */
+
/* Define to 1 if you have the <sys/byteorder.h> header file. */
/* #undef HAVE_SYS_BYTEORDER_H */
@@ -295,6 +297,9 @@
declarations. */
#define HAVE_VISIBILITY 1
+/* Define to 1 if you have the <wchar.h> header file. */
+#define HAVE_WCHAR_H 1
+
/* Define to 1 if you have the `wcwidth' function. */
#define HAVE_WCWIDTH 1
@@ -344,7 +349,7 @@
#define PACKAGE_NAME "XZ Utils"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "XZ Utils 5.2.5"
+#define PACKAGE_STRING "XZ Utils 5.2.8"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "xz"
@@ -353,7 +358,7 @@
#define PACKAGE_URL "https://tukaani.org/xz/"
/* Define to the version of this package. */
-#define PACKAGE_VERSION "5.2.5"
+#define PACKAGE_VERSION "5.2.8"
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
@@ -362,7 +367,9 @@
/* The size of `size_t', as computed by sizeof. */
#define SIZEOF_SIZE_T 8
-/* Define to 1 if you have the ANSI C header files. */
+/* Define to 1 if all of the C90 standard headers exist (not just the ones
+ required in a freestanding environment). This macro is provided for
+ backward compatibility; new code need not use it. */
#define STDC_HEADERS 1
/* Define to 1 if the number of available CPU cores can be detected with
@@ -427,26 +434,92 @@
#ifndef _ALL_SOURCE
# define _ALL_SOURCE 1
#endif
+/* Enable general extensions on macOS. */
+#ifndef _DARWIN_C_SOURCE
+# define _DARWIN_C_SOURCE 1
+#endif
+/* Enable general extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# define __EXTENSIONS__ 1
+#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
-/* Enable threading extensions on Solaris. */
+/* Enable X/Open compliant socket functions that do not require linking
+ with -lxnet on HP-UX 11.11. */
+#ifndef _HPUX_ALT_XOPEN_SOCKET_API
+# define _HPUX_ALT_XOPEN_SOCKET_API 1
+#endif
+/* Identify the host operating system as Minix.
+ This macro does not affect the system headers' behavior.
+ A future release of Autoconf may stop defining this macro. */
+#ifndef _MINIX
+/* # undef _MINIX */
+#endif
+/* Enable general extensions on NetBSD.
+ Enable NetBSD compatibility extensions on Minix. */
+#ifndef _NETBSD_SOURCE
+# define _NETBSD_SOURCE 1
+#endif
+/* Enable OpenBSD compatibility extensions on NetBSD.
+ Oddly enough, this does nothing on OpenBSD. */
+#ifndef _OPENBSD_SOURCE
+# define _OPENBSD_SOURCE 1
+#endif
+/* Define to 1 if needed for POSIX-compatible behavior. */
+#ifndef _POSIX_SOURCE
+/* # undef _POSIX_SOURCE */
+#endif
+/* Define to 2 if needed for POSIX-compatible behavior. */
+#ifndef _POSIX_1_SOURCE
+/* # undef _POSIX_1_SOURCE */
+#endif
+/* Enable POSIX-compatible threading on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# define _POSIX_PTHREAD_SEMANTICS 1
#endif
+/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */
+#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
+# define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */
+#ifndef __STDC_WANT_IEC_60559_BFP_EXT__
+# define __STDC_WANT_IEC_60559_BFP_EXT__ 1
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */
+#ifndef __STDC_WANT_IEC_60559_DFP_EXT__
+# define __STDC_WANT_IEC_60559_DFP_EXT__ 1
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */
+#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__
+# define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */
+#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__
+# define __STDC_WANT_IEC_60559_TYPES_EXT__ 1
+#endif
+/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */
+#ifndef __STDC_WANT_LIB_EXT2__
+# define __STDC_WANT_LIB_EXT2__ 1
+#endif
+/* Enable extensions specified by ISO/IEC 24747:2009. */
+#ifndef __STDC_WANT_MATH_SPEC_FUNCS__
+# define __STDC_WANT_MATH_SPEC_FUNCS__ 1
+#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# define _TANDEM_SOURCE 1
#endif
-/* Enable general extensions on Solaris. */
-#ifndef __EXTENSIONS__
-# define __EXTENSIONS__ 1
+/* Enable X/Open extensions. Define to 500 only if necessary
+ to make mbstate_t available. */
+#ifndef _XOPEN_SOURCE
+/* # undef _XOPEN_SOURCE */
#endif
/* Version number of package */
-#define VERSION "5.2.5"
+#define VERSION "5.2.8"
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
@@ -461,27 +534,12 @@
#endif
#endif
-/* Enable large inode numbers on Mac OS X 10.5. */
-#ifndef _DARWIN_USE_64_BIT_INODE
-# define _DARWIN_USE_64_BIT_INODE 1
-#endif
-
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
-/* Define to 1 if on MINIX. */
-/* #undef _MINIX */
-
-/* Define to 2 if the system does not provide POSIX.1 features except with
- this defined. */
-/* #undef _POSIX_1_SOURCE */
-
-/* Define to 1 if you need to in order for `stat' and other things to work. */
-/* #undef _POSIX_SOURCE */
-
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
diff --git a/lib/libmagic/Makefile b/lib/libmagic/Makefile
index 5f967102fe02..3ddbf506eb81 100644
--- a/lib/libmagic/Makefile
+++ b/lib/libmagic/Makefile
@@ -42,9 +42,9 @@ PACKAGE_VERSION!= sed -n '/define.*PACKAGE_VERSION/{s,[^0-9.],,gp;q;}' ${.CURDIR
libmagic.pc: libmagic.pc.in
sed -e 's,@prefix@,/usr,g ; \
s,@exec_prefix@,$${prefix},g ; \
- s,@libdir@,$${exec_prefix}/lib,g ; \
- s,@sharedlibdir@,$${libdir},g ; \
- s,@includedir@,$${prefix}/include,g ; \
+ s,@libdir@,${LIBDIR},g ; \
+ s,@sharedlibdir@,${SHLIBDIR},g ; \
+ s,@includedir@,${INCLUDEDIR},g ; \
s,@VERSION@,${PACKAGE_VERSION},g ; \
s,@LIBS@,,g ;' \
${.ALLSRC} > ${.TARGET}
diff --git a/lib/libmagic/config.h b/lib/libmagic/config.h
index 2dc6ad7fb3fa..220321c64af7 100644
--- a/lib/libmagic/config.h
+++ b/lib/libmagic/config.h
@@ -114,8 +114,8 @@
/* Define to 1 if you have the `memmem' function. */
#define HAVE_MEMMEM 1
-/* Define to 1 if you have the <memory.h> header file. */
-#define HAVE_MEMORY_H 1
+/* Define to 1 if you have the <minix/config.h> header file. */
+/* #undef HAVE_MINIX_CONFIG_H */
/* Define to 1 if you have the `mkostemp' function. */
#define HAVE_MKOSTEMP 1
@@ -149,6 +149,9 @@
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
+/* Define to 1 if you have the <stdio.h> header file. */
+#define HAVE_STDIO_H 1
+
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
@@ -299,7 +302,7 @@
#define PACKAGE_NAME "file"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "file 5.42"
+#define PACKAGE_STRING "file 5.43"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "file"
@@ -308,9 +311,11 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
-#define PACKAGE_VERSION "5.42"
+#define PACKAGE_VERSION "5.43"
-/* Define to 1 if you have the ANSI C header files. */
+/* Define to 1 if all of the C90 standard headers exist (not just the ones
+ required in a freestanding environment). This macro is provided for
+ backward compatibility; new code need not use it. */
#define STDC_HEADERS 1
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
@@ -320,26 +325,92 @@
#ifndef _ALL_SOURCE
# define _ALL_SOURCE 1
#endif
+/* Enable general extensions on macOS. */
+#ifndef _DARWIN_C_SOURCE
+# define _DARWIN_C_SOURCE 1
+#endif
+/* Enable general extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# define __EXTENSIONS__ 1
+#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
-/* Enable threading extensions on Solaris. */
+/* Enable X/Open compliant socket functions that do not require linking
+ with -lxnet on HP-UX 11.11. */
+#ifndef _HPUX_ALT_XOPEN_SOCKET_API
+# define _HPUX_ALT_XOPEN_SOCKET_API 1
+#endif
+/* Identify the host operating system as Minix.
+ This macro does not affect the system headers' behavior.
+ A future release of Autoconf may stop defining this macro. */
+#ifndef _MINIX
+/* # undef _MINIX */
+#endif
+/* Enable general extensions on NetBSD.
+ Enable NetBSD compatibility extensions on Minix. */
+#ifndef _NETBSD_SOURCE
+# define _NETBSD_SOURCE 1
+#endif
+/* Enable OpenBSD compatibility extensions on NetBSD.
+ Oddly enough, this does nothing on OpenBSD. */
+#ifndef _OPENBSD_SOURCE
+# define _OPENBSD_SOURCE 1
+#endif
+/* Define to 1 if needed for POSIX-compatible behavior. */
+#ifndef _POSIX_SOURCE
+/* # undef _POSIX_SOURCE */
+#endif
+/* Define to 2 if needed for POSIX-compatible behavior. */
+#ifndef _POSIX_1_SOURCE
+/* # undef _POSIX_1_SOURCE */
+#endif
+/* Enable POSIX-compatible threading on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# define _POSIX_PTHREAD_SEMANTICS 1
#endif
+/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */
+#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
+# define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */
+#ifndef __STDC_WANT_IEC_60559_BFP_EXT__
+# define __STDC_WANT_IEC_60559_BFP_EXT__ 1
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */
+#ifndef __STDC_WANT_IEC_60559_DFP_EXT__
+# define __STDC_WANT_IEC_60559_DFP_EXT__ 1
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */
+#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__
+# define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */
+#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__
+# define __STDC_WANT_IEC_60559_TYPES_EXT__ 1
+#endif
+/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */
+#ifndef __STDC_WANT_LIB_EXT2__
+# define __STDC_WANT_LIB_EXT2__ 1
+#endif
+/* Enable extensions specified by ISO/IEC 24747:2009. */
+#ifndef __STDC_WANT_MATH_SPEC_FUNCS__
+# define __STDC_WANT_MATH_SPEC_FUNCS__ 1
+#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# define _TANDEM_SOURCE 1
#endif
-/* Enable general extensions on Solaris. */
-#ifndef __EXTENSIONS__
-# define __EXTENSIONS__ 1
+/* Enable X/Open extensions. Define to 500 only if necessary
+ to make mbstate_t available. */
+#ifndef _XOPEN_SOURCE
+/* # undef _XOPEN_SOURCE */
#endif
/* Version number of package */
-#define VERSION "5.42"
+#define VERSION "5.43"
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
@@ -359,11 +430,6 @@
/* Enable zlib compression support */
#define ZLIBSUPPORT 1
-/* Enable large inode numbers on Mac OS X 10.5. */
-#ifndef _DARWIN_USE_64_BIT_INODE
-# define _DARWIN_USE_64_BIT_INODE 1
-#endif
-
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
@@ -373,16 +439,6 @@
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
-/* Define to 1 if on MINIX. */
-/* #undef _MINIX */
-
-/* Define to 2 if the system does not provide POSIX.1 features except with
- this defined. */
-/* #undef _POSIX_1_SOURCE */
-
-/* Define to 1 if you need to in order for `stat' and other things to work. */
-/* #undef _POSIX_SOURCE */
-
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
@@ -416,7 +472,7 @@
/* Define to `long int' if <sys/types.h> does not define. */
/* #undef off_t */
-/* Define to `int' if <sys/types.h> does not define. */
+/* Define as a signed integer type capable of holding a process identifier. */
/* #undef pid_t */
/* Define to `unsigned int' if <sys/types.h> does not define. */
diff --git a/lib/libmd/Makefile b/lib/libmd/Makefile
index c98c33bae3f5..8d3a05279004 100644
--- a/lib/libmd/Makefile
+++ b/lib/libmd/Makefile
@@ -103,7 +103,7 @@ CFLAGS.skein_block.c+= -DSKEIN_LOOP=995
.PATH: ${SRCTOP}/sys/crypto/skein ${SRCTOP}/sys/crypto/skein/${MACHINE_ARCH}
USE_ASM_SOURCES?=1
-.if defined(BOOTSTRAPPING)
+.if defined(BOOTSTRAPPING) || ${MK_MACHDEP_OPTIMIZATIONS} == no
# Don't build ASM sources when bootstrapping to avoid toolchain dependencies
USE_ASM_SOURCES:=0
.endif
diff --git a/lib/libmd/mdX.3 b/lib/libmd/mdX.3
index 30e6f367c662..5631e2d7a1fc 100644
--- a/lib/libmd/mdX.3
+++ b/lib/libmd/mdX.3
@@ -162,7 +162,7 @@ may return NULL when underlying
.Xr fstat 2 ,
.Xr lseek 2 ,
or
-.Xr MDXEnd 2
+.Xr MDXEnd 3
fail.
.Sh SEE ALSO
.Xr md4 3 ,
diff --git a/lib/libmd/ripemd.3 b/lib/libmd/ripemd.3
index d868ae12827b..5b1ba8d62e5c 100644
--- a/lib/libmd/ripemd.3
+++ b/lib/libmd/ripemd.3
@@ -142,7 +142,7 @@ may return NULL when underlying
.Xr fstat 2 ,
.Xr lseek 2 ,
or
-.Xr RIPEMD160_End 2
+.Xr RIPEMD160_End 3
fail.
.Sh SEE ALSO
.Xr md4 3 ,
diff --git a/lib/libmd/sha.3 b/lib/libmd/sha.3
index 20a1e5639dde..c629de77f692 100644
--- a/lib/libmd/sha.3
+++ b/lib/libmd/sha.3
@@ -173,7 +173,7 @@ may return NULL when underlying
.Xr fstat 2 ,
.Xr lseek 2 ,
or
-.Xr SHA1_End 2
+.Xr SHA1_End 3
fail.
.Sh SEE ALSO
.Xr md4 3 ,
diff --git a/lib/libmd/sha256.3 b/lib/libmd/sha256.3
index d11f2f783557..defe2ec45151 100644
--- a/lib/libmd/sha256.3
+++ b/lib/libmd/sha256.3
@@ -164,7 +164,7 @@ may return NULL when underlying
.Xr fstat 2 ,
.Xr lseek 2 ,
or
-.Xr SHA256_End 2
+.Xr SHA256_End 3
fail.
.Sh SEE ALSO
.Xr md4 3 ,
diff --git a/lib/libmd/sha512.3 b/lib/libmd/sha512.3
index 6a5ed6f887d9..30ea2a0b5eb2 100644
--- a/lib/libmd/sha512.3
+++ b/lib/libmd/sha512.3
@@ -208,7 +208,7 @@ may return NULL when underlying
.Xr fstat 2 ,
.Xr lseek 2 ,
or
-.Xr SHA512_End 2
+.Xr SHA512_End 3
fail.
.Sh SEE ALSO
.Xr md4 3 ,
diff --git a/lib/libmd/skein.3 b/lib/libmd/skein.3
index 325a1ab4874b..dd8cedb15027 100644
--- a/lib/libmd/skein.3
+++ b/lib/libmd/skein.3
@@ -206,7 +206,7 @@ may return NULL when underlying
.Xr fstat 2 ,
.Xr lseek 2 ,
or
-.Xr SKEIN256_End 2
+.Xr SKEIN256_End 3
fail.
.Sh SEE ALSO
.Xr md4 3 ,
diff --git a/lib/libopie/Makefile b/lib/libopie/Makefile
deleted file mode 100644
index 2dda575e94ef..000000000000
--- a/lib/libopie/Makefile
+++ /dev/null
@@ -1,40 +0,0 @@
-# Makefile for libopie
-#
-# $FreeBSD$
-#
-
-CONFS= opieaccess
-CONFSMODE= 600
-PACKAGE=lib${LIB}
-OPIE_DIST?= ${SRCTOP}/contrib/opie
-DIST_DIR= ${OPIE_DIST}/${.CURDIR:T}
-SHLIB_MAJOR= 8
-
-KEYFILE?= \"/etc/opiekeys\"
-
-.PATH: ${DIST_DIR}
-
-LIB= opie
-SRCS= atob8.c btoa8.c btoh.c challenge.c getsequence.c hash.c hashlen.c \
- keycrunch.c lock.c lookup.c newseed.c parsechallenge.c passcheck.c \
- passwd.c randomchallenge.c readpass.c unlock.c verify.c version.c \
- btoe.c accessfile.c generator.c insecure.c getutmpentry.c \
- readrec.c writerec.c open.c
-SRCS+= opieextra.c
-INCS= ${OPIE_DIST}/opie.h
-
-CFLAGS+=-I${.CURDIR} -I${OPIE_DIST} -I${DIST_DIR} \
- -DKEY_FILE=${KEYFILE}
-
-ACCESSFILE?= \"/etc/opieaccess\"
-CFLAGS+= -DINSECURE_OVERRIDE -DPATH_ACCESS_FILE=${ACCESSFILE}
-
-WARNS?= 0
-
-LIBADD= md
-
-MAN= ${OPIE_DIST}/opie.4 ${OPIE_DIST}/opiekeys.5 ${OPIE_DIST}/opieaccess.5
-
-MLINKS= opie.4 skey.4
-
-.include <bsd.lib.mk>
diff --git a/lib/libopie/Makefile.depend b/lib/libopie/Makefile.depend
deleted file mode 100644
index 96d46f623269..000000000000
--- a/lib/libopie/Makefile.depend
+++ /dev/null
@@ -1,18 +0,0 @@
-# $FreeBSD$
-# Autogenerated - do NOT edit!
-
-DIRDEPS = \
- include \
- include/arpa \
- include/xlocale \
- lib/${CSU_DIR} \
- lib/libc \
- lib/libcompiler_rt \
- lib/libmd \
-
-
-.include <dirdeps.mk>
-
-.if ${DEP_RELDIR} == ${_DEP_RELDIR}
-# local dependencies - needed for -jN in clean tree
-.endif
diff --git a/lib/libopie/config.h b/lib/libopie/config.h
deleted file mode 100644
index b9bc40c06627..000000000000
--- a/lib/libopie/config.h
+++ /dev/null
@@ -1,381 +0,0 @@
-/* $FreeBSD$ */
-/* config.h. Generated automatically by configure. */
-/* config.h.in. Generated automatically from configure.in by autoheader. */
-
-/* Define if on AIX 3.
- System headers sometimes define this.
- We just want to avoid a redefinition error message. */
-#ifndef _ALL_SOURCE
-/* #undef _ALL_SOURCE */
-#endif
-
-/* Define if using alloca.c. */
-/* #undef C_ALLOCA */
-
-/* Define to empty if the keyword does not work. */
-/* #undef const */
-
-/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
- This function is required for alloca.c support on those systems. */
-/* #undef CRAY_STACKSEG_END */
-
-/* Define if you have alloca, as a function or macro. */
-#define HAVE_ALLOCA 1
-
-/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
-/* #undef HAVE_ALLOCA_H */
-
-/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
-#define HAVE_SYS_WAIT_H 1
-
-/* Define if on MINIX. */
-/* #undef _MINIX */
-
-/* Define if the system does not provide POSIX.1 features except
- with this defined. */
-/* #undef _POSIX_1_SOURCE */
-
-/* Define if you need to in order for stat and other things to work. */
-/* #undef _POSIX_SOURCE */
-
-/* Define as the return type of signal handlers (int or void). */
-#define RETSIGTYPE void
-
-/* If using the C implementation of alloca, define if you know the
- direction of stack growth for your system; otherwise it will be
- automatically deduced at run-time.
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown
- */
-/* #undef STACK_DIRECTION */
-
-/* Define if you want the FTP daemon to support anonymous logins. */
-/* #undef DOANONYMOUS */
-
-/* The default value of the PATH environment variable */
-#define DEFAULT_PATH "/usr/bin:/bin:/usr/sbin:/sbin"
-
-/* Defined if the file /etc/default/login exists
- (and, presumably, should be looked at by login) */
-/* #undef HAVE_ETC_DEFAULT_LOGIN */
-
-/* Defined to the name of a file that contains a list of files whose
- permissions and ownerships should be changed on login. */
-/* #undef HAVE_LOGIN_PERMFILE */
-
-/* Defined to the name of a file that contains a list of environment
- values that should be set on login. */
-/* #undef HAVE_LOGIN_ENVFILE */
-
-/* Defined if the file /etc/securetty exists
- (and, presumably, should be looked at by login) */
-/* #undef HAVE_SECURETTY */
-
-/* Defined if the file /etc/shadow exists
- (and, presumably, should be looked at for shadow passwords) */
-/* #undef HAVE_ETC_SHADOW */
-
-/* The path to the access file, if we're going to use it */
-/* #undef PATH_ACCESS_FILE */
-
-/* The path to the mail spool, if we know it */
-#define PATH_MAIL "/var/mail"
-
-/* The path to the utmp file, if we know it */
-#define PATH_UTMP_AC "/var/run/utmp"
-
-/* The path to the wtmp file, if we know it */
-#define PATH_WTMP_AC "/var/log/wtmp"
-
-/* The path to the wtmpx file, if we know it */
-/* #undef PATH_WTMPX_AC */
-
-/* Defined if the system's profile (/etc/profile) displays
- the motd file */
-/* #undef HAVE_MOTD_IN_PROFILE */
-
-/* Defined if the system's profile (/etc/profile) informs the
- user of new mail */
-/* #undef HAVE_MAILCHECK_IN_PROFILE */
-
-/* Define if you have a nonstandard gettimeofday() that takes one argument
- instead of two. */
-/* #undef HAVE_ONE_ARG_GETTIMEOFDAY */
-
-/* Define if the system has the getenv function */
-#define HAVE_GETENV 1
-
-/* Define if the system has the setenv function */
-#define HAVE_SETENV 1
-
-/* Define if the system has the /var/adm/sulog file */
-/* #undef HAVE_SULOG */
-
-/* Define if the system has the unsetenv function */
-#define HAVE_UNSETENV 1
-
-/* Define if the compiler can handle ANSI-style argument lists */
-#define HAVE_ANSIDECL 1
-
-/* Define if the compiler can handle ANSI-style prototypes */
-#define HAVE_ANSIPROTO 1
-
-/* Define if the system has an ANSI-style printf (returns int instead of char *) */
-#define HAVE_ANSISPRINTF 1
-
-/* Define if the compiler can handle ANSI-style variable argument lists */
-#define HAVE_ANSISTDARG 1
-
-/* Define if the compiler can handle void argument lists to functions */
-#define HAVE_VOIDARG 1
-
-/* Define if the compiler can handle void return "values" from functions */
-#define HAVE_VOIDRET 1
-
-/* Define if the compiler can handle void pointers to our liking */
-#define HAVE_VOIDPTR 1
-
-/* Define if the /bin/ls command seems to support the -g flag */
-/* #undef HAVE_LS_G_FLAG */
-
-/* Define if there is a ut_pid field in struct utmp */
-/* #undef HAVE_UT_PID */
-
-/* Define if there is a ut_type field in struct utmp */
-/* #undef HAVE_UT_TYPE */
-
-/* Define if there is a ut_name field in struct utmp */
-#define HAVE_UT_NAME 1
-
-/* Define if there is a ut_host field in struct utmp */
-#define HAVE_UT_HOST 1
-
-/* Define if the system has getutline() */
-/* #undef HAVE_GETUTLINE */
-
-/* Defined if the system has SunOS C2 security shadow passwords */
-/* #undef HAVE_SUNOS_C2_SHADOW */
-
-/* Defined if you want to disable utmp support */
-/* #undef DISABLE_UTMP */
-
-/* Defined if you want to allow users to override the insecure checks */
-/* #undef INSECURE_OVERRIDE */
-
-/* Defined to the default hash value, always defined */
-#define MDX 5
-
-/* Defined if new-style prompts are to be used */
-#define NEW_PROMPTS 1
-
-/* Defined to the path of the OPIE lock directory */
-#define OPIE_LOCK_DIR "/var/spool/opielocks"
-
-/* Defined if users are to be asked to re-type secret pass phrases */
-/* #undef RETYPE */
-
-/* Defined if su should not switch to disabled accounts */
-/* #undef SU_STAR_CHECK */
-
-/* Don't turn it on! It allows intruder easily disable whole OPIE for user */
-/* Defined if user locking is to be used */
-/* #undef USER_LOCKING */
-
-/* Define if you have the bcopy function. */
-/* #undef HAVE_BCOPY */
-
-/* Define if you have the bzero function. */
-/* #undef HAVE_BZERO */
-
-/* Define if you have the endspent function. */
-/* #undef HAVE_ENDSPENT */
-
-/* Define if you have the fpurge function. */
-#define HAVE_FPURGE 1
-
-/* Define if you have the getdtablesize function. */
-/* #undef HAVE_GETDTABLESIZE */
-
-/* Define if you have the getgroups function. */
-#define HAVE_GETGROUPS 1
-
-/* Define if you have the gethostname function. */
-/* #undef HAVE_GETHOSTNAME */
-
-/* Define if you have the getspnam function. */
-/* #undef HAVE_GETSPNAM */
-
-/* Define if you have the gettimeofday function. */
-#define HAVE_GETTIMEOFDAY 1
-
-/* Define if you have the getttynam function. */
-#define HAVE_GETTTYNAM 1
-
-/* Define if you have the getusershell function. */
-#define HAVE_GETUSERSHELL 1
-
-/* Define if you have the getutxline function. */
-#define HAVE_GETUTXLINE 1
-
-/* Define if you have the getwd function. */
-/* #undef HAVE_GETWD */
-
-/* Define if you have the index function. */
-/* #undef HAVE_INDEX */
-
-/* Define if you have the lstat function. */
-#define HAVE_LSTAT 1
-
-/* Define if you have the on_exit function. */
-/* #undef HAVE_ON_EXIT */
-
-/* Define if you have the pututxline function. */
-#define HAVE_PUTUTXLINE 1
-
-/* Define if you have the rindex function. */
-/* #undef HAVE_RINDEX */
-
-/* Define if you have the setgroups function. */
-#define HAVE_SETGROUPS 1
-
-/* Define if you have the setlogin function. */
-#define HAVE_SETLOGIN 1
-
-/* Define if you have the setpriority function. */
-#define HAVE_SETPRIORITY 1
-
-/* Define if you have the setregid function. */
-/* #undef HAVE_SETREGID */
-
-/* Define if you have the setresgid function. */
-/* #undef HAVE_SETRESGID */
-
-/* Define if you have the setresuid function. */
-/* #undef HAVE_SETRESUID */
-
-/* Define if you have the setreuid function. */
-/* #undef HAVE_SETREUID */
-
-/* Define if you have the setvbuf function. */
-#define HAVE_SETVBUF 1
-
-/* Define if you have the sigaddset function. */
-#define HAVE_SIGADDSET 1
-
-/* Define if you have the sigblock function. */
-/* #undef HAVE_SIGBLOCK */
-
-/* Define if you have the sigemptyset function. */
-#define HAVE_SIGEMPTYSET 1
-
-/* Define if you have the sigsetmask function. */
-/* #undef HAVE_SIGSETMASK */
-
-/* Define if you have the socket function. */
-#define HAVE_SOCKET 1
-
-/* Define if you have the strerror function. */
-#define HAVE_STRERROR 1
-
-/* Define if you have the strftime function. */
-#define HAVE_STRFTIME 1
-
-/* Define if you have the strncasecmp function. */
-#define HAVE_STRNCASECMP 1
-
-/* Define if you have the strstr function. */
-#define HAVE_STRSTR 1
-
-/* Define if you have the ttyslot function. */
-#define HAVE_TTYSLOT 1
-
-/* Define if you have the usleep function. */
-#define HAVE_USLEEP 1
-
-/* Define if you have the <crypt.h> header file. */
-/* #undef HAVE_CRYPT_H */
-
-/* Define if you have the <dirent.h> header file. */
-#define HAVE_DIRENT_H 1
-
-/* Define if you have the <fcntl.h> header file. */
-#define HAVE_FCNTL_H 1
-
-/* Define if you have the <lastlog.h> header file. */
-/* #undef HAVE_LASTLOG_H */
-
-/* Define if you have the <limits.h> header file. */
-#define HAVE_LIMITS_H 1
-
-/* Define if you have the <ndir.h> header file. */
-/* #undef HAVE_NDIR_H */
-
-/* Define if you have the <paths.h> header file. */
-#define HAVE_PATHS_H 1
-
-/* Define if you have the <pwd.h> header file. */
-#define HAVE_PWD_H 1
-
-/* Define if you have the <shadow.h> header file. */
-/* #undef HAVE_SHADOW_H */
-
-/* Define if you have the <signal.h> header file. */
-#define HAVE_SIGNAL_H 1
-
-/* Define if you have the <stdlib.h> header file. */
-#define HAVE_STDLIB_H 1
-
-/* Define if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define if you have the <sys/dir.h> header file. */
-/* #undef HAVE_SYS_DIR_H */
-
-/* Define if you have the <sys/file.h> header file. */
-#define HAVE_SYS_FILE_H 1
-
-/* Define if you have the <sys/ioctl.h> header file. */
-#define HAVE_SYS_IOCTL_H 1
-
-/* Define if you have the <sys/ndir.h> header file. */
-/* #undef HAVE_SYS_NDIR_H */
-
-/* Define if you have the <sys/param.h> header file. */
-#define HAVE_SYS_PARAM_H 1
-
-/* Define if you have the <sys/select.h> header file. */
-#define HAVE_SYS_SELECT_H 1
-
-/* Define if you have the <sys/signal.h> header file. */
-#define HAVE_SYS_SIGNAL_H 1
-
-/* Define if you have the <sys/time.h> header file. */
-#define HAVE_SYS_TIME_H 1
-
-/* Define if you have the <sys/utsname.h> header file. */
-#define HAVE_SYS_UTSNAME_H 1
-
-/* Define if you have the <syslog.h> header file. */
-#define HAVE_SYSLOG_H 1
-
-/* Define if you have the <termios.h> header file. */
-#define HAVE_TERMIOS_H 1
-
-/* Define if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 1
-
-/* Define if you have the <utmpx.h> header file. */
-#define HAVE_UTMPX_H 1
-
-/* Define if you have the crypt library (-lcrypt). */
-#define HAVE_LIBCRYPT 1
-
-/* Define if you have the nsl library (-lnsl). */
-/* #undef HAVE_LIBNSL */
-
-/* Define if you have the posix library (-lposix). */
-/* #undef HAVE_LIBPOSIX */
-
-/* Define if you have the socket library (-lsocket). */
-/* #undef HAVE_LIBSOCKET */
diff --git a/lib/libopie/opieaccess b/lib/libopie/opieaccess
deleted file mode 100644
index ed57ef13a33a..000000000000
--- a/lib/libopie/opieaccess
+++ /dev/null
@@ -1,13 +0,0 @@
-# $FreeBSD$
-#
-# This file controls whether UNIX passwords are to be permitted. Rules
-# are matched in order, and the search terminates when the first matching
-# rule has been found. Default action is "deny". See opieaccess(5) for
-# more information.
-#
-# Each rule has the form:
-#
-# permit address netmask
-# deny address netmask
-#
-#permit 127.0.0.1 255.255.255.255
diff --git a/lib/libopie/opieextra.c b/lib/libopie/opieextra.c
deleted file mode 100644
index 6e2b6b88328c..000000000000
--- a/lib/libopie/opieextra.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * This file contains routines modified from OpenBSD. Parts are contributed
- * by Todd Miller <millert@openbsd.org>, Theo De Raadt <deraadt@openbsd.org>
- * and possibly others.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <opie.h>
-
-/*
- * opie_haopie()
- *
- * Returns: 1 user doesnt exist, -1 file error, 0 user exists.
- *
- */
-int
-opie_haskey(username)
-char *username;
-{
- struct opie opie;
-
- return opielookup(&opie, username);
-}
-
-/*
- * opie_keyinfo()
- *
- * Returns the current sequence number and
- * seed for the passed user.
- *
- */
-char *
-opie_keyinfo(username)
-char *username;
-{
- int i;
- static char str[OPIE_CHALLENGE_MAX];
- struct opie opie;
-
- i = opiechallenge(&opie, username, str);
- if (i == -1)
- return(0);
-
- return(str);
-}
-
-/*
- * opie_passverify()
- *
- * Check to see if answer is the correct one to the current
- * challenge.
- *
- * Returns: 0 success, -1 failure
- *
- */
-int
-opie_passverify(username, passwd)
-char *username;
-char *passwd;
-{
- int i;
- struct opie opie;
-
- i = opielookup(&opie, username);
- if (i == -1 || i == 1)
- return(-1);
-
- if (opieverify(&opie, passwd) == 0)
- return(opie.opie_n);
-
- return(-1);
-}
-
-#define OPIE_HASH_DEFAULT 1
-
-/* Current hash type (index into opie_hash_types array) */
-static int opie_hash_type = OPIE_HASH_DEFAULT;
-
-struct opie_algorithm_table {
- const char *name;
-};
-
-static struct opie_algorithm_table opie_algorithm_table[] = {
- "md4", "md5"
-};
-
-/* Get current hash type */
-const char *
-opie_get_algorithm()
-{
- return(opie_algorithm_table[opie_hash_type].name);
-}
-
-
diff --git a/lib/libpam/modules/modules.inc b/lib/libpam/modules/modules.inc
index 02debf7a4330..c7040211a590 100644
--- a/lib/libpam/modules/modules.inc
+++ b/lib/libpam/modules/modules.inc
@@ -17,8 +17,6 @@ MODULES += pam_ksu
MODULES += pam_lastlog
MODULES += pam_login_access
MODULES += pam_nologin
-MODULES += pam_opie
-MODULES += pam_opieaccess
MODULES += pam_passwdqc
MODULES += pam_permit
.if ${MK_RADIUS_SUPPORT} != "no"
diff --git a/lib/libpam/modules/pam_chroot/pam_chroot.8 b/lib/libpam/modules/pam_chroot/pam_chroot.8
index 1bb48008d781..990932413dd3 100644
--- a/lib/libpam/modules/pam_chroot/pam_chroot.8
+++ b/lib/libpam/modules/pam_chroot/pam_chroot.8
@@ -81,7 +81,7 @@ the user's home directory.
.El
.Sh SEE ALSO
.Xr pam.conf 5 ,
-.Xr pam 8
+.Xr pam 3
.Sh AUTHORS
The
.Nm
diff --git a/lib/libpam/modules/pam_deny/pam_deny.8 b/lib/libpam/modules/pam_deny/pam_deny.8
index d9544be9b09f..29bd7e1361fd 100644
--- a/lib/libpam/modules/pam_deny/pam_deny.8
+++ b/lib/libpam/modules/pam_deny/pam_deny.8
@@ -77,4 +77,4 @@ authentication attempt was declined.
.Sh SEE ALSO
.Xr syslog 3 ,
.Xr pam.conf 5 ,
-.Xr pam 8
+.Xr pam 3
diff --git a/lib/libpam/modules/pam_echo/pam_echo.8 b/lib/libpam/modules/pam_echo/pam_echo.8
index 3066007dca74..c1811181674a 100644
--- a/lib/libpam/modules/pam_echo/pam_echo.8
+++ b/lib/libpam/modules/pam_echo/pam_echo.8
@@ -80,7 +80,7 @@ expands to the character following the
character.
.Sh SEE ALSO
.Xr pam.conf 5 ,
-.Xr pam 8
+.Xr pam 3
.Sh AUTHORS
The
.Nm
diff --git a/lib/libpam/modules/pam_exec/pam_exec.8 b/lib/libpam/modules/pam_exec/pam_exec.8
index dbd7c1e17007..c31031fd4aa8 100644
--- a/lib/libpam/modules/pam_exec/pam_exec.8
+++ b/lib/libpam/modules/pam_exec/pam_exec.8
@@ -152,13 +152,13 @@ This is useful in shell scripts for instance.
.Sh SEE ALSO
.Xr pam_get_item 3 ,
.Xr pam.conf 5 ,
-.Xr pam 8 ,
-.Xr pam_sm_acct_mgmt 8 ,
-.Xr pam_sm_authenticate 8 ,
-.Xr pam_sm_chauthtok 8 ,
-.Xr pam_sm_close_session 8 ,
-.Xr pam_sm_open_session 8 ,
-.Xr pam_sm_setcred 8
+.Xr pam 3 ,
+.Xr pam_sm_acct_mgmt 3 ,
+.Xr pam_sm_authenticate 3 ,
+.Xr pam_sm_chauthtok 3 ,
+.Xr pam_sm_close_session 3 ,
+.Xr pam_sm_open_session 3 ,
+.Xr pam_sm_setcred 3
.Sh AUTHORS
The
.Nm
diff --git a/lib/libpam/modules/pam_ftpusers/pam_ftpusers.8 b/lib/libpam/modules/pam_ftpusers/pam_ftpusers.8
index 380e3b026c70..80bbf493c41a 100644
--- a/lib/libpam/modules/pam_ftpusers/pam_ftpusers.8
+++ b/lib/libpam/modules/pam_ftpusers/pam_ftpusers.8
@@ -86,7 +86,7 @@ will succeed if and only if the user is not listed in
.Sh SEE ALSO
.Xr ftpusers 5 ,
.Xr pam.conf 5 ,
-.Xr pam 8
+.Xr pam 3
.Sh AUTHORS
The
.Nm
diff --git a/lib/libpam/modules/pam_group/pam_group.8 b/lib/libpam/modules/pam_group/pam_group.8
index 4f368e577c22..477c509201a9 100644
--- a/lib/libpam/modules/pam_group/pam_group.8
+++ b/lib/libpam/modules/pam_group/pam_group.8
@@ -89,7 +89,7 @@ options are mutually exclusive, and that
will fail if both are specified.
.Sh SEE ALSO
.Xr pam.conf 5 ,
-.Xr pam 8
+.Xr pam 3
.Sh AUTHORS
The
.Nm
diff --git a/lib/libpam/modules/pam_guest/pam_guest.8 b/lib/libpam/modules/pam_guest/pam_guest.8
index 0b858d673d56..51332492e7f3 100644
--- a/lib/libpam/modules/pam_guest/pam_guest.8
+++ b/lib/libpam/modules/pam_guest/pam_guest.8
@@ -85,7 +85,7 @@ Requires the guest user to type in the guest account name as password.
.Xr pam_get_item 3 ,
.Xr pam_getenv 3 ,
.Xr pam.conf 5 ,
-.Xr pam 8
+.Xr pam 3
.Sh AUTHORS
The
.Nm
diff --git a/lib/libpam/modules/pam_krb5/pam_krb5.8 b/lib/libpam/modules/pam_krb5/pam_krb5.8
index bd7ac5b9ca0c..d3617aec6e51 100644
--- a/lib/libpam/modules/pam_krb5/pam_krb5.8
+++ b/lib/libpam/modules/pam_krb5/pam_krb5.8
@@ -210,7 +210,7 @@ file containing Kerberos principals that are allowed access.
.Xr passwd 1 ,
.Xr syslog 3 ,
.Xr pam.conf 5 ,
-.Xr pam 8
+.Xr pam 3
.Sh NOTES
Applications should not call
.Fn pam_authenticate
diff --git a/lib/libpam/modules/pam_ksu/pam_ksu.8 b/lib/libpam/modules/pam_ksu/pam_ksu.8
index 614dc9ef78f8..8204fe992495 100644
--- a/lib/libpam/modules/pam_ksu/pam_ksu.8
+++ b/lib/libpam/modules/pam_ksu/pam_ksu.8
@@ -119,4 +119,4 @@ the user is prompted for another password.
.Xr su 1 ,
.Xr syslog 3 ,
.Xr pam.conf 5 ,
-.Xr pam 8
+.Xr pam 3
diff --git a/lib/libpam/modules/pam_lastlog/pam_lastlog.8 b/lib/libpam/modules/pam_lastlog/pam_lastlog.8
index cd75fff05df7..a28b4dc1f4e4 100644
--- a/lib/libpam/modules/pam_lastlog/pam_lastlog.8
+++ b/lib/libpam/modules/pam_lastlog/pam_lastlog.8
@@ -86,11 +86,11 @@ Ignore I/O failures.
.Xr last 1 ,
.Xr w 1 ,
.Xr getutxent 3 ,
-.Xr login 3 ,
-.Xr logout 3 ,
+.Xr ulog_login 3 ,
+.Xr ulog_logout 3 ,
.Xr pam.conf 5 ,
.Xr lastlogin 8 ,
-.Xr pam 8
+.Xr pam 3
.Sh AUTHORS
The
.Nm
diff --git a/lib/libpam/modules/pam_nologin/pam_nologin.8 b/lib/libpam/modules/pam_nologin/pam_nologin.8
index cc94be555d68..544428412a20 100644
--- a/lib/libpam/modules/pam_nologin/pam_nologin.8
+++ b/lib/libpam/modules/pam_nologin/pam_nologin.8
@@ -87,4 +87,4 @@ login attempt was declined.
.Xr login.conf 5 ,
.Xr nologin 5 ,
.Xr pam.conf 5 ,
-.Xr pam 8
+.Xr pam 3
diff --git a/lib/libpam/modules/pam_opie/Makefile b/lib/libpam/modules/pam_opie/Makefile
deleted file mode 100644
index 5df10af706ec..000000000000
--- a/lib/libpam/modules/pam_opie/Makefile
+++ /dev/null
@@ -1,36 +0,0 @@
-# Copyright 2000 James Bloom
-# All rights reserved.
-# Based upon code Copyright 1998 Juniper Networks, Inc.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD$
-
-PACKAGE= runtime
-
-LIB= pam_opie
-SRCS= pam_opie.c
-MAN= pam_opie.8
-
-LIBADD+= opie
-
-.include <bsd.lib.mk>
diff --git a/lib/libpam/modules/pam_opie/Makefile.depend b/lib/libpam/modules/pam_opie/Makefile.depend
deleted file mode 100644
index da2957f739ba..000000000000
--- a/lib/libpam/modules/pam_opie/Makefile.depend
+++ /dev/null
@@ -1,19 +0,0 @@
-# $FreeBSD$
-# Autogenerated - do NOT edit!
-
-DIRDEPS = \
- gnu/lib/csu \
- include \
- include/xlocale \
- lib/${CSU_DIR} \
- lib/libc \
- lib/libcompiler_rt \
- lib/libopie \
- lib/libpam/libpam \
-
-
-.include <dirdeps.mk>
-
-.if ${DEP_RELDIR} == ${_DEP_RELDIR}
-# local dependencies - needed for -jN in clean tree
-.endif
diff --git a/lib/libpam/modules/pam_opie/pam_opie.8 b/lib/libpam/modules/pam_opie/pam_opie.8
deleted file mode 100644
index 968985a6c9f6..000000000000
--- a/lib/libpam/modules/pam_opie/pam_opie.8
+++ /dev/null
@@ -1,123 +0,0 @@
-.\" Copyright (c) 2001 Mark R V Murray
-.\" All rights reserved.
-.\" Copyright (c) 2002 Networks Associates Technology, Inc.
-.\" All rights reserved.
-.\"
-.\" Portions of this software were developed for the FreeBSD Project by
-.\" ThinkSec AS and NAI Labs, the Security Research Division of Network
-.\" Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
-.\" ("CBOSS"), as part of the DARPA CHATS research program.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. The name of the author may not be used to endorse or promote
-.\" products derived from this software without specific prior written
-.\" permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd July 7, 2001
-.Dt PAM_OPIE 8
-.Os
-.Sh NAME
-.Nm pam_opie
-.Nd OPIE PAM module
-.Sh SYNOPSIS
-.Op Ar service-name
-.Ar module-type
-.Ar control-flag
-.Pa pam_opie
-.Op Ar options
-.Sh DESCRIPTION
-The OPIE authentication service module for PAM,
-.Nm
-provides functionality for only one PAM category:
-that of authentication.
-In terms of the
-.Ar module-type
-parameter, this is the
-.Dq Li auth
-feature.
-It also provides a null function for session management.
-.Pp
-Note that this module does not enforce
-.Xr opieaccess 5
-checks.
-There is a separate module,
-.Xr pam_opieaccess 8 ,
-for this purpose.
-.Ss OPIE Authentication Module
-The OPIE authentication component
-provides functions to verify the identity of a user
-.Pq Fn pam_sm_authenticate ,
-which obtains the relevant
-.Xr opie 4
-credentials.
-It provides the user with an OPIE challenge,
-and verifies that this is correct with
-.Xr opiechallenge 3 .
-.Pp
-The following options may be passed to the authentication module:
-.Bl -tag -width ".Cm auth_as_self"
-.It Cm debug
-.Xr syslog 3
-debugging information at
-.Dv LOG_DEBUG
-level.
-.It Cm auth_as_self
-This option will require the user
-to authenticate himself as the user
-given by
-.Xr getlogin 2 ,
-not as the account they are attempting to access.
-This is primarily for services like
-.Xr su 1 ,
-where the user's ability to retype
-their own password
-might be deemed sufficient.
-.It Cm no_fake_prompts
-Do not generate fake challenges for users who do not have an OPIE key.
-Note that this can leak information to a hypothetical attacker about
-who uses OPIE and who does not, but it can be useful on systems where
-some users want to use OPIE but most do not.
-.El
-.Pp
-Note that
-.Nm
-ignores the standard options
-.Cm try_first_pass
-and
-.Cm use_first_pass ,
-since a challenge must be generated before the user can submit a valid
-response.
-.Sh FILES
-.Bl -tag -width ".Pa /etc/opiekeys" -compact
-.It Pa /etc/opiekeys
-default OPIE password database.
-.El
-.Sh SEE ALSO
-.Xr passwd 1 ,
-.Xr getlogin 2 ,
-.Xr opiechallenge 3 ,
-.Xr syslog 3 ,
-.Xr opie 4 ,
-.Xr pam.conf 5 ,
-.Xr pam 8
diff --git a/lib/libpam/modules/pam_opie/pam_opie.c b/lib/libpam/modules/pam_opie/pam_opie.c
deleted file mode 100644
index 41ad84b751bc..000000000000
--- a/lib/libpam/modules/pam_opie/pam_opie.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-3-Clause
- *
- * Copyright 2000 James Bloom
- * All rights reserved.
- * Based upon code Copyright 1998 Juniper Networks, Inc.
- * Copyright (c) 2001-2003 Networks Associates Technology, Inc.
- * All rights reserved.
- *
- * Portions of this software were developed for the FreeBSD Project by
- * ThinkSec AS and NAI Labs, the Security Research Division of Network
- * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
- * ("CBOSS"), as part of the DARPA CHATS research program.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <opie.h>
-#include <pwd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#define PAM_SM_AUTH
-
-#include <security/pam_appl.h>
-#include <security/pam_modules.h>
-#include <security/pam_mod_misc.h>
-
-#define PAM_OPT_NO_FAKE_PROMPTS "no_fake_prompts"
-
-PAM_EXTERN int
-pam_sm_authenticate(pam_handle_t *pamh, int flags __unused,
- int argc __unused, const char *argv[] __unused)
-{
- struct opie opie;
- struct passwd *pwd;
- int retval, i;
- const char *(promptstr[]) = { "%s\nPassword: ", "%s\nPassword [echo on]: "};
- char challenge[OPIE_CHALLENGE_MAX + 1];
- char principal[OPIE_PRINCIPAL_MAX];
- const char *user;
- char *response;
- int style;
-
- user = NULL;
- if (openpam_get_option(pamh, PAM_OPT_AUTH_AS_SELF)) {
- if ((pwd = getpwnam(getlogin())) == NULL)
- return (PAM_AUTH_ERR);
- user = pwd->pw_name;
- }
- else {
- retval = pam_get_user(pamh, &user, NULL);
- if (retval != PAM_SUCCESS)
- return (retval);
- }
-
- PAM_LOG("Got user: %s", user);
-
- /*
- * Watch out: libopie feels entitled to truncate the user name
- * passed to it if it's longer than OPIE_PRINCIPAL_MAX, which is
- * not uncommon in Windows environments.
- */
- if (strlen(user) >= sizeof(principal))
- return (PAM_AUTH_ERR);
- strlcpy(principal, user, sizeof(principal));
-
- /*
- * Don't call the OPIE atexit() handler when our program exits,
- * since the module has been unloaded and we will SEGV.
- */
- opiedisableaeh();
-
- /*
- * If the no_fake_prompts option was given, and the user
- * doesn't have an OPIE key, just fail rather than present the
- * user with a bogus OPIE challenge.
- */
- if (opiechallenge(&opie, principal, challenge) != 0 &&
- openpam_get_option(pamh, PAM_OPT_NO_FAKE_PROMPTS))
- return (PAM_AUTH_ERR);
-
- /*
- * It doesn't make sense to use a password that has already been
- * typed in, since we haven't presented the challenge to the user
- * yet, so clear the stored password.
- */
- pam_set_item(pamh, PAM_AUTHTOK, NULL);
-
- style = PAM_PROMPT_ECHO_OFF;
- for (i = 0; i < 2; i++) {
- retval = pam_prompt(pamh, style, &response,
- promptstr[i], challenge);
- if (retval != PAM_SUCCESS) {
- opieunlock();
- return (retval);
- }
-
- PAM_LOG("Completed challenge %d: %s", i, response);
-
- if (response[0] != '\0')
- break;
-
- /* Second time round, echo the password */
- style = PAM_PROMPT_ECHO_ON;
- }
-
- pam_set_item(pamh, PAM_AUTHTOK, response);
-
- /*
- * Opieverify is supposed to return -1 only if an error occurs.
- * But it returns -1 even if the response string isn't in the form
- * it expects. Thus we can't log an error and can only check for
- * success or lack thereof.
- */
- retval = opieverify(&opie, response);
- free(response);
- return (retval == 0 ? PAM_SUCCESS : PAM_AUTH_ERR);
-}
-
-PAM_EXTERN int
-pam_sm_setcred(pam_handle_t *pamh __unused, int flags __unused,
- int argc __unused, const char *argv[] __unused)
-{
-
- return (PAM_SUCCESS);
-}
-
-PAM_MODULE_ENTRY("pam_opie");
diff --git a/lib/libpam/modules/pam_opieaccess/Makefile b/lib/libpam/modules/pam_opieaccess/Makefile
deleted file mode 100644
index 426bd8216ce4..000000000000
--- a/lib/libpam/modules/pam_opieaccess/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# $FreeBSD$
-
-PACKAGE= runtime
-
-LIB= pam_opieaccess
-SRCS= ${LIB}.c
-MAN= pam_opieaccess.8
-
-LIBADD+= opie
-
-.include <bsd.lib.mk>
diff --git a/lib/libpam/modules/pam_opieaccess/Makefile.depend b/lib/libpam/modules/pam_opieaccess/Makefile.depend
deleted file mode 100644
index 81514fa091b5..000000000000
--- a/lib/libpam/modules/pam_opieaccess/Makefile.depend
+++ /dev/null
@@ -1,18 +0,0 @@
-# $FreeBSD$
-# Autogenerated - do NOT edit!
-
-DIRDEPS = \
- gnu/lib/csu \
- include \
- lib/${CSU_DIR} \
- lib/libc \
- lib/libcompiler_rt \
- lib/libopie \
- lib/libpam/libpam \
-
-
-.include <dirdeps.mk>
-
-.if ${DEP_RELDIR} == ${_DEP_RELDIR}
-# local dependencies - needed for -jN in clean tree
-.endif
diff --git a/lib/libpam/modules/pam_opieaccess/pam_opieaccess.8 b/lib/libpam/modules/pam_opieaccess/pam_opieaccess.8
deleted file mode 100644
index 5521a85d1d44..000000000000
--- a/lib/libpam/modules/pam_opieaccess/pam_opieaccess.8
+++ /dev/null
@@ -1,142 +0,0 @@
-.\" Copyright (c) 2001 Mark R V Murray
-.\" All rights reserved.
-.\" Copyright (c) 2002 Networks Associates Technology, Inc.
-.\" All rights reserved.
-.\"
-.\" Portions of this software were developed for the FreeBSD Project by
-.\" ThinkSec AS and NAI Labs, the Security Research Division of Network
-.\" Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
-.\" ("CBOSS"), as part of the DARPA CHATS research program.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. The name of the author may not be used to endorse or promote
-.\" products derived from this software without specific prior written
-.\" permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd October 26, 2007
-.Dt PAM_OPIEACCESS 8
-.Os
-.Sh NAME
-.Nm pam_opieaccess
-.Nd OPIEAccess PAM module
-.Sh SYNOPSIS
-.Op Ar service-name
-.Ar module-type
-.Ar control-flag
-.Pa pam_opieaccess
-.Op Ar options
-.Sh DESCRIPTION
-The
-.Nm
-module is used in conjunction with the
-.Xr pam_opie 8
-PAM module to ascertain that authentication can proceed by other means
-(such as the
-.Xr pam_unix 8
-module) even if OPIE authentication failed.
-To properly use this module,
-.Xr pam_opie 8
-should be marked
-.Dq Li sufficient ,
-and
-.Nm
-should be listed right below it and marked
-.Dq Li requisite .
-.Pp
-The
-.Nm
-module provides functionality for only one PAM category:
-authentication.
-In terms of the
-.Ar module-type
-parameter, this is the
-.Dq Li auth
-feature.
-It also provides null functions for the remaining module types.
-.Ss OPIEAccess Authentication Module
-The authentication component
-.Pq Fn pam_sm_authenticate ,
-returns
-.Dv PAM_SUCCESS
-in two cases:
-.Bl -enum
-.It
-The user does not have OPIE enabled.
-.It
-The user has OPIE enabled, and the remote host is listed as a trusted
-host in
-.Pa /etc/opieaccess ,
-and the user does not have a file named
-.Pa \&.opiealways
-in his home directory.
-.El
-.Pp
-Otherwise, it returns
-.Dv PAM_AUTH_ERR .
-.Pp
-The following options may be passed to the authentication module:
-.Bl -tag -width ".Cm allow_local"
-.It Cm allow_local
-Normally, local logins are subjected to the same restrictions as
-remote logins from
-.Dq localhost .
-This option causes
-.Nm
-to always allow local logins.
-.It Cm debug
-.Xr syslog 3
-debugging information at
-.Dv LOG_DEBUG
-level.
-.It Cm no_warn
-suppress warning messages to the user.
-These messages include reasons why the user's authentication attempt
-was declined.
-.El
-.Sh FILES
-.Bl -tag -width ".Pa $HOME/.opiealways"
-.It Pa /etc/opieaccess
-List of trusted hosts or networks.
-See
-.Xr opieaccess 5
-for a description of its syntax.
-.It Pa $HOME/.opiealways
-The presence of this file makes OPIE mandatory for the user.
-.El
-.Sh SEE ALSO
-.Xr opie 4 ,
-.Xr opieaccess 5 ,
-.Xr pam.conf 5 ,
-.Xr pam 8 ,
-.Xr pam_opie 8
-.Sh AUTHORS
-The
-.Nm
-module and this manual page were developed for the
-.Fx
-Project by
-ThinkSec AS and NAI Labs, the Security Research Division of Network
-Associates, Inc.\& under DARPA/SPAWAR contract N66001-01-C-8035
-.Pq Dq CBOSS ,
-as part of the DARPA CHATS research program.
diff --git a/lib/libpam/modules/pam_opieaccess/pam_opieaccess.c b/lib/libpam/modules/pam_opieaccess/pam_opieaccess.c
deleted file mode 100644
index 090d98e5f2a6..000000000000
--- a/lib/libpam/modules/pam_opieaccess/pam_opieaccess.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-3-Clause
- *
- * Copyright (c) 2002 Networks Associates Technology, Inc.
- * All rights reserved.
- *
- * This software was developed for the FreeBSD Project by ThinkSec AS and
- * NAI Labs, the Security Research Division of Network Associates, Inc.
- * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
- * DARPA CHATS research program.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#define _BSD_SOURCE
-
-#include <sys/types.h>
-#include <opie.h>
-#include <pwd.h>
-#include <unistd.h>
-#include <syslog.h>
-
-#define PAM_SM_AUTH
-
-#include <security/pam_appl.h>
-#include <security/pam_modules.h>
-#include <security/pam_mod_misc.h>
-
-PAM_EXTERN int
-pam_sm_authenticate(pam_handle_t *pamh, int flags __unused,
- int argc __unused, const char *argv[] __unused)
-{
- struct opie opie;
- struct passwd *pwent;
- const void *luser, *rhost;
- int r;
-
- r = pam_get_item(pamh, PAM_USER, &luser);
- if (r != PAM_SUCCESS)
- return (r);
- if (luser == NULL)
- return (PAM_SERVICE_ERR);
-
- pwent = getpwnam(luser);
- if (pwent == NULL || opielookup(&opie, __DECONST(char *, luser)) != 0)
- return (PAM_SUCCESS);
-
- r = pam_get_item(pamh, PAM_RHOST, &rhost);
- if (r != PAM_SUCCESS)
- return (r);
- if (rhost == NULL || *(const char *)rhost == '\0')
- rhost = openpam_get_option(pamh, "allow_local") ?
- "" : "localhost";
-
- if (opieaccessfile(__DECONST(char *, rhost)) != 0 &&
- opiealways(pwent->pw_dir) != 0)
- return (PAM_SUCCESS);
-
- PAM_VERBOSE_ERROR("Refused; remote host is not in opieaccess");
-
- return (PAM_AUTH_ERR);
-}
-
-PAM_EXTERN int
-pam_sm_setcred(pam_handle_t *pamh __unused, int flags __unused,
- int argc __unused, const char *argv[] __unused)
-{
-
- return (PAM_SUCCESS);
-}
-
-PAM_MODULE_ENTRY("pam_opieaccess");
diff --git a/lib/libpam/modules/pam_passwdqc/pam_passwdqc.8 b/lib/libpam/modules/pam_passwdqc/pam_passwdqc.8
index abdd3907e972..21dd87a5f55f 100644
--- a/lib/libpam/modules/pam_passwdqc/pam_passwdqc.8
+++ b/lib/libpam/modules/pam_passwdqc/pam_passwdqc.8
@@ -251,7 +251,7 @@ is that the former is incompatible with
.Sh SEE ALSO
.Xr getpwnam 3 ,
.Xr pam.conf 5 ,
-.Xr pam 8
+.Xr pam 3
.Sh AUTHORS
The
.Nm
diff --git a/lib/libpam/modules/pam_permit/pam_permit.8 b/lib/libpam/modules/pam_permit/pam_permit.8
index c7d98ab48e16..f71693b88bbd 100644
--- a/lib/libpam/modules/pam_permit/pam_permit.8
+++ b/lib/libpam/modules/pam_permit/pam_permit.8
@@ -72,4 +72,4 @@ level.
.Sh SEE ALSO
.Xr syslog 3 ,
.Xr pam.conf 5 ,
-.Xr pam 8
+.Xr pam 3
diff --git a/lib/libpam/modules/pam_radius/pam_radius.8 b/lib/libpam/modules/pam_radius/pam_radius.8
index 9d12c0b0b6ce..3cf0f173150b 100644
--- a/lib/libpam/modules/pam_radius/pam_radius.8
+++ b/lib/libpam/modules/pam_radius/pam_radius.8
@@ -127,7 +127,7 @@ The standard RADIUS client configuration file for
.Sh SEE ALSO
.Xr passwd 5 ,
.Xr radius.conf 5 ,
-.Xr pam 8
+.Xr pam 3
.Sh HISTORY
The
.Nm
diff --git a/lib/libpam/modules/pam_rhosts/pam_rhosts.8 b/lib/libpam/modules/pam_rhosts/pam_rhosts.8
index 8adfcc6ed5ae..864c8e579d73 100644
--- a/lib/libpam/modules/pam_rhosts/pam_rhosts.8
+++ b/lib/libpam/modules/pam_rhosts/pam_rhosts.8
@@ -82,7 +82,7 @@ do not automatically fail if the target user's UID is 0.
.Sh SEE ALSO
.Xr hosts.equiv 5 ,
.Xr pam.conf 5 ,
-.Xr pam 8
+.Xr pam 3
.Sh AUTHORS
The
.Nm
diff --git a/lib/libpam/modules/pam_rootok/pam_rootok.8 b/lib/libpam/modules/pam_rootok/pam_rootok.8
index 4203fbd246b7..9c42152353f6 100644
--- a/lib/libpam/modules/pam_rootok/pam_rootok.8
+++ b/lib/libpam/modules/pam_rootok/pam_rootok.8
@@ -72,4 +72,4 @@ authentication attempt was declined.
.Sh SEE ALSO
.Xr getuid 2 ,
.Xr pam.conf 5 ,
-.Xr pam 8
+.Xr pam 3
diff --git a/lib/libpam/modules/pam_securetty/pam_securetty.8 b/lib/libpam/modules/pam_securetty/pam_securetty.8
index 5825fb452a7a..99a6277455ca 100644
--- a/lib/libpam/modules/pam_securetty/pam_securetty.8
+++ b/lib/libpam/modules/pam_securetty/pam_securetty.8
@@ -89,4 +89,4 @@ authentication attempt was declined.
.Xr syslog 3 ,
.Xr pam.conf 5 ,
.Xr ttys 5 ,
-.Xr pam 8
+.Xr pam 3
diff --git a/lib/libpam/modules/pam_self/pam_self.8 b/lib/libpam/modules/pam_self/pam_self.8
index d021434770c6..937ff6ef67ea 100644
--- a/lib/libpam/modules/pam_self/pam_self.8
+++ b/lib/libpam/modules/pam_self/pam_self.8
@@ -83,7 +83,7 @@ do not automatically fail if the current real user ID is 0.
.Sh SEE ALSO
.Xr getuid 2 ,
.Xr pam.conf 5 ,
-.Xr pam 8
+.Xr pam 3
.Sh AUTHORS
The
.Nm
diff --git a/lib/libpam/modules/pam_ssh/pam_ssh.8 b/lib/libpam/modules/pam_ssh/pam_ssh.8
index 1afcfc77e6c1..b847c366517d 100644
--- a/lib/libpam/modules/pam_ssh/pam_ssh.8
+++ b/lib/libpam/modules/pam_ssh/pam_ssh.8
@@ -141,7 +141,7 @@ SSH2 Ed25519 key
.Sh SEE ALSO
.Xr ssh-agent 1 ,
.Xr pam.conf 5 ,
-.Xr pam 8
+.Xr pam 3
.Sh AUTHORS
The
.Nm
diff --git a/lib/libpam/modules/pam_tacplus/pam_tacplus.8 b/lib/libpam/modules/pam_tacplus/pam_tacplus.8
index ee8cc78e0d9f..92534aafb925 100644
--- a/lib/libpam/modules/pam_tacplus/pam_tacplus.8
+++ b/lib/libpam/modules/pam_tacplus/pam_tacplus.8
@@ -105,7 +105,7 @@ The standard TACACS+ client configuration file for
.Sh SEE ALSO
.Xr passwd 5 ,
.Xr tacplus.conf 5 ,
-.Xr pam 8
+.Xr pam 3
.Sh HISTORY
The
.Nm
diff --git a/lib/libpam/modules/pam_unix/pam_unix.8 b/lib/libpam/modules/pam_unix/pam_unix.8
index 03f8feaf4ba9..11643df1072d 100644
--- a/lib/libpam/modules/pam_unix/pam_unix.8
+++ b/lib/libpam/modules/pam_unix/pam_unix.8
@@ -206,7 +206,7 @@ password database.
.Xr syslog 3 ,
.Xr nsswitch.conf 5 ,
.Xr passwd 5 ,
-.Xr pam 8 ,
+.Xr pam 3 ,
.Xr pw 8 ,
.Xr yp 8
.Sh BUGS
diff --git a/lib/libpam/modules/pam_unix/pam_unix.c b/lib/libpam/modules/pam_unix/pam_unix.c
index 29588f0af1ea..2e9e272eaa77 100644
--- a/lib/libpam/modules/pam_unix/pam_unix.c
+++ b/lib/libpam/modules/pam_unix/pam_unix.c
@@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$");
#define LOCKED_PREFIX "*LOCKED*"
#define LOCKED_PREFIX_LEN (sizeof(LOCKED_PREFIX) - 1)
-static void makesalt(char []);
+static void makesalt(char [SALTSIZE + 1]);
static char password_hash[] = PASSWORD_HASH;
@@ -87,7 +87,7 @@ static char password_hash[] = PASSWORD_HASH;
* authentication management
*/
PAM_EXTERN int
-pam_sm_authenticate(pam_handle_t *pamh, int flags __unused,
+pam_sm_authenticate(pam_handle_t *pamh, int flags,
int argc __unused, const char *argv[] __unused)
{
login_cap_t *lc;
diff --git a/lib/libpam/pam.d/Makefile b/lib/libpam/pam.d/Makefile
index 1499f916cb17..d3f1f487b846 100644
--- a/lib/libpam/pam.d/Makefile
+++ b/lib/libpam/pam.d/Makefile
@@ -30,14 +30,9 @@ CONFGROUPS+= FTP
FTP+= ftpd
FTPPACKAGE= ftp
+LINKMODE= ${CONFMODE}
afterinstallconfig:
${INSTALL_LINK} ${TAG_ARGS} ${DESTDIR}${CONFDIR}/ftpd ${DESTDIR}${CONFDIR}/ftp
.endif
-.if ${MK_TELNET} != "no"
-CONFGROUPS+= TELNET
-TELNET+= telnetd
-TELNETPACKAGE= telnet
-.endif
-
.include <bsd.prog.mk>
diff --git a/lib/libpam/pam.d/ftpd b/lib/libpam/pam.d/ftpd
index 0d0b0766cc21..a18809abbc6c 100644
--- a/lib/libpam/pam.d/ftpd
+++ b/lib/libpam/pam.d/ftpd
@@ -5,8 +5,6 @@
#
# auth
-auth sufficient pam_opie.so no_warn no_fake_prompts
-auth requisite pam_opieaccess.so no_warn allow_local
#auth sufficient pam_krb5.so no_warn
#auth sufficient pam_ssh.so no_warn try_first_pass
auth required pam_unix.so no_warn try_first_pass
diff --git a/lib/libpam/pam.d/other b/lib/libpam/pam.d/other
index 110aa00e74df..a157337dc2a3 100644
--- a/lib/libpam/pam.d/other
+++ b/lib/libpam/pam.d/other
@@ -5,8 +5,6 @@
#
# auth
-auth sufficient pam_opie.so no_warn no_fake_prompts
-auth requisite pam_opieaccess.so no_warn allow_local
#auth sufficient pam_krb5.so no_warn try_first_pass
#auth sufficient pam_ssh.so no_warn try_first_pass
auth required pam_unix.so no_warn try_first_pass
diff --git a/lib/libpam/pam.d/sshd b/lib/libpam/pam.d/sshd
index b4707c009f49..04b728dd0f89 100644
--- a/lib/libpam/pam.d/sshd
+++ b/lib/libpam/pam.d/sshd
@@ -5,8 +5,6 @@
#
# auth
-auth sufficient pam_opie.so no_warn no_fake_prompts
-auth requisite pam_opieaccess.so no_warn allow_local
#auth sufficient pam_krb5.so no_warn try_first_pass
#auth sufficient pam_ssh.so no_warn try_first_pass
auth required pam_unix.so no_warn try_first_pass
diff --git a/lib/libpam/pam.d/system b/lib/libpam/pam.d/system
index b8b7101e6b85..afaaef33636f 100644
--- a/lib/libpam/pam.d/system
+++ b/lib/libpam/pam.d/system
@@ -5,8 +5,6 @@
#
# auth
-auth sufficient pam_opie.so no_warn no_fake_prompts
-auth requisite pam_opieaccess.so no_warn allow_local
#auth sufficient pam_krb5.so no_warn try_first_pass
#auth sufficient pam_ssh.so no_warn try_first_pass
auth required pam_unix.so no_warn try_first_pass nullok
diff --git a/lib/libpam/pam.d/telnetd b/lib/libpam/pam.d/telnetd
deleted file mode 100644
index fb2f523d4ad1..000000000000
--- a/lib/libpam/pam.d/telnetd
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# $FreeBSD$
-#
-# PAM configuration for the "telnetd" service
-#
-
-# auth
-auth sufficient pam_opie.so no_warn no_fake_prompts
-auth requisite pam_opieaccess.so no_warn allow_local
-#auth sufficient pam_krb5.so no_warn try_first_pass
-#auth sufficient pam_ssh.so no_warn try_first_pass
-auth required pam_unix.so no_warn try_first_pass
-
-# account
-account required pam_nologin.so
-#account required pam_krb5.so
-account required pam_login_access.so
-account required pam_unix.so
-
-# session
-#session optional pam_ssh.so want_agent
-session required pam_lastlog.so no_fail
-
-# password
-#password sufficient pam_krb5.so no_warn try_first_pass
-password required pam_unix.so no_warn try_first_pass
diff --git a/lib/libpam/static_libpam/Makefile.depend b/lib/libpam/static_libpam/Makefile.depend
index c628f1cdc23a..0279c55e6023 100644
--- a/lib/libpam/static_libpam/Makefile.depend
+++ b/lib/libpam/static_libpam/Makefile.depend
@@ -16,8 +16,6 @@ DIRDEPS = \
lib/libpam/modules/pam_lastlog \
lib/libpam/modules/pam_login_access \
lib/libpam/modules/pam_nologin \
- lib/libpam/modules/pam_opie \
- lib/libpam/modules/pam_opieaccess \
lib/libpam/modules/pam_passwdqc \
lib/libpam/modules/pam_permit \
lib/libpam/modules/pam_radius \
diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c
index 3adfb7b94af3..f95f79024bf5 100644
--- a/lib/libpfctl/libpfctl.c
+++ b/lib/libpfctl/libpfctl.c
@@ -224,6 +224,7 @@ pfctl_get_status(int dev)
status->hostid = ntohl(nvlist_get_number(nvl, "hostid"));
status->states = nvlist_get_number(nvl, "states");
status->src_nodes = nvlist_get_number(nvl, "src_nodes");
+ status->syncookies_active = nvlist_get_bool(nvl, "syncookies_active");
strlcpy(status->ifname, nvlist_get_string(nvl, "ifname"),
IFNAMSIZ);
@@ -664,6 +665,9 @@ pfctl_nveth_rule_to_eth_rule(const nvlist_t *nvl, struct pfctl_eth_rule *rule)
rule->anchor_relative = nvlist_get_number(nvl, "anchor_relative");
rule->anchor_wildcard = nvlist_get_number(nvl, "anchor_wildcard");
+ strlcpy(rule->bridge_to, nvlist_get_string(nvl, "bridge_to"),
+ IFNAMSIZ);
+
rule->action = nvlist_get_number(nvl, "action");
}
@@ -811,6 +815,8 @@ pfctl_add_eth_rule(int dev, const struct pfctl_eth_rule *r, const char *anchor,
nvlist_add_number(nvl, "dnpipe", r->dnpipe);
nvlist_add_number(nvl, "dnflags", r->dnflags);
+ nvlist_add_string(nvl, "bridge_to", r->bridge_to);
+
nvlist_add_number(nvl, "action", r->action);
packed = nvlist_pack(nvl, &size);
@@ -1335,17 +1341,25 @@ pfctl_set_syncookies(int dev, const struct pfctl_syncookies *s)
nvlist_t *nvl;
int ret;
uint state_limit;
+ uint64_t lim, hi, lo;
ret = pfctl_get_limit(dev, PF_LIMIT_STATES, &state_limit);
if (ret != 0)
return (ret);
+ lim = state_limit;
+ hi = lim * s->highwater / 100;
+ lo = lim * s->lowwater / 100;
+
+ if (lo == hi)
+ hi++;
+
nvl = nvlist_create(0);
nvlist_add_bool(nvl, "enabled", s->mode != PFCTL_SYNCOOKIES_NEVER);
nvlist_add_bool(nvl, "adaptive", s->mode == PFCTL_SYNCOOKIES_ADAPTIVE);
- nvlist_add_number(nvl, "highwater", state_limit * s->highwater / 100);
- nvlist_add_number(nvl, "lowwater", state_limit * s->lowwater / 100);
+ nvlist_add_number(nvl, "highwater", hi);
+ nvlist_add_number(nvl, "lowwater", lo);
nv.data = nvlist_pack(nvl, &nv.len);
nv.size = nv.len;
diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h
index 261913e1873d..684e73c1815d 100644
--- a/lib/libpfctl/libpfctl.h
+++ b/lib/libpfctl/libpfctl.h
@@ -57,6 +57,7 @@ struct pfctl_status {
uint64_t src_nodes;
char ifname[IFNAMSIZ];
uint8_t pf_chksum[PF_MD5_DIGEST_LENGTH];
+ bool syncookies_active;
struct pfctl_status_counters counters;
struct pfctl_status_counters lcounters;
@@ -102,13 +103,14 @@ struct pfctl_eth_rule {
uint64_t evaluations;
uint64_t packets[2];
uint64_t bytes[2];
- uint32_t last_active_timestamp;
+ time_t last_active_timestamp;
/* Action */
char qname[PF_QNAME_SIZE];
char tagname[PF_TAG_NAME_SIZE];
uint16_t dnpipe;
uint32_t dnflags;
+ char bridge_to[IFNAMSIZ];
uint8_t action;
struct pfctl_eth_anchor *anchor;
@@ -175,7 +177,7 @@ struct pfctl_rule {
uint64_t evaluations;
uint64_t packets[2];
uint64_t bytes[2];
- uint32_t last_active_timestamp;
+ time_t last_active_timestamp;
struct pfi_kif *kif;
struct pfctl_anchor *anchor;
diff --git a/lib/libpmc/Makefile b/lib/libpmc/Makefile
index 46b2622653a7..d33567e5b3f8 100644
--- a/lib/libpmc/Makefile
+++ b/lib/libpmc/Makefile
@@ -43,7 +43,7 @@ SRCS+= libpmc_events.c
WARNS?= 3
-CFLAGS+= -I${.CURDIR}
+CFLAGS+= -I${.CURDIR} -I${SRCTOP}/sys
CWARNFLAGS.gcc+= -Wno-shadow -Wno-cast-align
# Silence warnings about usage of deprecated std::auto_ptr
diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c
index 581c05e0f8ef..d5b5c115a38f 100644
--- a/lib/libpmc/libpmc.c
+++ b/lib/libpmc/libpmc.c
@@ -1440,15 +1440,12 @@ pmc_init(void)
memcpy(&cpu_info.pm_classes[n], &op_cpu_info.pm_classes[n],
sizeof(cpu_info.pm_classes[n]));
- pmc_class_table = malloc(PMC_CLASS_TABLE_SIZE *
+ pmc_class_table = calloc(PMC_CLASS_TABLE_SIZE,
sizeof(struct pmc_class_descr *));
if (pmc_class_table == NULL)
return (-1);
- for (n = 0; n < PMC_CLASS_TABLE_SIZE; n++)
- pmc_class_table[n] = NULL;
-
/*
* Get soft events list.
*/
@@ -1472,20 +1469,98 @@ pmc_init(void)
* Fill in the class table.
*/
n = 0;
+ for (unsigned i = 0; i < PMC_CLASS_TABLE_SIZE; i++) {
+ switch (cpu_info.pm_classes[i].pm_class) {
+#if defined(__amd64__) || defined(__i386__)
+ case PMC_CLASS_TSC:
+ pmc_class_table[n++] = &tsc_class_table_descr;
+ break;
+
+ case PMC_CLASS_K8:
+ pmc_class_table[n++] = &k8_class_table_descr;
+ break;
+#endif
+
+ case PMC_CLASS_SOFT:
+ pmc_class_table[n++] = &soft_class_table_descr;
+ break;
- /* Fill soft events information. */
- pmc_class_table[n++] = &soft_class_table_descr;
+#if defined(__arm__)
+ case PMC_CLASS_ARMV7:
+ switch (cpu_info.pm_cputype) {
+ case PMC_CPU_ARMV7_CORTEX_A8:
+ pmc_class_table[n++] =
+ &cortex_a8_class_table_descr;
+ break;
+ case PMC_CPU_ARMV7_CORTEX_A9:
+ pmc_class_table[n++] =
+ &cortex_a9_class_table_descr;
+ break;
+ default:
+ errno = ENXIO;
+ return (pmc_syscall = -1);
+ }
+ break;
+#endif
#if defined(__aarch64__)
- pmc_class_table[n++] = &cmn600_pmu_class_table_descr;
- pmc_class_table[n++] = &dmc620_pmu_cd2_class_table_descr;
- pmc_class_table[n++] = &dmc620_pmu_c_class_table_descr;
+ case PMC_CLASS_ARMV8:
+ switch (cpu_info.pm_cputype) {
+ case PMC_CPU_ARMV8_CORTEX_A53:
+ pmc_class_table[n++] =
+ &cortex_a53_class_table_descr;
+ break;
+ case PMC_CPU_ARMV8_CORTEX_A57:
+ pmc_class_table[n++] =
+ &cortex_a57_class_table_descr;
+ break;
+ case PMC_CPU_ARMV8_CORTEX_A76:
+ pmc_class_table[n++] =
+ &cortex_a76_class_table_descr;
+ break;
+ default:
+ errno = ENXIO;
+ return (pmc_syscall = -1);
+ }
+ break;
+
+ case PMC_CLASS_DMC620_PMU_CD2:
+ pmc_class_table[n++] =
+ &dmc620_pmu_cd2_class_table_descr;
+ break;
+
+ case PMC_CLASS_DMC620_PMU_C:
+ pmc_class_table[n++] = &dmc620_pmu_c_class_table_descr;
+ break;
+
+ case PMC_CLASS_CMN600_PMU:
+ pmc_class_table[n++] = &cmn600_pmu_class_table_descr;
+ break;
#endif
-#if defined(__amd64__) || defined(__i386__)
- if (cpu_info.pm_cputype != PMC_CPU_GENERIC)
- pmc_class_table[n++] = &tsc_class_table_descr;
+
+#if defined(__powerpc__)
+ case PMC_CLASS_PPC7450:
+ pmc_class_table[n++] = &ppc7450_class_table_descr;
+ break;
+
+ case PMC_CLASS_PPC970:
+ pmc_class_table[n++] = &ppc970_class_table_descr;
+ break;
+
+ case PMC_CLASS_E500:
+ pmc_class_table[n++] = &e500_class_table_descr;
+ break;
#endif
+ default:
+#if defined(DEBUG)
+ printf("pm_class: 0x%x\n",
+ cpu_info.pm_classes[i].pm_class);
+#endif
+ break;
+ }
+ }
+
#define PMC_MDEP_INIT(C) pmc_mdep_event_aliases = C##_aliases
/* Configure the event name parser. */
@@ -1493,7 +1568,6 @@ pmc_init(void)
#if defined(__amd64__) || defined(__i386__)
case PMC_CPU_AMD_K8:
PMC_MDEP_INIT(k8);
- pmc_class_table[n] = &k8_class_table_descr;
break;
#endif
case PMC_CPU_GENERIC:
@@ -1502,39 +1576,31 @@ pmc_init(void)
#if defined(__arm__)
case PMC_CPU_ARMV7_CORTEX_A8:
PMC_MDEP_INIT(cortex_a8);
- pmc_class_table[n] = &cortex_a8_class_table_descr;
break;
case PMC_CPU_ARMV7_CORTEX_A9:
PMC_MDEP_INIT(cortex_a9);
- pmc_class_table[n] = &cortex_a9_class_table_descr;
break;
#endif
#if defined(__aarch64__)
case PMC_CPU_ARMV8_CORTEX_A53:
PMC_MDEP_INIT(cortex_a53);
- pmc_class_table[n] = &cortex_a53_class_table_descr;
break;
case PMC_CPU_ARMV8_CORTEX_A57:
PMC_MDEP_INIT(cortex_a57);
- pmc_class_table[n] = &cortex_a57_class_table_descr;
break;
case PMC_CPU_ARMV8_CORTEX_A76:
PMC_MDEP_INIT(cortex_a76);
- pmc_class_table[n] = &cortex_a76_class_table_descr;
break;
#endif
#if defined(__powerpc__)
case PMC_CPU_PPC_7450:
PMC_MDEP_INIT(ppc7450);
- pmc_class_table[n] = &ppc7450_class_table_descr;
break;
case PMC_CPU_PPC_970:
PMC_MDEP_INIT(ppc970);
- pmc_class_table[n] = &ppc970_class_table_descr;
break;
case PMC_CPU_PPC_E500:
PMC_MDEP_INIT(e500);
- pmc_class_table[n] = &e500_class_table_descr;
break;
#endif
default:
diff --git a/lib/libpmc/pmc.sandybridge.3 b/lib/libpmc/pmc.sandybridge.3
index 97d5d21a6e80..0f45cac48545 100644
--- a/lib/libpmc/pmc.sandybridge.3
+++ b/lib/libpmc/pmc.sandybridge.3
@@ -204,7 +204,7 @@ qualifiers are specified, the default is to enable both.
Sandy Bridge programmable PMCs support the following events:
.Bl -tag -width indent
.It Li LD_BLOCKS.DATA_UNKNOWN
-.Pq EVENT_03H, Umask 01H
+.Pq Event 03H, Umask 01H
Blocked loads due to store buffer blocks with unknown data.
.It Li LD_BLOCKS.STORE_FORWARD
.Pq Event 03H, Umask 02H
@@ -213,7 +213,7 @@ Loads blocked by overlapping with store buffer that cannot be forwarded.
.Pq Event 03H, Umask 08H
# of Split loads blocked due to resource not available.
.It Li LD_BLOCKS.ALL_BLOCK
-.Pq EVENT_03H, Umask 10H
+.Pq Event 03H, Umask 10H
Number of cases where any load is blocked but has no DCU miss.
.It Li MISALIGN_MEM_REF.LOADS
.Pq Event 05H, Umask 01H
@@ -323,10 +323,10 @@ RFOs that miss cache lines.
.Pq Event 27H, Umask 04H
RFOs that hit cache lines in E state.
.It Li L2_STORE_LOCK_RQSTS.HIT_M
-.Pq EVENT_27H, Umask 08H
+.Pq Event 27H, Umask 08H
RFOs that hit cache lines in M state.
.It Li L2_STORE_LOCK_RQSTS.ALL
-.Pq EVENT_27H, Umask 0FH
+.Pq Event 27H, Umask 0FH
RFOs that access cache lines in any state.
.It Li L2_L1D_WB_RQSTS.HIT_E
.Pq Event 28H, Umask 04H
diff --git a/lib/libpmc/pmu-events/arch/x86/broadwell/pipeline.json b/lib/libpmc/pmu-events/arch/x86/broadwell/pipeline.json
index 18d21b94a4b9..6044773c1e9a 100644
--- a/lib/libpmc/pmu-events/arch/x86/broadwell/pipeline.json
+++ b/lib/libpmc/pmu-events/arch/x86/broadwell/pipeline.json
@@ -624,7 +624,7 @@
"CounterHTOff": "0,1,2,3,4,5,6,7",
"EventCode": "0x87",
"EventName": "ILD_STALL.LCP",
- "PublicDescription": "This event counts stalls occured due to changing prefix length (66, 67 or REX.W when they change the length of the decoded instruction). Occurrences counting is proportional to the number of prefixes in a 16B-line. This may result in the following penalties: three-cycle penalty for each LCP in a 16-byte chunk.",
+ "PublicDescription": "This event counts stalls occurred due to changing prefix length (66, 67 or REX.W when they change the length of the decoded instruction). Occurrences counting is proportional to the number of prefixes in a 16B-line. This may result in the following penalties: three-cycle penalty for each LCP in a 16-byte chunk.",
"SampleAfterValue": "2000003",
"UMask": "0x1"
},
@@ -1377,4 +1377,4 @@
"SampleAfterValue": "2000003",
"UMask": "0x1"
}
-] \ No newline at end of file
+]
diff --git a/lib/libpmc/pmu-events/arch/x86/broadwellde/pipeline.json b/lib/libpmc/pmu-events/arch/x86/broadwellde/pipeline.json
index 7580b8af0d13..1c93482e9205 100644
--- a/lib/libpmc/pmu-events/arch/x86/broadwellde/pipeline.json
+++ b/lib/libpmc/pmu-events/arch/x86/broadwellde/pipeline.json
@@ -624,7 +624,7 @@
"CounterHTOff": "0,1,2,3,4,5,6,7",
"EventCode": "0x87",
"EventName": "ILD_STALL.LCP",
- "PublicDescription": "This event counts stalls occured due to changing prefix length (66, 67 or REX.W when they change the length of the decoded instruction). Occurrences counting is proportional to the number of prefixes in a 16B-line. This may result in the following penalties: three-cycle penalty for each LCP in a 16-byte chunk.",
+ "PublicDescription": "This event counts stalls occurred due to changing prefix length (66, 67 or REX.W when they change the length of the decoded instruction). Occurrences counting is proportional to the number of prefixes in a 16B-line. This may result in the following penalties: three-cycle penalty for each LCP in a 16-byte chunk.",
"SampleAfterValue": "2000003",
"UMask": "0x1"
},
@@ -1378,4 +1378,4 @@
"SampleAfterValue": "2000003",
"UMask": "0x1"
}
-] \ No newline at end of file
+]
diff --git a/lib/libpmc/pmu-events/arch/x86/broadwellx/pipeline.json b/lib/libpmc/pmu-events/arch/x86/broadwellx/pipeline.json
index 18d21b94a4b9..6044773c1e9a 100644
--- a/lib/libpmc/pmu-events/arch/x86/broadwellx/pipeline.json
+++ b/lib/libpmc/pmu-events/arch/x86/broadwellx/pipeline.json
@@ -624,7 +624,7 @@
"CounterHTOff": "0,1,2,3,4,5,6,7",
"EventCode": "0x87",
"EventName": "ILD_STALL.LCP",
- "PublicDescription": "This event counts stalls occured due to changing prefix length (66, 67 or REX.W when they change the length of the decoded instruction). Occurrences counting is proportional to the number of prefixes in a 16B-line. This may result in the following penalties: three-cycle penalty for each LCP in a 16-byte chunk.",
+ "PublicDescription": "This event counts stalls occurred due to changing prefix length (66, 67 or REX.W when they change the length of the decoded instruction). Occurrences counting is proportional to the number of prefixes in a 16B-line. This may result in the following penalties: three-cycle penalty for each LCP in a 16-byte chunk.",
"SampleAfterValue": "2000003",
"UMask": "0x1"
},
@@ -1377,4 +1377,4 @@
"SampleAfterValue": "2000003",
"UMask": "0x1"
}
-] \ No newline at end of file
+]
diff --git a/lib/libpmc/pmu-events/arch/x86/cascadelakex/uncore-other.json b/lib/libpmc/pmu-events/arch/x86/cascadelakex/uncore-other.json
index aa460d0c4851..59ab88de1b37 100644
--- a/lib/libpmc/pmu-events/arch/x86/cascadelakex/uncore-other.json
+++ b/lib/libpmc/pmu-events/arch/x86/cascadelakex/uncore-other.json
@@ -1923,7 +1923,7 @@
"EventCode": "0x25",
"EventName": "UNC_UPI_RxL0P_POWER_CYCLES",
"PerPkg": "1",
- "PublicDescription": "Counts cycles when the the receive side (Rx) of the Intel Ultra Path Interconnect(UPI) is in L0p power mode. L0p is a mode where we disable 60% of the UPI lanes, decreasing our bandwidth in order to save power.",
+ "PublicDescription": "Counts cycles when the receive side (Rx) of the Intel Ultra Path Interconnect(UPI) is in L0p power mode. L0p is a mode where we disable 60% of the UPI lanes, decreasing our bandwidth in order to save power.",
"Unit": "UPI LL"
},
{
diff --git a/lib/libpmc/pmu-events/arch/x86/silvermont/pipeline.json b/lib/libpmc/pmu-events/arch/x86/silvermont/pipeline.json
index 03a4c7f26698..5cc383f87448 100644
--- a/lib/libpmc/pmu-events/arch/x86/silvermont/pipeline.json
+++ b/lib/libpmc/pmu-events/arch/x86/silvermont/pipeline.json
@@ -257,7 +257,7 @@
"Counter": "0,1",
"EventCode": "0xCA",
"EventName": "NO_ALLOC_CYCLES.NOT_DELIVERED",
- "PublicDescription": "The NO_ALLOC_CYCLES.NOT_DELIVERED event is used to measure front-end inefficiencies, i.e. when front-end of the machine is not delivering micro-ops to the back-end and the back-end is not stalled. This event can be used to identify if the machine is truly front-end bound. When this event occurs, it is an indication that the front-end of the machine is operating at less than its theoretical peak performance. Background: We can think of the processor pipeline as being divided into 2 broader parts: Front-end and Back-end. Front-end is responsible for fetching the instruction, decoding into micro-ops (uops) in machine understandable format and putting them into a micro-op queue to be consumed by back end. The back-end then takes these micro-ops, allocates the required resources. When all resources are ready, micro-ops are executed. If the back-end is not ready to accept micro-ops from the front-end, then we do not want to count these as front-end bottlenecks. However, whenever we have bottlenecks in the back-end, we will have allocation unit stalls and eventually forcing the front-end to wait until the back-end is ready to receive more UOPS. This event counts the cycles only when back-end is requesting more uops and front-end is not able to provide them. Some examples of conditions that cause front-end efficiencies are: Icache misses, ITLB misses, and decoder restrictions that limit the the front-end bandwidth.",
+ "PublicDescription": "The NO_ALLOC_CYCLES.NOT_DELIVERED event is used to measure front-end inefficiencies, i.e. when front-end of the machine is not delivering micro-ops to the back-end and the back-end is not stalled. This event can be used to identify if the machine is truly front-end bound. When this event occurs, it is an indication that the front-end of the machine is operating at less than its theoretical peak performance. Background: We can think of the processor pipeline as being divided into 2 broader parts: Front-end and Back-end. Front-end is responsible for fetching the instruction, decoding into micro-ops (uops) in machine understandable format and putting them into a micro-op queue to be consumed by back end. The back-end then takes these micro-ops, allocates the required resources. When all resources are ready, micro-ops are executed. If the back-end is not ready to accept micro-ops from the front-end, then we do not want to count these as front-end bottlenecks. However, whenever we have bottlenecks in the back-end, we will have allocation unit stalls and eventually forcing the front-end to wait until the back-end is ready to receive more UOPS. This event counts the cycles only when back-end is requesting more uops and front-end is not able to provide them. Some examples of conditions that cause front-end efficiencies are: Icache misses, ITLB misses, and decoder restrictions that limit the front-end bandwidth.",
"SampleAfterValue": "200003",
"UMask": "0x50"
},
@@ -313,4 +313,4 @@
"SampleAfterValue": "2000003",
"UMask": "0x1"
}
-] \ No newline at end of file
+]
diff --git a/lib/libpmc/pmu-events/arch/x86/skylakex/uncore-other.json b/lib/libpmc/pmu-events/arch/x86/skylakex/uncore-other.json
index aa0f67613c4a..0c96e6924d62 100644
--- a/lib/libpmc/pmu-events/arch/x86/skylakex/uncore-other.json
+++ b/lib/libpmc/pmu-events/arch/x86/skylakex/uncore-other.json
@@ -1852,7 +1852,7 @@
"EventCode": "0x25",
"EventName": "UNC_UPI_RxL0P_POWER_CYCLES",
"PerPkg": "1",
- "PublicDescription": "Counts cycles when the the receive side (Rx) of the Intel Ultra Path Interconnect(UPI) is in L0p power mode. L0p is a mode where we disable 60% of the UPI lanes, decreasing our bandwidth in order to save power.",
+ "PublicDescription": "Counts cycles when the receive side (Rx) of the Intel Ultra Path Interconnect(UPI) is in L0p power mode. L0p is a mode where we disable 60% of the UPI lanes, decreasing our bandwidth in order to save power.",
"Unit": "UPI LL"
},
{
diff --git a/lib/libproc/proc_bkpt.c b/lib/libproc/proc_bkpt.c
index ff37bb7c4461..46c2d583fe29 100644
--- a/lib/libproc/proc_bkpt.c
+++ b/lib/libproc/proc_bkpt.c
@@ -57,9 +57,6 @@ __FBSDID("$FreeBSD$");
#elif defined(__arm__)
#define BREAKPOINT_INSTR 0xe7ffffff /* bkpt */
#define BREAKPOINT_INSTR_SZ 4
-#elif defined(__mips__)
-#define BREAKPOINT_INSTR 0xd /* break */
-#define BREAKPOINT_INSTR_SZ 4
#elif defined(__powerpc__)
#define BREAKPOINT_INSTR 0x7fe00008 /* trap */
#define BREAKPOINT_INSTR_SZ 4
diff --git a/lib/libproc/proc_regs.c b/lib/libproc/proc_regs.c
index da2cba18bbbd..157d355b53fa 100644
--- a/lib/libproc/proc_regs.c
+++ b/lib/libproc/proc_regs.c
@@ -66,8 +66,6 @@ proc_regget(struct proc_handle *phdl, proc_reg_t reg, unsigned long *regvalue)
*regvalue = regs.r_pc;
#elif defined(__i386__)
*regvalue = regs.r_eip;
-#elif defined(__mips__)
- *regvalue = regs.r_regs[PC];
#elif defined(__powerpc__)
*regvalue = regs.pc;
#elif defined(__riscv)
@@ -83,8 +81,6 @@ proc_regget(struct proc_handle *phdl, proc_reg_t reg, unsigned long *regvalue)
*regvalue = regs.r_sp;
#elif defined(__i386__)
*regvalue = regs.r_esp;
-#elif defined(__mips__)
- *regvalue = regs.r_regs[SP];
#elif defined(__powerpc__)
*regvalue = regs.fixreg[1];
#elif defined(__riscv)
@@ -121,8 +117,6 @@ proc_regset(struct proc_handle *phdl, proc_reg_t reg, unsigned long regvalue)
regs.r_pc = regvalue;
#elif defined(__i386__)
regs.r_eip = regvalue;
-#elif defined(__mips__)
- regs.r_regs[PC] = regvalue;
#elif defined(__powerpc__)
regs.pc = regvalue;
#elif defined(__riscv)
@@ -138,8 +132,6 @@ proc_regset(struct proc_handle *phdl, proc_reg_t reg, unsigned long regvalue)
regs.r_sp = regvalue;
#elif defined(__i386__)
regs.r_esp = regvalue;
-#elif defined(__mips__)
- regs.r_regs[SP] = regvalue;
#elif defined(__powerpc__)
regs.fixreg[1] = regvalue;
#elif defined(__riscv)
diff --git a/lib/libproc/proc_sym.c b/lib/libproc/proc_sym.c
index 27b0fc15a2ab..fdcf133d8457 100644
--- a/lib/libproc/proc_sym.c
+++ b/lib/libproc/proc_sym.c
@@ -105,7 +105,7 @@ struct symsort_thunk {
};
static int
-symvalcmp(void *_thunk, const void *a1, const void *a2)
+symvalcmp(const void *a1, const void *a2, void *_thunk)
{
GElf_Sym sym1, sym2;
struct symsort_thunk *thunk;
@@ -192,7 +192,7 @@ load_symtab(Elf *e, struct symtab *symtab, u_long sh_type)
thunk.e = e;
thunk.symtab = symtab;
- qsort_r(symtab->index, nsyms, sizeof(u_int), &thunk, symvalcmp);
+ qsort_r(symtab->index, nsyms, sizeof(u_int), symvalcmp, &thunk);
return (0);
}
diff --git a/lib/libprocstat/libprocstat.h b/lib/libprocstat/libprocstat.h
index 8736870d163e..2432adb1aec3 100644
--- a/lib/libprocstat/libprocstat.h
+++ b/lib/libprocstat/libprocstat.h
@@ -105,6 +105,7 @@
#define PS_FST_FFLAG_HASLOCK 0x4000
struct kinfo_kstack;
+struct kinfo_proc;
struct kinfo_vmentry;
struct procstat;
struct ptrace_lwpinfo;
diff --git a/lib/librpcsec_gss/rpc_gss_get_error.3 b/lib/librpcsec_gss/rpc_gss_get_error.3
index a16c58ee2dc3..498c73576733 100644
--- a/lib/librpcsec_gss/rpc_gss_get_error.3
+++ b/lib/librpcsec_gss/rpc_gss_get_error.3
@@ -46,7 +46,7 @@ A pointer to a structure where the error details will be returned
.Sh SEE ALSO
.Xr gssapi 3 ,
.Xr rpc 3 ,
-.Xr rpcset_gss 3
+.Xr rpcsec_gss 3
.Sh HISTORY
The
.Nm
diff --git a/lib/librpcsec_gss/rpc_gss_get_mech_info.3 b/lib/librpcsec_gss/rpc_gss_get_mech_info.3
index 8fcade3fe609..9c3f2f0909be 100644
--- a/lib/librpcsec_gss/rpc_gss_get_mech_info.3
+++ b/lib/librpcsec_gss/rpc_gss_get_mech_info.3
@@ -56,7 +56,7 @@ otherwise
.Sh SEE ALSO
.Xr gssapi 3 ,
.Xr rpc 3 ,
-.Xr rpcset_gss 3
+.Xr rpcsec_gss 3
.Sh HISTORY
The
.Nm
diff --git a/lib/librpcsec_gss/rpc_gss_get_mechanisms.3 b/lib/librpcsec_gss/rpc_gss_get_mechanisms.3
index 224ab42e8db2..e35a1b381b83 100644
--- a/lib/librpcsec_gss/rpc_gss_get_mechanisms.3
+++ b/lib/librpcsec_gss/rpc_gss_get_mechanisms.3
@@ -43,7 +43,7 @@ terminated list of installed security mechanisms.
.Sh SEE ALSO
.Xr gssapi 3 ,
.Xr rpc 3 ,
-.Xr rpcset_gss 3
+.Xr rpcsec_gss 3
.Sh HISTORY
The
.Nm
diff --git a/lib/librpcsec_gss/rpc_gss_get_principal_name.3 b/lib/librpcsec_gss/rpc_gss_get_principal_name.3
index ba12835aa43c..001c15ab1e23 100644
--- a/lib/librpcsec_gss/rpc_gss_get_principal_name.3
+++ b/lib/librpcsec_gss/rpc_gss_get_principal_name.3
@@ -70,7 +70,7 @@ otherwise
.Xr gss_export_name 3 ,
.Xr gssapi 3 ,
.Xr rpc 3 ,
-.Xr rpcset_gss 3
+.Xr rpcsec_gss 3
.Sh HISTORY
The
.Nm
diff --git a/lib/librpcsec_gss/rpc_gss_get_versions.3 b/lib/librpcsec_gss/rpc_gss_get_versions.3
index 725b2c00262d..1391fdab210c 100644
--- a/lib/librpcsec_gss/rpc_gss_get_versions.3
+++ b/lib/librpcsec_gss/rpc_gss_get_versions.3
@@ -52,7 +52,7 @@ is set to the lowest supported protocol version
.Sh SEE ALSO
.Xr gssapi 3 ,
.Xr rpc 3 ,
-.Xr rpcset_gss 3
+.Xr rpcsec_gss 3
.Sh HISTORY
The
.Nm
diff --git a/lib/librpcsec_gss/rpc_gss_getcred.3 b/lib/librpcsec_gss/rpc_gss_getcred.3
index 3bb4b6d4432f..126cd55e53be 100644
--- a/lib/librpcsec_gss/rpc_gss_getcred.3
+++ b/lib/librpcsec_gss/rpc_gss_getcred.3
@@ -73,7 +73,7 @@ otherwise.
.Xr gssapi 3 ,
.Xr rpc 3 ,
.Xr rpc_gss_set_callback 3 ,
-.Xr rpcset_gss 3
+.Xr rpcsec_gss 3
.Sh HISTORY
The
.Nm
diff --git a/lib/librpcsec_gss/rpc_gss_is_installed.3 b/lib/librpcsec_gss/rpc_gss_is_installed.3
index 20df8bd2d9fb..d09433b15bdb 100644
--- a/lib/librpcsec_gss/rpc_gss_is_installed.3
+++ b/lib/librpcsec_gss/rpc_gss_is_installed.3
@@ -53,7 +53,7 @@ otherwise.
.Sh SEE ALSO
.Xr gssapi 3 ,
.Xr rpc 3 ,
-.Xr rpcset_gss 3
+.Xr rpcsec_gss 3
.Sh HISTORY
The
.Nm
diff --git a/lib/librpcsec_gss/rpc_gss_max_data_length.3 b/lib/librpcsec_gss/rpc_gss_max_data_length.3
index 6438ab8109ed..40c1c9f2b54f 100644
--- a/lib/librpcsec_gss/rpc_gss_max_data_length.3
+++ b/lib/librpcsec_gss/rpc_gss_max_data_length.3
@@ -52,7 +52,7 @@ The maximum message size that can be encoded
.Sh SEE ALSO
.Xr gssapi 3 ,
.Xr rpc 3 ,
-.Xr rpcset_gss 3
+.Xr rpcsec_gss 3
.Sh HISTORY
The
.Nm
diff --git a/lib/librpcsec_gss/rpc_gss_mech_to_oid.3 b/lib/librpcsec_gss/rpc_gss_mech_to_oid.3
index 626888002bb6..045ad7001267 100644
--- a/lib/librpcsec_gss/rpc_gss_mech_to_oid.3
+++ b/lib/librpcsec_gss/rpc_gss_mech_to_oid.3
@@ -56,7 +56,7 @@ is returned, otherwise
.Sh SEE ALSO
.Xr gssapi 3 ,
.Xr rpc 3 ,
-.Xr rpcset_gss 3
+.Xr rpcsec_gss 3
.Sh HISTORY
The
.Nm
diff --git a/lib/librpcsec_gss/rpc_gss_oid_to_mech.3 b/lib/librpcsec_gss/rpc_gss_oid_to_mech.3
index 175e36173520..785d69f0b990 100644
--- a/lib/librpcsec_gss/rpc_gss_oid_to_mech.3
+++ b/lib/librpcsec_gss/rpc_gss_oid_to_mech.3
@@ -56,7 +56,7 @@ is returned, otherwise
.Sh SEE ALSO
.Xr gssapi 3 ,
.Xr rpc 3 ,
-.Xr rpcset_gss 3
+.Xr rpcsec_gss 3
.Sh HISTORY
The
.Nm
diff --git a/lib/librpcsec_gss/rpc_gss_qop_to_num.3 b/lib/librpcsec_gss/rpc_gss_qop_to_num.3
index 4041e80accaa..b2bbd807c43a 100644
--- a/lib/librpcsec_gss/rpc_gss_qop_to_num.3
+++ b/lib/librpcsec_gss/rpc_gss_qop_to_num.3
@@ -58,7 +58,7 @@ is returned, otherwise
.Sh SEE ALSO
.Xr gssapi 3 ,
.Xr rpc 3 ,
-.Xr rpcset_gss 3
+.Xr rpcsec_gss 3
.Sh HISTORY
The
.Nm
diff --git a/lib/librpcsec_gss/rpc_gss_seccreate.3 b/lib/librpcsec_gss/rpc_gss_seccreate.3
index 7e9bc3483fd8..b16fc9cc8b7b 100644
--- a/lib/librpcsec_gss/rpc_gss_seccreate.3
+++ b/lib/librpcsec_gss/rpc_gss_seccreate.3
@@ -98,7 +98,7 @@ to this value.
.Sh SEE ALSO
.Xr gssapi 3 ,
.Xr rpc 3 ,
-.Xr rpcset_gss 3 ,
+.Xr rpcsec_gss 3 ,
.Xr mech 5 ,
.Xr qop 5
.Sh HISTORY
diff --git a/lib/librpcsec_gss/rpc_gss_set_callback.3 b/lib/librpcsec_gss/rpc_gss_set_callback.3
index a988e300c5bf..9b899180b3b3 100644
--- a/lib/librpcsec_gss/rpc_gss_set_callback.3
+++ b/lib/librpcsec_gss/rpc_gss_set_callback.3
@@ -97,7 +97,7 @@ otherwise
.Xr gssapi 3 ,
.Xr rpc 3 ,
.Xr rpc_gss_getcred 3 ,
-.Xr rpcset_gss 3
+.Xr rpcsec_gss 3
.Sh HISTORY
The
.Nm
diff --git a/lib/librpcsec_gss/rpc_gss_set_defaults.3 b/lib/librpcsec_gss/rpc_gss_set_defaults.3
index 983d2c039bc0..96710d930337 100644
--- a/lib/librpcsec_gss/rpc_gss_set_defaults.3
+++ b/lib/librpcsec_gss/rpc_gss_set_defaults.3
@@ -54,11 +54,11 @@ The quality of protection to use or NULL for the default
.Sh RETURN VALUES
Returns
.Dv TRUE
-if the values were set
+if the values were set.
.Sh SEE ALSO
.Xr gssapi 3 ,
.Xr rpc 3 ,
-.Xr rpcset_gss 3
+.Xr rpcsec_gss 3
.Sh HISTORY
The
.Nm
diff --git a/lib/librpcsec_gss/rpc_gss_set_svc_name.3 b/lib/librpcsec_gss/rpc_gss_set_svc_name.3
index 44b15c73c150..fd8b6f08cd47 100644
--- a/lib/librpcsec_gss/rpc_gss_set_svc_name.3
+++ b/lib/librpcsec_gss/rpc_gss_set_svc_name.3
@@ -75,7 +75,7 @@ otherwise.
.Xr gss_acquire_cred 3 ,
.Xr gssapi 3 ,
.Xr rpc 3 ,
-.Xr rpcset_gss 3
+.Xr rpcsec_gss 3
.Sh HISTORY
The
.Nm
diff --git a/lib/librpcsec_gss/rpc_gss_svc_max_data_length.3 b/lib/librpcsec_gss/rpc_gss_svc_max_data_length.3
index 59ee837698ad..3e34a8a9e45a 100644
--- a/lib/librpcsec_gss/rpc_gss_svc_max_data_length.3
+++ b/lib/librpcsec_gss/rpc_gss_svc_max_data_length.3
@@ -52,7 +52,7 @@ The maximum message size that can be encoded
.Sh SEE ALSO
.Xr gssapi 3 ,
.Xr rpc 3 ,
-.Xr rpcset_gss 3
+.Xr rpcsec_gss 3
.Sh HISTORY
The
.Nm
diff --git a/lib/librpcsec_gss/rpcsec_gss.3 b/lib/librpcsec_gss/rpcsec_gss.3
index 966a1e06acd7..92fb19f36341 100644
--- a/lib/librpcsec_gss/rpcsec_gss.3
+++ b/lib/librpcsec_gss/rpcsec_gss.3
@@ -217,7 +217,6 @@ Calculate maximum server message sizes.
.Xr gss_export_name 3 ,
.Xr gssapi 3 ,
.Xr rpc 3 ,
-.Xr rpcset_gss 3 ,
.Xr mech 5 ,
.Xr qop 5
.Sh HISTORY
diff --git a/lib/libsecureboot/openpgp/opgp_sig.c b/lib/libsecureboot/openpgp/opgp_sig.c
index fcf4a708c4c3..eec3469e3457 100644
--- a/lib/libsecureboot/openpgp/opgp_sig.c
+++ b/lib/libsecureboot/openpgp/opgp_sig.c
@@ -75,7 +75,7 @@ initialize (void)
#include <openssl/err.h>
/**
- * @brief intialize OpenSSL
+ * @brief initialize OpenSSL
*/
void
initialize(void)
diff --git a/lib/libsecureboot/vets.c b/lib/libsecureboot/vets.c
index 94475e7cad36..4375dfa76a89 100644
--- a/lib/libsecureboot/vets.c
+++ b/lib/libsecureboot/vets.c
@@ -520,7 +520,7 @@ verify_signer_xcs(br_x509_certificate *xcs,
br_x509_minimal_set_rsa(&mc, &br_rsa_i31_pkcs1_vrfy);
#endif
#if defined(UNIT_TEST) && defined(VE_DEPRECATED_RSA_SHA1_SUPPORT)
- /* This is deprecated! do not enable unless you absoultely have to */
+ /* This is deprecated! do not enable unless you absolutely have to */
br_x509_minimal_set_hash(&mc, br_sha1_ID, &br_sha1_vtable);
#endif
br_x509_minimal_set_hash(&mc, br_sha256_ID, &br_sha256_vtable);
diff --git a/lib/libsysdecode/Makefile.depend b/lib/libsysdecode/Makefile.depend
index e5c1e3fcf5ea..7c789f24ed46 100644
--- a/lib/libsysdecode/Makefile.depend
+++ b/lib/libsysdecode/Makefile.depend
@@ -86,7 +86,6 @@ DIRDEPS = \
lib/libmt \
lib/libnetgraph \
lib/libngatm \
- lib/libopie \
lib/libpam/libpam \
lib/libpcap \
lib/libpmc \
diff --git a/lib/libsysdecode/mktables b/lib/libsysdecode/mktables
index d61ae02205fe..a0ff8ee8516c 100644
--- a/lib/libsysdecode/mktables
+++ b/lib/libsysdecode/mktables
@@ -137,7 +137,7 @@ gen_table "sigtrapcode" "TRAP_[A-Z]+[[:space:]]+[0-9]+" "sys/
gen_table "sockdomain" "PF_[[:alnum:]]+[[:space:]]+" "sys/socket.h"
gen_table "sockfamily" "AF_[[:alnum:]]+[[:space:]]+" "sys/socket.h"
gen_table "sockipproto" "IPPROTO_[[:alnum:]]+[[:space:]]+" "netinet/in.h"
-gen_table "sockopt" "SO_[A-Z]+[[:space:]]+0x[0-9]+" "sys/socket.h"
+gen_table "sockopt" "SO_[A-Z_]+[[:space:]]+0x[0-9]+" "sys/socket.h"
gen_table "sockoptip" "(IP_[[:alnum:]_]+|MCAST_[[:alnum:]_]+_GROUP)[[:space:]]+" "netinet/in.h" "IP_DEFAULT|IP_MIN|IP_MAX|IP_PORTRANGE"
gen_table "sockoptipv6" "IPV6_[[:alnum:]_]+[[:space:]]+[0-9]+" "netinet6/in6.h" "IPV6_ADDR_|IPV6_TAG_DIRECT|IPV6_OPTIONS|IPV6_RECVOPTS|IPV6_RECVRETOPTS|IPV6_RECVDSTADDR|IPV6_RETOPTS|IPV6_2292|IPV6_RECVRTHDRDSTOPTS|IPV6_REACHCONF|IPV6_PKTOPTIONS"
gen_table "sockoptsctp" "SCTP_[[:alnum:]_]+[[:space:]]+[0-9]+" "netinet/sctp.h"
diff --git a/lib/libthr/thread/thr_init.c b/lib/libthr/thread/thr_init.c
index 82bde10a153e..1c4867cb8185 100644
--- a/lib/libthr/thread/thr_init.c
+++ b/lib/libthr/thread/thr_init.c
@@ -37,7 +37,8 @@
__FBSDID("$FreeBSD$");
#include "namespace.h"
-#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/auxv.h>
#include <sys/signalvar.h>
#include <sys/ioctl.h>
#include <sys/link_elf.h>
@@ -433,12 +434,43 @@ init_main_thread(struct pthread *thread)
/* Others cleared to zero by thr_alloc() */
}
-static void
-init_private(void)
+bool
+__thr_get_main_stack_base(char **base)
{
- struct rlimit rlim;
size_t len;
int mib[2];
+
+ if (elf_aux_info(AT_USRSTACKBASE, base, sizeof(*base)) == 0)
+ return (true);
+
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_USRSTACK;
+ len = sizeof(*base);
+ if (sysctl(mib, nitems(mib), base, &len, NULL, 0) == 0)
+ return (true);
+
+ return (false);
+}
+
+bool
+__thr_get_main_stack_lim(size_t *lim)
+{
+ struct rlimit rlim;
+
+ if (elf_aux_info(AT_USRSTACKLIM, lim, sizeof(*lim)) == 0)
+ return (true);
+
+ if (getrlimit(RLIMIT_STACK, &rlim) == 0) {
+ *lim = rlim.rlim_cur;
+ return (true);
+ }
+
+ return (false);
+}
+
+static void
+init_private(void)
+{
char *env, *env_bigstack, *env_splitstack;
_thr_umutex_init(&_mutex_static_lock);
@@ -462,18 +494,15 @@ init_private(void)
if (init_once == 0) {
__thr_pshared_init();
__thr_malloc_init();
+
/* Find the stack top */
- mib[0] = CTL_KERN;
- mib[1] = KERN_USRSTACK;
- len = sizeof (_usrstack);
- if (sysctl(mib, 2, &_usrstack, &len, NULL, 0) == -1)
- PANIC("Cannot get kern.usrstack from sysctl");
+ if (!__thr_get_main_stack_base(&_usrstack))
+ PANIC("Cannot get kern.usrstack");
env_bigstack = getenv("LIBPTHREAD_BIGSTACK_MAIN");
env_splitstack = getenv("LIBPTHREAD_SPLITSTACK_MAIN");
if (env_bigstack != NULL || env_splitstack == NULL) {
- if (getrlimit(RLIMIT_STACK, &rlim) == -1)
+ if (!__thr_get_main_stack_lim(&_thr_stack_initial))
PANIC("Cannot get stack rlimit");
- _thr_stack_initial = rlim.rlim_cur;
}
_thr_is_smp = sysconf(_SC_NPROCESSORS_CONF);
if (_thr_is_smp == -1)
diff --git a/lib/libthr/thread/thr_private.h b/lib/libthr/thread/thr_private.h
index a5bbc5997d30..0e88c6711817 100644
--- a/lib/libthr/thread/thr_private.h
+++ b/lib/libthr/thread/thr_private.h
@@ -1102,6 +1102,8 @@ int _thr_mutex_destroy(pthread_mutex_t *);
int _thr_mutex_unlock(pthread_mutex_t *);
int __Tthr_mutex_lock(pthread_mutex_t *);
int __Tthr_mutex_trylock(pthread_mutex_t *);
+bool __thr_get_main_stack_base(char **base);
+bool __thr_get_main_stack_lim(size_t *lim);
__END_DECLS
__NULLABILITY_PRAGMA_POP
diff --git a/lib/libthr/thread/thr_stack.c b/lib/libthr/thread/thr_stack.c
index b08bafdd9417..3befb740639e 100644
--- a/lib/libthr/thread/thr_stack.c
+++ b/lib/libthr/thread/thr_stack.c
@@ -30,7 +30,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/auxv.h>
#include <sys/mman.h>
#include <sys/queue.h>
#include <sys/resource.h>
@@ -147,21 +148,13 @@ _thr_stack_fix_protection(struct pthread *thrd)
static void
singlethread_map_stacks_exec(void)
{
- int mib[2];
- struct rlimit rlim;
- u_long usrstack;
- size_t len;
+ char *usrstack;
+ size_t stacksz;
- mib[0] = CTL_KERN;
- mib[1] = KERN_USRSTACK;
- len = sizeof(usrstack);
- if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), &usrstack, &len, NULL, 0)
- == -1)
+ if (!__thr_get_main_stack_base(&usrstack) ||
+ !__thr_get_main_stack_lim(&stacksz))
return;
- if (getrlimit(RLIMIT_STACK, &rlim) == -1)
- return;
- mprotect((void *)(uintptr_t)(usrstack - rlim.rlim_cur),
- rlim.rlim_cur, _rtld_get_stack_prot());
+ mprotect(usrstack - stacksz, stacksz, _rtld_get_stack_prot());
}
void
diff --git a/lib/libufs/Makefile b/lib/libufs/Makefile
index a767546f457f..265b072068e2 100644
--- a/lib/libufs/Makefile
+++ b/lib/libufs/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-PACKAGE= runtime
+PACKAGE= ufs
LIB= ufs
SHLIBDIR?= /lib
SHLIB_MAJOR= 7
@@ -20,6 +20,8 @@ MLINKS+= cgread.3 cgput.3
MLINKS+= getinode.3 putinode.3
MLINKS+= sbread.3 sbwrite.3
MLINKS+= sbread.3 sbget.3
+MLINKS+= sbread.3 sbsearch.3
+MLINKS+= sbread.3 sbfind.3
MLINKS+= sbread.3 sbput.3
MLINKS+= ufs_disk_close.3 ufs_disk_fillout.3
MLINKS+= ufs_disk_close.3 ufs_disk_fillout_blank.3
diff --git a/lib/libufs/cgroup.c b/lib/libufs/cgroup.c
index 90b28eadad2c..2058d16e9b6d 100644
--- a/lib/libufs/cgroup.c
+++ b/lib/libufs/cgroup.c
@@ -268,6 +268,10 @@ cgwrite1(struct uufsd *disk, int cg)
static char errmsg[BUFSIZ];
if (cg == disk->d_cg.cg_cgx) {
+ if (ufs_disk_write(disk) == -1) {
+ ERROR(disk, "failed to open disk for writing");
+ return (-1);
+ }
if (cgput(disk->d_fd, &disk->d_fs, &disk->d_cg) == 0)
return (0);
ERROR(disk, NULL);
diff --git a/lib/libufs/libufs.h b/lib/libufs/libufs.h
index cb8774454b38..5dbf9c2a5c28 100644
--- a/lib/libufs/libufs.h
+++ b/lib/libufs/libufs.h
@@ -111,6 +111,8 @@ void ffs_clusteracct(struct fs *, struct cg *, ufs1_daddr_t, int);
void ffs_fragacct(struct fs *, int, int32_t [], int);
int ffs_isblock(struct fs *, u_char *, ufs1_daddr_t);
int ffs_isfreeblock(struct fs *, u_char *, ufs1_daddr_t);
+int ffs_sbsearch(void *, struct fs **, int, char *,
+ int (*)(void *, off_t, void **, int));
void ffs_setblock(struct fs *, u_char *, ufs1_daddr_t);
int ffs_sbget(void *, struct fs **, off_t, int, char *,
int (*)(void *, off_t, void **, int));
@@ -149,9 +151,11 @@ int putinode(struct uufsd *);
* sblock.c
*/
int sbread(struct uufsd *);
+int sbfind(struct uufsd *, int);
int sbwrite(struct uufsd *, int);
/* low level superblock read/write functions */
int sbget(int, struct fs **, off_t, int);
+int sbsearch(int, struct fs **, int);
int sbput(int, struct fs *, int);
/*
diff --git a/lib/libufs/sblock.c b/lib/libufs/sblock.c
index 5708d50aa4f9..4dfa0e79a711 100644
--- a/lib/libufs/sblock.c
+++ b/lib/libufs/sblock.c
@@ -73,6 +73,30 @@ sbread(struct uufsd *disk)
return (handle_disk_read(disk, fs, error));
}
+/*
+ * Make an extensive search to find a superblock. If the superblock
+ * in the standard place cannot be used, try looking for one of the
+ * backup superblocks.
+ *
+ * The flags parameter is made up of the following or'ed together options:
+ *
+ * UFS_NOMSG indicates that superblock inconsistency error messages
+ * should not be printed.
+ *
+ * UFS_NOCSUM causes only the superblock itself to be returned, but does
+ * not read in any auxillary data structures like the cylinder group
+ * summary information.
+ */
+int
+sbfind(struct uufsd *disk, int flags)
+{
+ struct fs *fs;
+ int error;
+
+ error = sbsearch(disk->d_fd, &fs, flags);
+ return (handle_disk_read(disk, fs, error));
+}
+
static int
handle_disk_read(struct uufsd *disk, struct fs *fs, int error)
{
@@ -174,8 +198,27 @@ static int use_pwrite(void *devfd, off_t loc, void *buf, int size);
int
sbget(int devfd, struct fs **fsp, off_t sblockloc, int flags)
{
+ int error;
+
+ error = ffs_sbget(&devfd, fsp, sblockloc, flags, "user", use_pread);
+ fflush(NULL); /* flush any messages */
+ return (error);
+}
+
+/*
+ * Make an extensive search of the devfd device to find a superblock.
+ * If the superblock in the standard place cannot be used, try looking
+ * for one of the backup superblocks. If found, memory is allocated and
+ * returned in fsp.
+ */
+int
+sbsearch(int devfd, struct fs **fsp, int flags)
+{
+ int error;
- return (ffs_sbget(&devfd, fsp, sblockloc, flags, "user", use_pread));
+ error = ffs_sbsearch(&devfd, fsp, flags, "user", use_pread);
+ fflush(NULL); /* flush any messages */
+ return (error);
}
/*
@@ -209,11 +252,10 @@ sbput(int devfd, struct fs *fs, int numaltwrite)
off_t savedactualloc;
int i, error;
- if ((error = ffs_sbput(&devfd, fs, fs->fs_sblockactualloc,
- use_pwrite)) != 0)
+ error = ffs_sbput(&devfd, fs, fs->fs_sblockactualloc, use_pwrite);
+ fflush(NULL); /* flush any messages */
+ if (error != 0 || numaltwrite == 0)
return (error);
- if (numaltwrite == 0)
- return (0);
savedactualloc = fs->fs_sblockactualloc;
if (fs->fs_si != NULL) {
savedcsp = fs->fs_csp;
@@ -223,6 +265,7 @@ sbput(int devfd, struct fs *fs, int numaltwrite)
fs->fs_sblockactualloc = dbtob(fsbtodb(fs, cgsblock(fs, i)));
if ((error = ffs_sbput(&devfd, fs, fs->fs_sblockactualloc,
use_pwrite)) != 0) {
+ fflush(NULL); /* flush any messages */
fs->fs_sblockactualloc = savedactualloc;
fs->fs_csp = savedcsp;
return (error);
@@ -231,6 +274,7 @@ sbput(int devfd, struct fs *fs, int numaltwrite)
fs->fs_sblockactualloc = savedactualloc;
if (fs->fs_si != NULL)
fs->fs_csp = savedcsp;
+ fflush(NULL); /* flush any messages */
return (0);
}
diff --git a/lib/libufs/sbread.3 b/lib/libufs/sbread.3
index f579fc7ffdf1..460699842036 100644
--- a/lib/libufs/sbread.3
+++ b/lib/libufs/sbread.3
@@ -3,19 +3,21 @@
.\" Description:
.\" Manual page for libufs functions:
.\" sbget(3)
+.\" sbsearch(3)
.\" sbput(3)
.\" sbread(3)
+.\" sbfind(3)
.\" sbwrite(3)
.\"
.\" This file is in the public domain.
.\"
.\" $FreeBSD$
.\"
-.Dd September 2, 2020
+.Dd August 8, 2022
.Dt SBREAD 3
.Os
.Sh NAME
-.Nm sbget , sbput , sbread , sbwrite
+.Nm sbget , sbsearch , sbput , sbread , sbfind , sbwrite
.Nd read and write superblocks of a UFS file system
.Sh LIBRARY
.Lb libufs
@@ -29,16 +31,22 @@
.Ft int
.Fn sbget "int devfd" "struct fs **fsp" "off_t sblockloc" "int flags"
.Ft int
+.Fn sbsearch "int devfd" "struct fs **fsp" "int flags"
+.Ft int
.Fn sbput "int devfd" "struct fs *fs" "int numaltwrite"
.Ft int
.Fn sbread "struct uufsd *disk"
.Ft int
+.Fn sbfind "struct uufsd *disk" "int flags"
+.Ft int
.Fn sbwrite "struct uufsd *disk" "int all"
.Sh DESCRIPTION
The
-.Fn sbget
+.Fn sbget ,
+.Fn sbsearch ,
+.Fn sbread ,
and
-.Fn sbread
+.Fn sbfind
functions provide superblock reads for
.Xr libufs 3
consumers.
@@ -52,7 +60,9 @@ consumers.
.Pp
The
.Fn sbget
-function first allocates a buffer to hold the superblock.
+and
+.Fn sbsearch
+functions first allocate a buffer to hold the superblock.
Using the
.Va devfd
file descriptor that references the filesystem disk,
@@ -65,26 +75,38 @@ The value
may be specified for
.Va sblockloc
to request that the standard location for the superblock be read.
+The
+.Fn sbsearch
+function uses the
+.Va devfd
+file descriptor that references the filesystem disk,
+to search first for the superblock at the standard location.
+If it is not found or is too damaged to use
+.Fn sbsearch
+will attempt to find one of the filesystem's alternate superblocks.
Flags are specified by
.Em or Ns 'ing
the following values:
.Pp
-.Bl -tag -width UFS_NOHASHFAIL
-.It Cm UFS_NOHASHFAIL
-Will note if the check hash is wrong but will still return the superblock.
+.Bl -tag -width UFS_NOCSUM
+.It Cm UFS_NOCSUM
+Causes only the superblock itself to be returned, but does not read in any
+auxiliary data structures like the cylinder group summary information.
.It Cm UFS_NOMSG
Indicates that superblock inconsistency error messages should not be printed.
-.It Cm UFS_NOCSUM
-Causes only the superblock itself to be returned, but does not read in any auxiliary data structures like the cylinder group summary information.
.El
.Pp
If successful,
.Fn sbget
-returns a pointer to the buffer containing the superblock in
+and
+.Fn sbsearch
+functions return a pointer to the buffer containing the superblock in
.Va fsp .
The
.Fn sbget
-function is safe to use in threaded applications.
+and
+.Fn sbsearch
+functions are safe to use in threaded applications.
.Pp
The
.Fn sbput
@@ -113,7 +135,19 @@ modified and the on-disk copy needs to be updated.
.Pp
The
.Fn sbread
-function reads the standard filesystem superblock into the
+function reads the standard filesystem superblock.
+The
+.Fn sbfind
+function tries to find a usable superblock.
+It searchs first for the superblock at the standard location.
+If it is not found or is too damaged to use
+.Fn sbfind
+will attempt to find one of the filesystem's alternate superblocks.
+If successful
+.Fn sbread
+and
+.Fn sbfind
+return a superblock in the
.Va d_sb ,
structure embedded in the given user-land UFS disk structure.
.Pp
@@ -131,16 +165,19 @@ value is non-zero.
.Sh RETURN VALUES
.Rv -std sbread sbwrite
The
-.Fn sbget
+.Fn sbget ,
+.Fn sbsearch ,
and
.Fn sbput
functions return the value 0 if successful;
otherwise they return one of the errors described below.
.Sh ERRORS
The errors returned by
-.Fn sbget
+.Fn sbget ,
+.Fn sbsearch ,
+.Fn sbread ,
and
-.Fn sbread
+.Fn sbfind ,
include any of the errors specified for the library function
.Xr bread 3 .
Additionally, they may follow the
diff --git a/lib/libunbound/Makefile b/lib/libunbound/Makefile
index fff53feed15b..4ce8fcb4ab92 100644
--- a/lib/libunbound/Makefile
+++ b/lib/libunbound/Makefile
@@ -23,7 +23,8 @@ SRCS= alloc.c as112.c authzone.c autotrust.c cachedb.c config_file.c \
listen_dnsport.c localzone.c locks.c log.c lookup3.c lruhash.c \
mesh.c mini_event.c modstack.c module.c msgencode.c msgparse.c \
msgreply.c net_help.c netevent.c outbound_list.c outside_network.c \
- packed_rrset.c parse.c parseutil.c random.c rbtree.c redis.c \
+ packed_rrset.c parse.c parseutil.c proxy_protocol.c \
+ random.c rbtree.c redis.c \
regional.c respip.c rpz.c rrdef.c rrset.c rtt.c sbuffer.c slabhash.c \
str2wire.c tcp_conn_limit.c timehist.c tube.c ub_event_pluggable.c \
val_anchor.c val_kcache.c val_kentry.c val_neg.c val_nsec.c \
diff --git a/lib/libusb/Makefile b/lib/libusb/Makefile
index 3cb2fbd7a462..c8f3dda0f1f8 100644
--- a/lib/libusb/Makefile
+++ b/lib/libusb/Makefile
@@ -35,6 +35,12 @@ SRCS+= libusb10_hotplug.c
SRCS+= libusb10_io.c
PCFILES= libusb-0.1.pc libusb-1.0.pc libusb-2.0.pc
+.for pcfile in ${PCFILES}
+${pcfile}: ${pcfile}.in
+ sed -e 's,@libdir@,${LIBDIR},g ; s,@sharedlibdir@,${SHLIBDIR},g ; \
+ s,@includedir@,${INCLUDEDIR},g ;' ${.ALLSRC} > ${.TARGET}
+.endfor
+CLEANFILES+= ${PCFILES}
#
# Cross platform support
@@ -131,6 +137,7 @@ MLINKS += libusb.3 libusb_lock_events.3
MLINKS += libusb.3 libusb_unlock_events.3
MLINKS += libusb.3 libusb_event_handling_ok.3
MLINKS += libusb.3 libusb_event_handler_active.3
+MLINKS += libusb.3 libusb_interrupt_event_handler.3
MLINKS += libusb.3 libusb_lock_event_waiters.3
MLINKS += libusb.3 libusb_unlock_event_waiters.3
MLINKS += libusb.3 libusb_wait_for_event.3
diff --git a/lib/libusb/libusb-0.1.pc b/lib/libusb/libusb-0.1.pc.in
index afd7a9960798..3082594415fd 100644
--- a/lib/libusb/libusb-0.1.pc
+++ b/lib/libusb/libusb-0.1.pc.in
@@ -1,8 +1,9 @@
# $FreeBSD$
prefix=/usr
exec_prefix=${prefix}
-libdir=${exec_prefix}/lib
-includedir=${prefix}/include
+libdir=@libdir@
+sharedlibdir=@sharedlibdir@
+includedir=@includedir@
Name: libusb-0.1
Description: Library that abstracts ways to access USB devices (v0.1)
diff --git a/lib/libusb/libusb-1.0.pc b/lib/libusb/libusb-1.0.pc.in
index b31affadbed6..3a687bed2f10 100644
--- a/lib/libusb/libusb-1.0.pc
+++ b/lib/libusb/libusb-1.0.pc.in
@@ -1,8 +1,9 @@
# $FreeBSD$
prefix=/usr
exec_prefix=${prefix}
-libdir=${exec_prefix}/lib
-includedir=${prefix}/include
+libdir=@libdir@
+sharedlibdir=@sharedlibdir@
+includedir=@includedir@
Name: libusb-1.0
Description: Library that abstracts ways to access USB devices (v1.0)
diff --git a/lib/libusb/libusb-2.0.pc b/lib/libusb/libusb-2.0.pc.in
index 34eabb88ab17..f35a9f7c6518 100644
--- a/lib/libusb/libusb-2.0.pc
+++ b/lib/libusb/libusb-2.0.pc.in
@@ -1,8 +1,9 @@
# $FreeBSD$
prefix=/usr
exec_prefix=${prefix}
-libdir=${exec_prefix}/lib
-includedir=${prefix}/include
+libdir=@libdir@
+sharedlibdir=@sharedlibdir@
+includedir=@includedir@
Name: libusb-2.0
Description: Library that abstracts ways to access USB devices (v2.0)
diff --git a/lib/libusb/libusb.3 b/lib/libusb/libusb.3
index 0d0e2b1a4ef1..d4c638d986e4 100644
--- a/lib/libusb/libusb.3
+++ b/lib/libusb/libusb.3
@@ -1,8 +1,6 @@
.\"
.\" Copyright (c) 2009 Sylvestre Gallon
.\"
-.\" All rights reserved.
-.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
@@ -26,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd June 9, 2020
+.Dd October, 2, 2022
.Dt LIBUSB 3
.Os
.Sh NAME
@@ -604,6 +602,15 @@ Returns 1 if there is a thread handling events and 0 if there
are no threads currently handling events.
.Pp
.Ft void
+.Fn libusb_interrupt_event_handler "libusb_context *ctx"
+Causes the
+.Fn libusb_handle_events
+familiy of functions to return to the caller one time.
+The
+.Fn libusb_handle_events
+functions may be called again after calling this function.
+.Pp
+.Ft void
.Fn libusb_lock_event_waiters "libusb_context *ctx"
Acquire the event_waiters lock.
This lock is designed to be obtained in the
diff --git a/lib/libusb/libusb.h b/lib/libusb/libusb.h
index 3d353402ea06..9eaee671b8b3 100644
--- a/lib/libusb/libusb.h
+++ b/lib/libusb/libusb.h
@@ -550,6 +550,7 @@ void libusb_lock_events(libusb_context * ctx);
void libusb_unlock_events(libusb_context * ctx);
int libusb_event_handling_ok(libusb_context * ctx);
int libusb_event_handler_active(libusb_context * ctx);
+void libusb_interrupt_event_handler(libusb_context *ctx);
void libusb_lock_event_waiters(libusb_context * ctx);
void libusb_unlock_event_waiters(libusb_context * ctx);
int libusb_wait_for_event(libusb_context * ctx, struct timeval *tv);
diff --git a/lib/libusb/libusb10.c b/lib/libusb/libusb10.c
index ecfffde555aa..1fc89fc409f0 100644
--- a/lib/libusb/libusb10.c
+++ b/lib/libusb/libusb10.c
@@ -116,12 +116,16 @@ libusb_set_nonblocking(int f)
fcntl(f, F_SETFL, flags);
}
-static void
-libusb10_wakeup_event_loop(libusb_context *ctx)
+void
+libusb_interrupt_event_handler(libusb_context *ctx)
{
- uint8_t dummy = 0;
+ uint8_t dummy;
int err;
+ if (ctx == NULL)
+ return;
+
+ dummy = 0;
err = write(ctx->ctrl_pipe[1], &dummy, sizeof(dummy));
if (err < (int)sizeof(dummy)) {
/* ignore error, if any */
@@ -545,7 +549,7 @@ libusb_open(libusb_device *dev, libusb_device_handle **devh)
POLLOUT | POLLRDNORM | POLLWRNORM);
/* make sure our event loop detects the new device */
- libusb10_wakeup_event_loop(ctx);
+ libusb_interrupt_event_handler(ctx);
*devh = pdev;
@@ -614,7 +618,7 @@ libusb_close(struct libusb20_device *pdev)
libusb_unref_device(dev);
/* make sure our event loop detects the closed device */
- libusb10_wakeup_event_loop(ctx);
+ libusb_interrupt_event_handler(ctx);
}
libusb_device *
@@ -1443,7 +1447,7 @@ found:
failure:
libusb10_complete_transfer(pxfer0, sxfer, LIBUSB_TRANSFER_ERROR);
/* make sure our event loop spins the done handler */
- libusb10_wakeup_event_loop(dev->ctx);
+ libusb_interrupt_event_handler(dev->ctx);
}
/* The following function must be called unlocked */
@@ -1555,7 +1559,7 @@ libusb_cancel_transfer(struct libusb_transfer *uxfer)
libusb10_complete_transfer(NULL,
sxfer, LIBUSB_TRANSFER_CANCELLED);
/* make sure our event loop spins the done handler */
- libusb10_wakeup_event_loop(dev->ctx);
+ libusb_interrupt_event_handler(dev->ctx);
} else if (pxfer0 == NULL || pxfer1 == NULL) {
/* not started */
retval = LIBUSB_ERROR_NOT_FOUND;
@@ -1566,7 +1570,7 @@ libusb_cancel_transfer(struct libusb_transfer *uxfer)
/* clear transfer pointer */
libusb20_tr_set_priv_sc1(pxfer0, NULL);
/* make sure our event loop spins the done handler */
- libusb10_wakeup_event_loop(dev->ctx);
+ libusb_interrupt_event_handler(dev->ctx);
} else {
libusb20_tr_stop(pxfer0);
/* make sure the queue doesn't stall */
@@ -1580,7 +1584,7 @@ libusb_cancel_transfer(struct libusb_transfer *uxfer)
/* clear transfer pointer */
libusb20_tr_set_priv_sc1(pxfer1, NULL);
/* make sure our event loop spins the done handler */
- libusb10_wakeup_event_loop(dev->ctx);
+ libusb_interrupt_event_handler(dev->ctx);
} else {
libusb20_tr_stop(pxfer1);
/* make sure the queue doesn't stall */
diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c
index 62f1e0a766fb..0c994778dd10 100644
--- a/lib/libvmmapi/vmmapi.c
+++ b/lib/libvmmapi/vmmapi.c
@@ -32,6 +32,7 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/capsicum.h>
#include <sys/sysctl.h>
#include <sys/ioctl.h>
#include <sys/linker.h>
@@ -43,6 +44,7 @@ __FBSDID("$FreeBSD$");
#include <x86/segments.h>
#include <machine/specialreg.h>
+#include <capsicum_helpers.h>
#include <errno.h>
#include <stdbool.h>
#include <stdio.h>
@@ -1466,14 +1468,17 @@ vm_copy_setup(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging,
}
void
-vm_copy_teardown(struct vmctx *ctx __unused, int vcpu __unused,
- struct iovec *iov __unused, int iovcnt __unused)
+vm_copy_teardown(struct iovec *iov __unused, int iovcnt __unused)
{
+ /*
+ * Intentionally empty. This is used by the instruction
+ * emulation code shared with the kernel. The in-kernel
+ * version of this is non-empty.
+ */
}
void
-vm_copyin(struct vmctx *ctx __unused, int vcpu __unused, struct iovec *iov,
- void *vp, size_t len)
+vm_copyin(struct iovec *iov, void *vp, size_t len)
{
const char *src;
char *dst;
@@ -1493,8 +1498,7 @@ vm_copyin(struct vmctx *ctx __unused, int vcpu __unused, struct iovec *iov,
}
void
-vm_copyout(struct vmctx *ctx __unused, int vcpu __unused, const void *vp,
- struct iovec *iov, size_t len)
+vm_copyout(const void *vp, struct iovec *iov, size_t len)
{
const char *src;
char *dst;
@@ -1667,9 +1671,8 @@ vm_rtc_gettime(struct vmctx *ctx, time_t *secs)
}
int
-vm_restart_instruction(void *arg, int vcpu)
+vm_restart_instruction(struct vmctx *ctx, int vcpu)
{
- struct vmctx *ctx = arg;
return (ioctl(ctx->fd, VM_RESTART_INSTRUCTION, &vcpu));
}
@@ -1729,6 +1732,49 @@ vm_get_topology(struct vmctx *ctx,
return (error);
}
+/* Keep in sync with machine/vmm_dev.h. */
+static const cap_ioctl_t vm_ioctl_cmds[] = { VM_RUN, VM_SUSPEND, VM_REINIT,
+ VM_ALLOC_MEMSEG, VM_GET_MEMSEG, VM_MMAP_MEMSEG, VM_MMAP_MEMSEG,
+ VM_MMAP_GETNEXT, VM_MUNMAP_MEMSEG, VM_SET_REGISTER, VM_GET_REGISTER,
+ VM_SET_SEGMENT_DESCRIPTOR, VM_GET_SEGMENT_DESCRIPTOR,
+ VM_SET_REGISTER_SET, VM_GET_REGISTER_SET,
+ VM_SET_KERNEMU_DEV, VM_GET_KERNEMU_DEV,
+ VM_INJECT_EXCEPTION, VM_LAPIC_IRQ, VM_LAPIC_LOCAL_IRQ,
+ VM_LAPIC_MSI, VM_IOAPIC_ASSERT_IRQ, VM_IOAPIC_DEASSERT_IRQ,
+ VM_IOAPIC_PULSE_IRQ, VM_IOAPIC_PINCOUNT, VM_ISA_ASSERT_IRQ,
+ VM_ISA_DEASSERT_IRQ, VM_ISA_PULSE_IRQ, VM_ISA_SET_IRQ_TRIGGER,
+ VM_SET_CAPABILITY, VM_GET_CAPABILITY, VM_BIND_PPTDEV,
+ VM_UNBIND_PPTDEV, VM_MAP_PPTDEV_MMIO, VM_PPTDEV_MSI,
+ VM_PPTDEV_MSIX, VM_UNMAP_PPTDEV_MMIO, VM_PPTDEV_DISABLE_MSIX,
+ VM_INJECT_NMI, VM_STATS, VM_STAT_DESC,
+ VM_SET_X2APIC_STATE, VM_GET_X2APIC_STATE,
+ VM_GET_HPET_CAPABILITIES, VM_GET_GPA_PMAP, VM_GLA2GPA,
+ VM_GLA2GPA_NOFAULT,
+ VM_ACTIVATE_CPU, VM_GET_CPUS, VM_SUSPEND_CPU, VM_RESUME_CPU,
+ VM_SET_INTINFO, VM_GET_INTINFO,
+ VM_RTC_WRITE, VM_RTC_READ, VM_RTC_SETTIME, VM_RTC_GETTIME,
+ VM_RESTART_INSTRUCTION, VM_SET_TOPOLOGY, VM_GET_TOPOLOGY
+};
+
+int
+vm_limit_rights(struct vmctx *ctx)
+{
+ cap_rights_t rights;
+ size_t ncmds;
+
+ cap_rights_init(&rights, CAP_IOCTL, CAP_MMAP_RW);
+ if (caph_rights_limit(ctx->fd, &rights) != 0)
+ return (-1);
+ ncmds = nitems(vm_ioctl_cmds);
+ if (caph_ioctls_limit(ctx->fd, vm_ioctl_cmds, ncmds) != 0)
+ return (-1);
+ return (0);
+}
+
+/*
+ * Avoid using in new code. Operations on the fd should be wrapped here so that
+ * capability rights can be kept in sync.
+ */
int
vm_get_device_fd(struct vmctx *ctx)
{
@@ -1736,32 +1782,11 @@ vm_get_device_fd(struct vmctx *ctx)
return (ctx->fd);
}
+/* Legacy interface, do not use. */
const cap_ioctl_t *
vm_get_ioctls(size_t *len)
{
cap_ioctl_t *cmds;
- /* keep in sync with machine/vmm_dev.h */
- static const cap_ioctl_t vm_ioctl_cmds[] = { VM_RUN, VM_SUSPEND, VM_REINIT,
- VM_ALLOC_MEMSEG, VM_GET_MEMSEG, VM_MMAP_MEMSEG, VM_MMAP_MEMSEG,
- VM_MMAP_GETNEXT, VM_MUNMAP_MEMSEG, VM_SET_REGISTER, VM_GET_REGISTER,
- VM_SET_SEGMENT_DESCRIPTOR, VM_GET_SEGMENT_DESCRIPTOR,
- VM_SET_REGISTER_SET, VM_GET_REGISTER_SET,
- VM_SET_KERNEMU_DEV, VM_GET_KERNEMU_DEV,
- VM_INJECT_EXCEPTION, VM_LAPIC_IRQ, VM_LAPIC_LOCAL_IRQ,
- VM_LAPIC_MSI, VM_IOAPIC_ASSERT_IRQ, VM_IOAPIC_DEASSERT_IRQ,
- VM_IOAPIC_PULSE_IRQ, VM_IOAPIC_PINCOUNT, VM_ISA_ASSERT_IRQ,
- VM_ISA_DEASSERT_IRQ, VM_ISA_PULSE_IRQ, VM_ISA_SET_IRQ_TRIGGER,
- VM_SET_CAPABILITY, VM_GET_CAPABILITY, VM_BIND_PPTDEV,
- VM_UNBIND_PPTDEV, VM_MAP_PPTDEV_MMIO, VM_PPTDEV_MSI,
- VM_PPTDEV_MSIX, VM_UNMAP_PPTDEV_MMIO, VM_PPTDEV_DISABLE_MSIX,
- VM_INJECT_NMI, VM_STATS, VM_STAT_DESC,
- VM_SET_X2APIC_STATE, VM_GET_X2APIC_STATE,
- VM_GET_HPET_CAPABILITIES, VM_GET_GPA_PMAP, VM_GLA2GPA,
- VM_GLA2GPA_NOFAULT,
- VM_ACTIVATE_CPU, VM_GET_CPUS, VM_SUSPEND_CPU, VM_RESUME_CPU,
- VM_SET_INTINFO, VM_GET_INTINFO,
- VM_RTC_WRITE, VM_RTC_READ, VM_RTC_SETTIME, VM_RTC_GETTIME,
- VM_RESTART_INSTRUCTION, VM_SET_TOPOLOGY, VM_GET_TOPOLOGY };
if (len == NULL) {
cmds = malloc(sizeof(vm_ioctl_cmds));
diff --git a/lib/libvmmapi/vmmapi.h b/lib/libvmmapi/vmmapi.h
index 8f5186237801..1be1f19507a9 100644
--- a/lib/libvmmapi/vmmapi.h
+++ b/lib/libvmmapi/vmmapi.h
@@ -43,7 +43,7 @@
* API version for out-of-tree consumers like grub-bhyve for making compile
* time decisions.
*/
-#define VMMAPI_VERSION 0103 /* 2 digit major followed by 2 digit minor */
+#define VMMAPI_VERSION 0104 /* 2 digit major followed by 2 digit minor */
struct iovec;
struct vmctx;
@@ -118,10 +118,10 @@ int vm_mmap_memseg(struct vmctx *ctx, vm_paddr_t gpa, int segid,
int vm_munmap_memseg(struct vmctx *ctx, vm_paddr_t gpa, size_t len);
int vm_create(const char *name);
-int vm_get_device_fd(struct vmctx *ctx);
struct vmctx *vm_open(const char *name);
void vm_close(struct vmctx *ctx);
void vm_destroy(struct vmctx *ctx);
+int vm_limit_rights(struct vmctx *ctx);
int vm_parse_memsize(const char *optarg, size_t *memsize);
int vm_setup_memory(struct vmctx *ctx, size_t len, enum vm_mmap_style s);
void *vm_map_gpa(struct vmctx *ctx, vm_paddr_t gaddr, size_t len);
@@ -195,8 +195,6 @@ int vm_disable_pptdev_msix(struct vmctx *ctx, int bus, int slot, int func);
int vm_get_intinfo(struct vmctx *ctx, int vcpu, uint64_t *i1, uint64_t *i2);
int vm_set_intinfo(struct vmctx *ctx, int vcpu, uint64_t exit_intinfo);
-const cap_ioctl_t *vm_get_ioctls(size_t *len);
-
/*
* Return a pointer to the statistics buffer. Note that this is not MT-safe.
*/
@@ -221,12 +219,9 @@ int vm_get_hpet_capabilities(struct vmctx *ctx, uint32_t *capabilities);
int vm_copy_setup(struct vmctx *ctx, int vcpu, struct vm_guest_paging *pg,
uint64_t gla, size_t len, int prot, struct iovec *iov, int iovcnt,
int *fault);
-void vm_copyin(struct vmctx *ctx, int vcpu, struct iovec *guest_iov,
- void *host_dst, size_t len);
-void vm_copyout(struct vmctx *ctx, int vcpu, const void *host_src,
- struct iovec *guest_iov, size_t len);
-void vm_copy_teardown(struct vmctx *ctx, int vcpu, struct iovec *iov,
- int iovcnt);
+void vm_copyin(struct iovec *guest_iov, void *host_dst, size_t len);
+void vm_copyout(const void *host_src, struct iovec *guest_iov, size_t len);
+void vm_copy_teardown(struct iovec *iov, int iovcnt);
/* RTC */
int vm_rtc_write(struct vmctx *ctx, int offset, uint8_t value);
@@ -243,6 +238,7 @@ int vm_debug_cpus(struct vmctx *ctx, cpuset_t *cpus);
int vm_activate_cpu(struct vmctx *ctx, int vcpu);
int vm_suspend_cpu(struct vmctx *ctx, int vcpu);
int vm_resume_cpu(struct vmctx *ctx, int vcpu);
+int vm_restart_instruction(struct vmctx *vmctx, int vcpu);
/* CPU topology */
int vm_set_topology(struct vmctx *ctx, uint16_t sockets, uint16_t cores,
@@ -266,6 +262,13 @@ void vm_setup_freebsd_gdt(uint64_t *gdtr);
*/
int vm_snapshot_req(struct vm_snapshot_meta *meta);
int vm_restore_time(struct vmctx *ctx);
+
+/*
+ * Deprecated interfaces, do not use them in new code.
+ */
+int vm_get_device_fd(struct vmctx *ctx);
+const cap_ioctl_t *vm_get_ioctls(size_t *len);
+
__END_DECLS
#endif /* _VMMAPI_H_ */
diff --git a/lib/libwrap/Makefile b/lib/libwrap/Makefile
index 71559b17e6ad..a396be5a0899 100644
--- a/lib/libwrap/Makefile
+++ b/lib/libwrap/Makefile
@@ -4,7 +4,7 @@
.include <src.opts.mk>
-PACKAGE= runtime
+PACKAGE= tcpd
CONFS= hosts.allow
LIB= wrap
diff --git a/lib/libz/Makefile b/lib/libz/Makefile
index d6155b6955a6..d8d466805649 100644
--- a/lib/libz/Makefile
+++ b/lib/libz/Makefile
@@ -63,9 +63,9 @@ ZLIB_VERSION!= sed -n '/define.*ZLIB_VERSION/{s,[^0-9.],,gp;q;}' ${ZLIBSRC}/zlib
zlib.pc: zlib.pc.in
sed -e 's,@prefix@,/usr,g ; \
s,@exec_prefix@,$${prefix},g ; \
- s,@libdir@,$${exec_prefix}/lib,g ; \
- s,@sharedlibdir@,$${libdir},g ; \
- s,@includedir@,$${prefix}/include,g ; \
+ s,@libdir@,${LIBDIR},g ; \
+ s,@sharedlibdir@,${SHLIBDIR},g ; \
+ s,@includedir@,${INCLUDEDIR},g ; \
s,@VERSION@,${ZLIB_VERSION},g ;' \
${.ALLSRC} > ${.TARGET}
diff --git a/lib/msun/Makefile b/lib/msun/Makefile
index 2382a9ae3fdb..8cb67f3700b9 100644
--- a/lib/msun/Makefile
+++ b/lib/msun/Makefile
@@ -151,7 +151,7 @@ COMMON_SRCS+= catrig.c catrigf.c \
#COMMON_SRCS+= s_fabs.c s_frexp.c s_isnan.c s_ldexp.c s_modf.c
# Exclude the generic versions of what we provide in the MD area.
-.if defined(ARCH_SRCS)
+.if defined(ARCH_SRCS) && "${MK_MACHDEP_OPTIMIZATIONS}" != no
.for i in ${ARCH_SRCS}
COMMON_SRCS:= ${COMMON_SRCS:N${i:R}.c}
.endfor
diff --git a/lib/msun/i387/s_ceil.S b/lib/msun/i387/s_ceil.S
index 7e099b04f136..71019ec6090f 100644
--- a/lib/msun/i387/s_ceil.S
+++ b/lib/msun/i387/s_ceil.S
@@ -46,7 +46,7 @@ ENTRY(ceil)
orw $0x0800,%dx /* round towards +oo */
andw $0xfbff,%dx
movw %dx,-8(%ebp)
- fldcw -8(%ebp) /* load modfied control word */
+ fldcw -8(%ebp) /* load modified control word */
fldl 8(%ebp); /* round */
frndint
diff --git a/lib/msun/i387/s_ceilf.S b/lib/msun/i387/s_ceilf.S
index e9009c33e736..44480dededac 100644
--- a/lib/msun/i387/s_ceilf.S
+++ b/lib/msun/i387/s_ceilf.S
@@ -18,7 +18,7 @@ ENTRY(ceilf)
orw $0x0800,%dx /* round towards +oo */
andw $0xfbff,%dx
movw %dx,-8(%ebp)
- fldcw -8(%ebp) /* load modfied control word */
+ fldcw -8(%ebp) /* load modified control word */
flds 8(%ebp); /* round */
frndint
diff --git a/lib/msun/i387/s_ceill.S b/lib/msun/i387/s_ceill.S
index 184ef1812db4..8ed48aa1e603 100644
--- a/lib/msun/i387/s_ceill.S
+++ b/lib/msun/i387/s_ceill.S
@@ -16,7 +16,7 @@ ENTRY(ceill)
orw $0x0800,%dx /* round towards +oo */
andw $0xfbff,%dx
movw %dx,-8(%ebp)
- fldcw -8(%ebp) /* load modfied control word */
+ fldcw -8(%ebp) /* load modified control word */
fldt 8(%ebp) /* round */
frndint
diff --git a/lib/msun/i387/s_floor.S b/lib/msun/i387/s_floor.S
index a06c66e4f206..f9d1ab976897 100644
--- a/lib/msun/i387/s_floor.S
+++ b/lib/msun/i387/s_floor.S
@@ -46,7 +46,7 @@ ENTRY(floor)
orw $0x0400,%dx /* round towards -oo */
andw $0xf7ff,%dx
movw %dx,-8(%ebp)
- fldcw -8(%ebp) /* load modfied control word */
+ fldcw -8(%ebp) /* load modified control word */
fldl 8(%ebp); /* round */
frndint
diff --git a/lib/msun/i387/s_floorf.S b/lib/msun/i387/s_floorf.S
index e758d0576fa4..ecd9307f7b3d 100644
--- a/lib/msun/i387/s_floorf.S
+++ b/lib/msun/i387/s_floorf.S
@@ -18,7 +18,7 @@ ENTRY(floorf)
orw $0x0400,%dx /* round towards -oo */
andw $0xf7ff,%dx
movw %dx,-8(%ebp)
- fldcw -8(%ebp) /* load modfied control word */
+ fldcw -8(%ebp) /* load modified control word */
flds 8(%ebp); /* round */
frndint
diff --git a/lib/msun/i387/s_floorl.S b/lib/msun/i387/s_floorl.S
index cbb05f0fc5ea..ae9e91baf216 100644
--- a/lib/msun/i387/s_floorl.S
+++ b/lib/msun/i387/s_floorl.S
@@ -16,7 +16,7 @@ ENTRY(floorl)
orw $0x0400,%dx /* round towards -oo */
andw $0xf7ff,%dx
movw %dx,-8(%ebp)
- fldcw -8(%ebp) /* load modfied control word */
+ fldcw -8(%ebp) /* load modified control word */
fldt 8(%ebp) /* round */
frndint
diff --git a/lib/msun/i387/s_trunc.S b/lib/msun/i387/s_trunc.S
index 0a9ad41a705c..61bbc537556a 100644
--- a/lib/msun/i387/s_trunc.S
+++ b/lib/msun/i387/s_trunc.S
@@ -15,7 +15,7 @@ ENTRY(trunc)
movw -4(%ebp),%dx
orw $0x0c00,%dx /* round towards -oo */
movw %dx,-8(%ebp)
- fldcw -8(%ebp) /* load modfied control word */
+ fldcw -8(%ebp) /* load modified control word */
fldl 8(%ebp) /* round */
frndint
diff --git a/lib/msun/i387/s_truncf.S b/lib/msun/i387/s_truncf.S
index 0583dc8fd680..4c6c3f1f2cab 100644
--- a/lib/msun/i387/s_truncf.S
+++ b/lib/msun/i387/s_truncf.S
@@ -15,7 +15,7 @@ ENTRY(truncf)
movw -4(%ebp),%dx
orw $0x0c00,%dx /* round towards -oo */
movw %dx,-8(%ebp)
- fldcw -8(%ebp) /* load modfied control word */
+ fldcw -8(%ebp) /* load modified control word */
flds 8(%ebp) /* round */
frndint
diff --git a/lib/msun/i387/s_truncl.S b/lib/msun/i387/s_truncl.S
index c3815ad61a68..a52471966b90 100644
--- a/lib/msun/i387/s_truncl.S
+++ b/lib/msun/i387/s_truncl.S
@@ -15,7 +15,7 @@ ENTRY(truncl)
movw -4(%ebp),%dx
orw $0x0c00,%dx /* round towards -oo */
movw %dx,-8(%ebp)
- fldcw -8(%ebp) /* load modfied control word */
+ fldcw -8(%ebp) /* load modified control word */
fldt 8(%ebp) /* round */
frndint
diff --git a/lib/msun/man/clog.3 b/lib/msun/man/clog.3
index 753ce4369993..d971a5c901a3 100644
--- a/lib/msun/man/clog.3
+++ b/lib/msun/man/clog.3
@@ -29,7 +29,7 @@
.Os
.Sh NAME
.Nm clog ,
-.Nm clogf ,
+.Nm clogf
and
.Nm clogl
.Nd complex natural logarithm functions
diff --git a/lib/msun/man/cospi.3 b/lib/msun/man/cospi.3
index b76e1858ed33..4349756b610c 100644
--- a/lib/msun/man/cospi.3
+++ b/lib/msun/man/cospi.3
@@ -60,7 +60,7 @@ and
functions returns
.Fn cos "\(*p \(mu x" .
If \*(Bax\*(Ba \*(Ge 2^(p - 1)
-where p is the floating\(enpoint precision of
+where p is the floating\(enpoint precision of
.Ar x ,
then the returned value is 1 and it has no significance.
.Sh SPECIAL VALUES
@@ -103,7 +103,7 @@ These functions conform to
IEEE Std 754\(tm\(en2008 ,
\(dqIEEE Standard for Floating-Point Arithmetic\(dq
and to
-ISO/IEC TS 18661-4 ,
+ISO/IEC TS 18661-4 ,
\(dqInformation technology \(em Programming languages, their environments,
and system software interfaces \(em Floating\(enpoint extensions for
C\(dq \(em Part 4: Supplementary functions.
diff --git a/lib/msun/man/sinpi.3 b/lib/msun/man/sinpi.3
index 4ae162bd1c74..909c6f341998 100644
--- a/lib/msun/man/sinpi.3
+++ b/lib/msun/man/sinpi.3
@@ -60,7 +60,7 @@ and
functions returns
.Fn sin "\(*p \(mu x" .
If \*(Bax\*(Ba \*(Ge 2^(p - 1)
-where p is the floating\(enpoint precision of
+where p is the floating\(enpoint precision of
.Ar x ,
then the returned value is \*(Pm0 and it has no significance.
.Sh SPECIAL VALUES
@@ -95,7 +95,7 @@ These functions conform to
IEEE Std 754\(tm\(en2008 ,
\(dqIEEE Standard for Floating-Point Arithmetic\(dq
and to
-ISO/IEC TS 18661-4 ,
+ISO/IEC TS 18661-4 ,
\(dqInformation technology \(em Programming languages, their environments,
and system software interfaces \(em Floating\(enpoint extensions for
C\(dq \(em Part 4: Supplementary functions.
diff --git a/lib/msun/man/tanpi.3 b/lib/msun/man/tanpi.3
index 9cbbf4efaf23..41fd0cbd81d4 100644
--- a/lib/msun/man/tanpi.3
+++ b/lib/msun/man/tanpi.3
@@ -49,7 +49,7 @@ The
and
.Fn tanpil
functions compute the tangent of
-.Fa "\(*p \(mu x"
+.Fa "\(*p \(mu x"
and measure angles in half-cycles.
.Sh RETURN VALUES
The
@@ -60,7 +60,7 @@ and
functions returns
.Fn tan "\(*p \(mu x" .
If \*(Bax\*(Ba \*(Ge 2^(p - 1)
-where p is the floating\(enpoint precision of
+where p is the floating\(enpoint precision of
.Ar x ,
then the returned value is \*(Pm0 and it has no significance.
.Sh SPECIAL VALUES
@@ -89,7 +89,7 @@ return an \*(Na and raises an FE_INVALID exception.
.Xr math 3 ,
.Xr sin 3 ,
.Xr sinpi 3 ,
-.Xr tan 3 ,
+.Xr tan 3
.Sh AUTHORS
The half\(encycle trignometric functions were written by
.An Steven G. Kargl Aq Mt kargl@FreeBSD.org .
@@ -98,7 +98,7 @@ These functions conform to
IEEE Std 754\(tm\(en2008 ,
\(dqIEEE Standard for Floating-Point Arithmetic\(dq
and to
-ISO/IEC TS 18661-4 ,
+ISO/IEC TS 18661-4 ,
\(dqInformation technology \(em Programming languages, their environments,
and system software interfaces \(em Floating\(enpoint extensions for
C\(dq \(em Part 4: Supplementary functions.
diff --git a/lib/msun/src/e_jn.c b/lib/msun/src/e_jn.c
index c7ba7da6567b..5aaebd400065 100644
--- a/lib/msun/src/e_jn.c
+++ b/lib/msun/src/e_jn.c
@@ -22,15 +22,15 @@ __FBSDID("$FreeBSD$");
* y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;
* y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
* Note 2. About jn(n,x), yn(n,x)
- * For n=0, j0(x) is called,
- * for n=1, j1(x) is called,
- * for n<x, forward recursion us used starting
+ * For n=0, j0(x) is called.
+ * For n=1, j1(x) is called.
+ * For n<x, forward recursion is used starting
* from values of j0(x) and j1(x).
- * for n>x, a continued fraction approximation to
+ * For n>x, a continued fraction approximation to
* j(n,x)/j(n-1,x) is evaluated and then backward
* recursion is used starting from a supposed value
- * for j(n,x). The resulting value of j(0,x) is
- * compared with the actual value to correct the
+ * for j(n,x). The resulting values of j(0,x) or j(1,x) are
+ * compared with the actual values to correct the
* supposed value of j(n,x).
*
* yn(n,x) is similar in all respects, except
diff --git a/lib/msun/src/e_lgamma_r.c b/lib/msun/src/e_lgamma_r.c
index be70767ec5c0..48da493fe1d2 100644
--- a/lib/msun/src/e_lgamma_r.c
+++ b/lib/msun/src/e_lgamma_r.c
@@ -27,7 +27,7 @@ __FBSDID("$FreeBSD$");
* = log(6.3*5.3) + lgamma(5.3)
* = log(6.3*5.3*4.3*3.3*2.3) + lgamma(2.3)
* 2. Polynomial approximation of lgamma around its
- * minimun ymin=1.461632144968362245 to maintain monotonicity.
+ * minimum ymin=1.461632144968362245 to maintain monotonicity.
* On [ymin-0.23, ymin+0.27] (i.e., [1.23164,1.73163]), use
* Let z = x-ymin;
* lgamma(x) = -1.214862905358496078218 + z^2*poly(z)
diff --git a/lib/msun/src/k_tanf.c b/lib/msun/src/k_tanf.c
index 52f1aaaa0c6c..5be14458b80c 100644
--- a/lib/msun/src/k_tanf.c
+++ b/lib/msun/src/k_tanf.c
@@ -50,7 +50,7 @@ __kernel_tandf(double x, int iy)
* We add the small terms from lowest degree up for efficiency on
* non-sequential machines (the lowest degree terms tend to be ready
* earlier). Apart from this, we don't care about order of
- * operations, and don't need to to care since we have precision to
+ * operations, and don't need to care since we have precision to
* spare. However, the chosen splitting is good for accuracy too,
* and would give results as accurate as Horner's method if the
* small terms were added from highest degree down.
diff --git a/lib/msun/tests/fenv_test.c b/lib/msun/tests/fenv_test.c
index aafdd32b7fbd..7750764406d7 100644
--- a/lib/msun/tests/fenv_test.c
+++ b/lib/msun/tests/fenv_test.c
@@ -401,7 +401,7 @@ ATF_TC_BODY(masking, tc)
/*
* Some CPUs, e.g. AArch64 QEMU does not support trapping on FP
* exceptions. In that case the trap enable bits are all RAZ/WI, so
- * writing to those bits will be ignored and the the next read will
+ * writing to those bits will be ignored and the next read will
* return all zeroes for those bits. Skip the test if no floating
* point exceptions are supported and mark it XFAIL if some are missing.
*/
diff --git a/lib/ncurses/tinfo/Makefile b/lib/ncurses/tinfo/Makefile
index d7b7343dfcdc..fc4e4447562e 100644
--- a/lib/ncurses/tinfo/Makefile
+++ b/lib/ncurses/tinfo/Makefile
@@ -1038,9 +1038,9 @@ gen-pkgconfig: gen-pkgconfig.in
s,@PC_MODULE_SUFFIX@,,g ; \
s,@prefix@,/usr,g ; \
s,@exec_prefix@,$${prefix},g ; \
- s,@includedir@,/usr/include,g ; \
+ s,@includedir@,${INCLUDEDIR},g ; \
s,@includesubdir@,,g ; \
- s,@libdir@,/usr/lib,g ; \
+ s,@libdir@,${LIBDIR},g ; \
s,@RPATH_LIST@,$${libdir},g ; \
s,@PRIVATE_LIBS@,,g ; \
s,@USE_ARG_SUFFIX@,,g ; \
diff --git a/lib/ofed/libirdma/Makefile b/lib/ofed/libirdma/Makefile
index 1280b8a6d7bc..368bd536c587 100644
--- a/lib/ofed/libirdma/Makefile
+++ b/lib/ofed/libirdma/Makefile
@@ -18,6 +18,5 @@ irdma_uk.c \
LIBADD= ibverbs pthread
CFLAGS+= -I${_spath} -I${SRCTOP}/contrib/ofed/libibverbs
VERSION_MAP= ${_spath}/libirdma.map
-CFLAGS+= -ferror-limit=1000
.include <bsd.lib.mk>