aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile7
-rw-r--r--lib/libc/amd64/string/memrchr.S224
-rw-r--r--lib/libc/include/compat.h3
-rw-r--r--lib/libc/regex/regcomp.c1
-rw-r--r--lib/libc/stdio/vfscanf.c5
-rw-r--r--lib/libc/stdio/vfwscanf.c5
-rw-r--r--lib/libc/stdlib/malloc/jemalloc/Makefile.inc12
-rw-r--r--lib/libc/stdlib/malloc/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h91
-rw-r--r--lib/libc/stdlib/malloc/jemalloc/include/jemalloc/internal/jemalloc_preamble.h54
-rw-r--r--lib/libc/stdlib/malloc/jemalloc/include/jemalloc/internal/private_namespace.h481
-rw-r--r--lib/libc/stdlib/malloc/jemalloc/include/jemalloc/internal/public_namespace.h4
-rw-r--r--lib/libc/stdlib/malloc/jemalloc/include/jemalloc/jemalloc.h69
-rw-r--r--lib/libc/stdlib/malloc/jemalloc/include/jemalloc/jemalloc_FreeBSD.h10
-rw-r--r--lib/libc/stdlib/malloc/jemalloc/include/jemalloc/jemalloc_defs.h55
-rw-r--r--lib/libc/stdlib/qsort.c13
-rw-r--r--lib/libc/tests/stdio/flushlbuf_test.c10
-rw-r--r--lib/libc/tests/stdio/sscanf_test.c25
-rw-r--r--lib/libc/tests/stdio/swscanf_test.c25
-rw-r--r--lib/libc/tests/stdlib/Makefile1
-rw-r--r--lib/libc/tests/stdlib/qsort_bench.c113
-rw-r--r--lib/libcasper/services/cap_fileargs/cap_fileargs.3174
-rw-r--r--lib/libmilter/Makefile2
-rw-r--r--lib/libpam/modules/pam_ksu/pam_ksu.c31
-rw-r--r--lib/libregex/tests/gnuext.in6
-rw-r--r--lib/librpcsec_gss/Makefile6
-rw-r--r--lib/libsys/Makefile.sys1
-rw-r--r--lib/libsys/Symbol.sys.map4
-rw-r--r--lib/libsys/_libsys.h12
-rw-r--r--lib/libsys/amd64/amd64_get_fsbase.c7
-rw-r--r--lib/libsys/amd64/amd64_get_gsbase.c7
-rw-r--r--lib/libsys/amd64/amd64_set_fsbase.c7
-rw-r--r--lib/libsys/amd64/amd64_set_gsbase.c7
-rw-r--r--lib/libsys/getgroups.215
-rw-r--r--lib/libsys/pathconf.28
-rw-r--r--lib/libsys/setgroups.236
-rw-r--r--lib/libsys/shm_open.25
-rw-r--r--lib/libsys/syscalls.map10
-rw-r--r--lib/libutil++/Makefile1
-rw-r--r--lib/libutil++/libutil++.hh4
-rw-r--r--lib/libutil/Makefile1
-rw-r--r--lib/libutil/Symbol.map9
-rw-r--r--lib/libutil/expand_number.358
-rw-r--r--lib/libutil/expand_number.c49
-rw-r--r--lib/libutil/libutil.h8
-rw-r--r--lib/libutil/login.conf.57
-rw-r--r--lib/libutil/login_auth.34
-rw-r--r--lib/libutil/login_cap.31
-rw-r--r--lib/libutil/mntopts.310
-rw-r--r--lib/libutil/tests/expand_number_test.c79
-rw-r--r--lib/libutil/uucplock.31
-rw-r--r--lib/msun/bsdsrc/b_tgamma.c2
-rw-r--r--lib/msun/src/e_fmod.c30
-rw-r--r--lib/msun/src/e_fmodf.c16
-rw-r--r--lib/msun/src/math_private.h35
-rw-r--r--lib/msun/src/s_ccosh.c23
-rw-r--r--lib/msun/src/s_ccoshf.c18
-rw-r--r--lib/msun/src/s_csinh.c23
-rw-r--r--lib/msun/src/s_csinhf.c18
-rw-r--r--lib/msun/src/s_ilogb.c13
-rw-r--r--lib/msun/src/s_ilogbf.c5
-rw-r--r--lib/msun/src/s_remquo.c30
-rw-r--r--lib/msun/src/s_remquof.c16
62 files changed, 1441 insertions, 566 deletions
diff --git a/lib/Makefile b/lib/Makefile
index e5139b312a75..9447cc4551c0 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -137,7 +137,9 @@ SUBDIR_DEPEND_libdevstat= libkvm
SUBDIR_DEPEND_libdpv= libfigpar ncurses libutil
SUBDIR_DEPEND_libedit= ncurses
SUBDIR_DEPEND_libgeom= libexpat libsbuf
+.if ${MK_MITKRB5} == "no"
SUBDIR_DEPEND_librpcsec_gss= libgssapi
+.endif
SUBDIR_DEPEND_libmagic= libz
SUBDIR_DEPEND_libmemstat= libkvm
SUBDIR_DEPEND_libpam= libcrypt ${_libradius} librpcsvc libtacplus libutil ${_libypclnt} ${_libcom_err}
@@ -176,7 +178,10 @@ SUBDIR.${MK_DIALOG}+= libdpv libfigpar
SUBDIR.${MK_FDT}+= libfdt
SUBDIR.${MK_FILE}+= libmagic
SUBDIR.${MK_GPIO}+= libgpio
-SUBDIR.${MK_GSSAPI}+= libgssapi librpcsec_gss
+.if ${MK_MITKRB5} == "no"
+SUBDIR.${MK_GSSAPI}+= libgssapi
+.endif
+SUBDIR.${MK_GSSAPI}+= librpcsec_gss
SUBDIR.${MK_ICONV}+= libiconv_modules
.if ${MK_MITKRB5} == "no"
SUBDIR.${MK_KERBEROS_SUPPORT}+= libcom_err
diff --git a/lib/libc/amd64/string/memrchr.S b/lib/libc/amd64/string/memrchr.S
index 4f6c5a238daa..80fb306af2a3 100644
--- a/lib/libc/amd64/string/memrchr.S
+++ b/lib/libc/amd64/string/memrchr.S
@@ -1,7 +1,7 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2023 Robert Clausecker
+ * Copyright (c) 2023, 2025 Robert Clausecker <fuz@FreeBSD.org>
*/
#include <machine/asm.h>
@@ -16,150 +16,142 @@ ARCHFUNCS(memrchr)
ENDARCHFUNCS(memrchr)
ARCHENTRY(memrchr, scalar)
- xor %eax, %eax # prospective return value
- sub $4, %rdx # 4 bytes left to process?
- jb 1f
+ lea -1(%rdi, %rdx, 1), %rax # point to last char in buffer
+ sub $4, %rdx # 4 bytes left to process?
+ jb .Ltail
ALIGN_TEXT
-0: xor %r8, %r8
- lea 2(%rdi), %r10
- cmp %sil, 2(%rdi)
- cmovne %r8, %r10 # point to null if no match
+0: cmp %sil, (%rax) # match at last entry?
+ je 1f
- cmp %sil, (%rdi)
- cmove %rdi, %r8 # point to first char if match
+ cmp %sil, -1(%rax) # match at second to last entry?
+ je 2f
- lea 1(%rdi), %r9
- cmp %sil, 1(%rdi)
- cmovne %r8, %r9 # point to first result if no match in second
+ cmp %sil, -2(%rax) # match at third to last entry?
+ je 3f
- lea 3(%rdi), %r11
- cmp %sil, 3(%rdi)
- cmovne %r10, %r11
+ cmp %sil, -3(%rax) # match at fourth to last entry?
+ je 4f
- test %r11, %r11
- cmovz %r9, %r11 # take first pair match if none in second
+ sub $4, %rax
+ sub $4, %rdx
+ jae 0b
- test %r11, %r11
- cmovnz %r11, %rax # take match in current set if any
+.Ltail: cmp $-3, %edx # at least one character left to process?
+ jb .Lnotfound
- add $4, %rdi
- sub $4, %rdx
- jae 0b
+ cmp %sil, (%rax)
+ je 1f
-1: cmp $-3, %edx # a least one character left to process?
- jb 2f
+ cmp $-2, %edx # at least two characters left to process?
+ jb .Lnotfound
- cmp %sil, (%rdi)
- cmove %rdi, %rax
+ cmp %sil, -1(%rax)
+ je 2f
- lea 1(%rdi), %rcx
- cmp $-2, %edx # at least two characters left to process?
- jb 2f
+ cmp $-1, %edx # at least three characters left to process?
+ jb .Lnotfound
- cmp %sil, 1(%rdi)
- cmove %rcx, %rax
+ cmp %sil, -2(%rax)
+ je 3f
- lea 2(%rdi), %rcx
- cmp $-1, %edx # at least three character left to process?
- jb 2f
-
- cmp %sil, 2(%rdi)
- cmove %rcx, %rax
+.Lnotfound:
+ xor %eax, %eax
+ ret
-2: ret
+ /* match found -- adjust rax to point to matching byte */
+4: dec %rax
+3: dec %rax
+2: dec %rax
+1: ret
ARCHEND(memrchr, scalar)
ARCHENTRY(memrchr, baseline)
- movd %esi, %xmm4
- test %rdx, %rdx # empty buffer?
- jz .L0 # if yes, return immediately
+ test %rdx, %rdx # empty input?
+ je .Lnomatchb
+
+
+ lea (%rdi, %rdx, 1), %ecx # pointer to end of buffer
+ lea -1(%rdi, %rdx, 1), %rdx # pointer to last char in buffer
+ movd %esi, %xmm2
+ and $~0x1f, %rdx # pointer to final 32 buffer bytes
+ movdqa (%rdx), %xmm0 # load last 32 bytes
+ movdqa 16(%rdx), %xmm1
+
+ punpcklbw %xmm2, %xmm2 # c -> cc
- punpcklbw %xmm4, %xmm4 # c -> cc
- mov %edi, %ecx
- punpcklwd %xmm4, %xmm4 # cc -> cccc
- and $~0xf, %rdi # align source pointer
- pshufd $0, %xmm4, %xmm4 # cccc -> cccccccccccccccc
- and $0xf, %ecx
- movdqa %xmm4, %xmm0
mov $-1, %r8d
- pcmpeqb (%rdi), %xmm0 # compare aligned head
- shl %cl, %r8d # mask of bytes in the head of the buffer
- pmovmskb %xmm0, %eax
+ neg %ecx
+ mov %r8d, %r9d
+ shr %cl, %r8d # mask with zeroes after the string
- sub $16, %rcx
- and %r8d, %eax # match mask
- add %rcx, %rdx # advance past head
- cmc
- jbe .Lrunt # did the string end in the buffer?
+ punpcklwd %xmm2, %xmm2 # cc -> cccc
- mov %rdi, %rsi # pointer to matching chunk
- add $16, %rdi
- sub $16, %rdx # enough left for another round?
- jbe 1f
+ mov %edi, %ecx
+ mov %r9d, %eax
+ shl %cl, %r9d # mask with zeroes before the string
- /* main loop unrolled twice */
- ALIGN_TEXT
-0: movdqa %xmm4, %xmm0
- pcmpeqb (%rdi), %xmm0
- pmovmskb %xmm0, %r8d
+ pshufd $0, %xmm2, %xmm2 # cccc -> cccccccccccccccc
- cmp $16, %rdx # enough left for second chunk?
- jbe 2f
+ cmp %rdx, %rdi # tail is beginning of buffer?
+ cmovae %r9d, %eax # if yes, do combined head/tail processing
+ and %r8d, %eax # mak of bytes in tail part of string
- movdqa %xmm4, %xmm0
- pcmpeqb 16(%rdi), %xmm0
+ /* process tail */
+ pcmpeqb %xmm2, %xmm1
+ pcmpeqb %xmm2, %xmm0
+ pmovmskb %xmm1, %esi
pmovmskb %xmm0, %ecx
+ shl $16, %esi
+ or %esi, %ecx # locations of matches
+ and %ecx, %eax # any match inside buffer?
+ jnz .Lprecisematchb
- lea 16(%rdi), %r9
- test %ecx, %ecx # match found in second chunk?
- cmovz %r8d, %ecx # if not, use match data from first chunk
- cmovz %rdi, %r9
-
- test %ecx, %ecx # any match found?
- cmovnz %ecx, %eax # if yes, overwrite previously found match
- cmovnz %r9, %rsi
-
- add $32, %rdi # advance to next iteration
- sub $32, %rdx # advance to next chunks
- ja 0b
-
- /* process remaining 1--16 bytes */
-1: pcmpeqb (%rdi), %xmm4
- mov $0xffff, %r8d
- xor %ecx, %ecx
- sub %edx, %ecx # number of bytes to be masked out
- pmovmskb %xmm4, %r9d
- shr %cl, %r8d # mask of bytes to be kept in the buffer
- and %r9d, %r8d
- cmovnz %r8d, %eax
- cmovnz %rdi, %rsi
- bsr %eax, %eax
- lea (%rsi, %rax, 1), %rsi # pointer to match (or junk)
- cmovnz %rsi, %rax # if any match was found, return it
- ret
+ cmp %rdx, %rdi # did the buffer begin here?
+ jae .Lnomatchb # if yes, we are done
- /* end of chunk reached within first half iteration */
-2: test %r8d, %r8d # match in previous chunk?
- cmovnz %r8d, %eax # if yes, overwrite previous chunks
- cmovnz %rdi, %rsi
- add $16, %rdi # point to tail
- sub $16, %edx
- jmp 1b # handle tail the same otherwise
-
- /* runt: string ends within head, edx has negated amount of invalid head bytes */
-.Lrunt: mov $0xffff, %r8d
- xor %ecx, %ecx
- sub %edx, %ecx
- shr %cl, %r8d
- and %r8d, %eax
- bsr %eax, %eax
- lea (%rdi, %rax, 1), %rdi
- cmovnz %rdi, %rax
+ /* main loop */
+ ALIGN_TEXT
+0: movdqa -32(%rdx), %xmm0 # load previous string chunk
+ movdqa -16(%rdx), %xmm1
+ sub $32, %rdx # beginning of string reached?
+ cmp %rdx, %rdi
+ jae .Ltailb
+
+ pcmpeqb %xmm2, %xmm0
+ pcmpeqb %xmm2, %xmm1
+ por %xmm1, %xmm0 # match in either half?
+ pmovmskb %xmm0, %eax
+ test %eax, %eax
+ jz 0b
+
+.Lmatchb:
+ pcmpeqb (%rdx), %xmm2 # redo comparison of first 16 bytes
+ pmovmskb %xmm1, %ecx
+ pmovmskb %xmm2, %eax
+ shl $16, %ecx
+ or %ecx, %eax # location of matches
+
+.Lprecisematchb:
+ bsr %eax, %eax # find location of match
+ add %rdx, %rax # point to matching byte
ret
- /* empty buffer: return a null pointer */
-.L0: xor %eax, %eax
+.Ltailb:
+ pcmpeqb %xmm2, %xmm1
+ pcmpeqb %xmm2, %xmm0
+ pmovmskb %xmm1, %ecx
+ pmovmskb %xmm0, %eax
+ shl $16, %ecx
+ or %ecx, %eax # location of matches
+ and %r9d, %eax # mask out matches before buffer
+ bsr %eax, %edi # location of match
+ lea (%rdx, %rdi, 1), %rdx # pointer to match (if any)
+ cmovnz %rdx, %rax # point to match if present,
+ ret # else null pointer
+
+.Lnomatchb:
+ xor %eax, %eax # return null pointer
ret
ARCHEND(memrchr, baseline)
diff --git a/lib/libc/include/compat.h b/lib/libc/include/compat.h
index 70fb8dcd97f3..97f22607ddd7 100644
--- a/lib/libc/include/compat.h
+++ b/lib/libc/include/compat.h
@@ -69,6 +69,9 @@ __sym_compat(kevent, freebsd11_kevent, FBSD_1.0);
__sym_compat(swapoff, freebsd13_swapoff, FBSD_1.0);
+__sym_compat(getgroups, freebsd14_getgroups, FBSD_1.0);
+__sym_compat(setgroups, freebsd14_setgroups, FBSD_1.0);
+
#undef __sym_compat
#define __weak_reference(sym,alias) \
diff --git a/lib/libc/regex/regcomp.c b/lib/libc/regex/regcomp.c
index f34dc322d0bb..aebea2b02435 100644
--- a/lib/libc/regex/regcomp.c
+++ b/lib/libc/regex/regcomp.c
@@ -1183,6 +1183,7 @@ p_b_pseudoclass(struct parse *p, char c) {
/* PASSTHROUGH */
case 'w':
p_b_cclass_named(p, cs, "alnum");
+ CHadd(p, cs, '_');
break;
case 'S':
cs->invert = 1;
diff --git a/lib/libc/stdio/vfscanf.c b/lib/libc/stdio/vfscanf.c
index a678710e1ecb..89e9e843969f 100644
--- a/lib/libc/stdio/vfscanf.c
+++ b/lib/libc/stdio/vfscanf.c
@@ -318,10 +318,9 @@ parseint_fsm(int c, enum parseint_state *state, int *base)
case '0':
if (*state == begin || *state == havesign) {
*state = havezero;
- } else {
- *state = any;
+ return 1;
}
- return 1;
+ /* FALL THROUGH */
case '1':
case '2':
case '3':
diff --git a/lib/libc/stdio/vfwscanf.c b/lib/libc/stdio/vfwscanf.c
index 57206a8407d5..7ca64eb37811 100644
--- a/lib/libc/stdio/vfwscanf.c
+++ b/lib/libc/stdio/vfwscanf.c
@@ -298,10 +298,9 @@ parseint_fsm(wchar_t c, enum parseint_state *state, int *base)
case '0':
if (*state == begin || *state == havesign) {
*state = havezero;
- } else {
- *state = any;
+ return 1;
}
- return 1;
+ /* FALL THROUGH */
case '1':
case '2':
case '3':
diff --git a/lib/libc/stdlib/malloc/jemalloc/Makefile.inc b/lib/libc/stdlib/malloc/jemalloc/Makefile.inc
index c10d79dbce6c..b9e34edfdea5 100644
--- a/lib/libc/stdlib/malloc/jemalloc/Makefile.inc
+++ b/lib/libc/stdlib/malloc/jemalloc/Makefile.inc
@@ -1,10 +1,14 @@
.PATH: ${LIBC_SRCTOP}/stdlib/malloc/jemalloc
JEMALLOCSRCS:= jemalloc.c arena.c background_thread.c base.c bin.c bitmap.c \
- ckh.c ctl.c div.c extent.c extent_dss.c extent_mmap.c hash.c hook.c \
- large.c log.c malloc_io.c mutex.c mutex_pool.c nstime.c pages.c \
- prng.c prof.c rtree.c safety_check.c sc.c stats.c sz.c tcache.c \
- test_hooks.c ticker.c tsd.c witness.c
+ ckh.c ctl.c div.c extent.c extent_dss.c extent_mmap.c hook.c \
+ large.c log.c malloc_io.c mutex.c nstime.c pages.c \
+ prof.c rtree.c safety_check.c sc.c stats.c sz.c tcache.c \
+ test_hooks.c ticker.c tsd.c witness.c \
+ bin_info.c san.c san_bump.c counter.c prof_data.c prof_log.c prof_recent.c prof_stats.c prof_sys.c \
+ emap.c edata.c edata_cache.c pa.c pa_extra.c pac.c decay.c hpa.c hpa_hooks.c fxp.c hpdata.c pai.c \
+ ecache.c ehooks.c eset.c sec.c cache_bin.c peak_event.c psset.c inspect.c exp_grow.c thread_event.c \
+ buf_writer.c
CFLAGS+=-I${SRCTOP}/contrib/jemalloc/include -I${LIBC_SRCTOP}/stdlib/malloc/jemalloc/include
.if ${MK_JEMALLOC_LG_VADDR_WIDE} != no
diff --git a/lib/libc/stdlib/malloc/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h b/lib/libc/stdlib/malloc/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h
index 1aedb916976b..900ae867f321 100644
--- a/lib/libc/stdlib/malloc/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h
+++ b/lib/libc/stdlib/malloc/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h
@@ -45,17 +45,17 @@
#define LG_VADDR 48
/* Defined if C11 atomics are available. */
-#define JEMALLOC_C11_ATOMICS 1
+#define JEMALLOC_C11_ATOMICS
/* Defined if GCC __atomic atomics are available. */
-#define JEMALLOC_GCC_ATOMIC_ATOMICS 1
+#define JEMALLOC_GCC_ATOMIC_ATOMICS
/* and the 8-bit variant support. */
-#define JEMALLOC_GCC_U8_ATOMIC_ATOMICS 1
+#define JEMALLOC_GCC_U8_ATOMIC_ATOMICS
/* Defined if GCC __sync atomics are available. */
-#define JEMALLOC_GCC_SYNC_ATOMICS 1
+#define JEMALLOC_GCC_SYNC_ATOMICS
/* and the 8-bit variant support. */
-#define JEMALLOC_GCC_U8_SYNC_ATOMICS 1
+#define JEMALLOC_GCC_U8_SYNC_ATOMICS
/*
* Defined if __builtin_clz() and __builtin_clzl() are available.
@@ -73,7 +73,7 @@
/*
* Defined if secure_getenv(3) is available.
*/
-/* #undef JEMALLOC_HAVE_SECURE_GETENV */
+#define JEMALLOC_HAVE_SECURE_GETENV
/*
* Defined if issetugid(2) is available.
@@ -84,17 +84,23 @@
#define JEMALLOC_HAVE_PTHREAD_ATFORK
/* Defined if pthread_setname_np(3) is available. */
-/* #undef JEMALLOC_HAVE_PTHREAD_SETNAME_NP */
+#define JEMALLOC_HAVE_PTHREAD_SETNAME_NP
+
+/* Defined if pthread_getname_np(3) is available. */
+#define JEMALLOC_HAVE_PTHREAD_GETNAME_NP
+
+/* Defined if pthread_get_name_np(3) is available. */
+#define JEMALLOC_HAVE_PTHREAD_GET_NAME_NP
/*
* Defined if clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is available.
*/
-/* #undef JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE */
+#define JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE
/*
* Defined if clock_gettime(CLOCK_MONOTONIC, ...) is available.
*/
-#define JEMALLOC_HAVE_CLOCK_MONOTONIC 1
+#define JEMALLOC_HAVE_CLOCK_MONOTONIC
/*
* Defined if mach_absolute_time() is available.
@@ -102,6 +108,11 @@
/* #undef JEMALLOC_HAVE_MACH_ABSOLUTE_TIME */
/*
+ * Defined if clock_gettime(CLOCK_REALTIME, ...) is available.
+ */
+#define JEMALLOC_HAVE_CLOCK_REALTIME
+
+/*
* Defined if _malloc_thread_cleanup() exists. At least in the case of
* FreeBSD, pthread_key_create() allocates, which if used during malloc
* bootstrapping will cause recursion into the pthreads library. Therefore, if
@@ -122,7 +133,7 @@
* _pthread_mutex_init_calloc_cb(), in which case the function is used in order
* to avoid recursive allocation during mutex initialization.
*/
-#define JEMALLOC_MUTEX_INIT_CB 1
+#define JEMALLOC_MUTEX_INIT_CB
/* Non-empty if the tls_model attribute is supported. */
#define JEMALLOC_TLS_MODEL __attribute__((tls_model("initial-exec")))
@@ -163,6 +174,9 @@
/* Support utrace(2)-based tracing. */
#define JEMALLOC_UTRACE
+/* Support utrace(2)-based tracing (label based signature). */
+/* #undef JEMALLOC_UTRACE_LABEL */
+
/* Support optional abort() on OOM. */
#define JEMALLOC_XMALLOC
@@ -178,6 +192,9 @@
/* One page is 2^LG_PAGE bytes. */
#define LG_PAGE 12
+/* Maximum number of regions in a slab. */
+/* #undef CONFIG_LG_SLAB_MAXREGS */
+
/*
* One huge page is 2^LG_HUGEPAGE bytes. Note that this is defined even if the
* system does not explicitly support huge pages; system calls that require
@@ -292,16 +309,45 @@
/* #undef JEMALLOC_MADVISE_DONTDUMP */
/*
+ * Defined if MADV_[NO]CORE is supported as an argument to madvise.
+ */
+#define JEMALLOC_MADVISE_NOCORE
+
+/* Defined if mprotect(2) is available. */
+#define JEMALLOC_HAVE_MPROTECT
+
+/*
* Defined if transparent huge pages (THPs) are supported via the
* MADV_[NO]HUGEPAGE arguments to madvise(2), and THP support is enabled.
*/
/* #undef JEMALLOC_THP */
+/* Defined if posix_madvise is available. */
+/* #undef JEMALLOC_HAVE_POSIX_MADVISE */
+
+/*
+ * Method for purging unused pages using posix_madvise.
+ *
+ * posix_madvise(..., POSIX_MADV_DONTNEED)
+ */
+/* #undef JEMALLOC_PURGE_POSIX_MADVISE_DONTNEED */
+/* #undef JEMALLOC_PURGE_POSIX_MADVISE_DONTNEED_ZEROS */
+
+/*
+ * Defined if memcntl page admin call is supported
+ */
+/* #undef JEMALLOC_HAVE_MEMCNTL */
+
+/*
+ * Defined if malloc_size is supported
+ */
+/* #undef JEMALLOC_HAVE_MALLOC_SIZE */
+
/* Define if operating system has alloca.h header. */
/* #undef JEMALLOC_HAS_ALLOCA_H */
/* C99 restrict keyword supported. */
-#define JEMALLOC_HAS_RESTRICT 1
+#define JEMALLOC_HAS_RESTRICT
/* For use by hash code. */
/* #undef JEMALLOC_BIG_ENDIAN */
@@ -334,15 +380,15 @@
#define JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP
/* GNU specific sched_getcpu support */
-/* #undef JEMALLOC_HAVE_SCHED_GETCPU */
+#define JEMALLOC_HAVE_SCHED_GETCPU
/* GNU specific sched_setaffinity support */
-/* #undef JEMALLOC_HAVE_SCHED_SETAFFINITY */
+#define JEMALLOC_HAVE_SCHED_SETAFFINITY
/*
* If defined, all the features necessary for background threads are present.
*/
-#define JEMALLOC_BACKGROUND_THREAD 1
+#define JEMALLOC_BACKGROUND_THREAD
/*
* If defined, jemalloc symbols are not exported (doesn't work when
@@ -354,7 +400,7 @@
#define JEMALLOC_CONFIG_MALLOC_CONF "abort_conf:false"
/* If defined, jemalloc takes the malloc/free/etc. symbol names. */
-#define JEMALLOC_IS_MALLOC 1
+#define JEMALLOC_IS_MALLOC
/*
* Defined if strerror_r returns char * if _GNU_SOURCE is defined.
@@ -364,4 +410,19 @@
/* Performs additional safety checks when defined. */
/* #undef JEMALLOC_OPT_SAFETY_CHECKS */
+/* Is C++ support being built? */
+#define JEMALLOC_ENABLE_CXX
+
+/* Performs additional size checks when defined. */
+/* #undef JEMALLOC_OPT_SIZE_CHECKS */
+
+/* Allows sampled junk and stash for checking use-after-free when defined. */
+/* #undef JEMALLOC_UAF_DETECTION */
+
+/* Darwin VM_MAKE_TAG support */
+/* #undef JEMALLOC_HAVE_VM_MAKE_TAG */
+
+/* If defined, realloc(ptr, 0) defaults to "free" instead of "alloc". */
+/* #undef JEMALLOC_ZERO_REALLOC_DEFAULT_FREE */
+
#endif /* JEMALLOC_INTERNAL_DEFS_H_ */
diff --git a/lib/libc/stdlib/malloc/jemalloc/include/jemalloc/internal/jemalloc_preamble.h b/lib/libc/stdlib/malloc/jemalloc/include/jemalloc/internal/jemalloc_preamble.h
index d1dcc50d5a3b..b6cf5864109d 100644
--- a/lib/libc/stdlib/malloc/jemalloc/include/jemalloc/internal/jemalloc_preamble.h
+++ b/lib/libc/stdlib/malloc/jemalloc/include/jemalloc/internal/jemalloc_preamble.h
@@ -4,12 +4,20 @@
#include "jemalloc_internal_defs.h"
#include "jemalloc/internal/jemalloc_internal_decls.h"
-#ifdef JEMALLOC_UTRACE
+#if defined(JEMALLOC_UTRACE) || defined(JEMALLOC_UTRACE_LABEL)
#include <sys/ktrace.h>
+# if defined(JEMALLOC_UTRACE)
+# define UTRACE_CALL(p, l) utrace(p, l)
+# else
+# define UTRACE_CALL(p, l) utrace("jemalloc_process", p, l)
+# define JEMALLOC_UTRACE
+# endif
#endif
+#ifndef JEMALLOC_PRIVATE_NAMESPACE
#include "un-namespace.h"
#include "libc_private.h"
+#endif
#define JEMALLOC_NO_DEMANGLE
#ifdef JEMALLOC_JET
@@ -177,6 +185,35 @@ static const bool config_opt_safety_checks =
#endif
;
+/*
+ * Extra debugging of sized deallocations too onerous to be included in the
+ * general safety checks.
+ */
+static const bool config_opt_size_checks =
+#if defined(JEMALLOC_OPT_SIZE_CHECKS) || defined(JEMALLOC_DEBUG)
+ true
+#else
+ false
+#endif
+ ;
+
+static const bool config_uaf_detection =
+#if defined(JEMALLOC_UAF_DETECTION) || defined(JEMALLOC_DEBUG)
+ true
+#else
+ false
+#endif
+ ;
+
+/* Whether or not the C++ extensions are enabled. */
+static const bool config_enable_cxx =
+#ifdef JEMALLOC_ENABLE_CXX
+ true
+#else
+ false
+#endif
+;
+
#if defined(_WIN32) || defined(JEMALLOC_HAVE_SCHED_GETCPU)
/* Currently percpu_arena depends on sched_getcpu. */
#define JEMALLOC_PERCPU_ARENA
@@ -206,5 +243,20 @@ static const bool have_background_thread =
false
#endif
;
+static const bool config_high_res_timer =
+#ifdef JEMALLOC_HAVE_CLOCK_REALTIME
+ true
+#else
+ false
+#endif
+ ;
+
+static const bool have_memcntl =
+#ifdef JEMALLOC_HAVE_MEMCNTL
+ true
+#else
+ false
+#endif
+ ;
#endif /* JEMALLOC_PREAMBLE_H */
diff --git a/lib/libc/stdlib/malloc/jemalloc/include/jemalloc/internal/private_namespace.h b/lib/libc/stdlib/malloc/jemalloc/include/jemalloc/internal/private_namespace.h
index a448ad63fa54..08ce9219cbf8 100644
--- a/lib/libc/stdlib/malloc/jemalloc/include/jemalloc/internal/private_namespace.h
+++ b/lib/libc/stdlib/malloc/jemalloc/include/jemalloc/internal/private_namespace.h
@@ -5,10 +5,9 @@
#define arena_init JEMALLOC_N(arena_init)
#define arena_migrate JEMALLOC_N(arena_migrate)
#define arena_set JEMALLOC_N(arena_set)
-#define arena_tdata_get_hard JEMALLOC_N(arena_tdata_get_hard)
#define arenas JEMALLOC_N(arenas)
#define arenas_lock JEMALLOC_N(arenas_lock)
-#define arenas_tdata_cleanup JEMALLOC_N(arenas_tdata_cleanup)
+#define batch_alloc JEMALLOC_N(batch_alloc)
#define bootstrap_calloc JEMALLOC_N(bootstrap_calloc)
#define bootstrap_free JEMALLOC_N(bootstrap_free)
#define bootstrap_malloc JEMALLOC_N(bootstrap_malloc)
@@ -16,8 +15,10 @@
#define iarena_cleanup JEMALLOC_N(iarena_cleanup)
#define je_sdallocx_noflags JEMALLOC_N(je_sdallocx_noflags)
#define jemalloc_postfork_child JEMALLOC_N(jemalloc_postfork_child)
+#define junk_alloc_callback JEMALLOC_N(junk_alloc_callback)
+#define junk_free_callback JEMALLOC_N(junk_free_callback)
#define malloc_default JEMALLOC_N(malloc_default)
-#define malloc_initialized JEMALLOC_N(malloc_initialized)
+#define malloc_init_state JEMALLOC_N(malloc_init_state)
#define malloc_slow JEMALLOC_N(malloc_slow)
#define manual_arena_base JEMALLOC_N(manual_arena_base)
#define narenas_auto JEMALLOC_N(narenas_auto)
@@ -25,49 +26,64 @@
#define ncpus JEMALLOC_N(ncpus)
#define opt_abort JEMALLOC_N(opt_abort)
#define opt_abort_conf JEMALLOC_N(opt_abort_conf)
+#define opt_cache_oblivious JEMALLOC_N(opt_cache_oblivious)
#define opt_confirm_conf JEMALLOC_N(opt_confirm_conf)
+#define opt_experimental_infallible_new JEMALLOC_N(opt_experimental_infallible_new)
+#define opt_hpa JEMALLOC_N(opt_hpa)
+#define opt_hpa_opts JEMALLOC_N(opt_hpa_opts)
+#define opt_hpa_sec_opts JEMALLOC_N(opt_hpa_sec_opts)
#define opt_junk JEMALLOC_N(opt_junk)
#define opt_junk_alloc JEMALLOC_N(opt_junk_alloc)
#define opt_junk_free JEMALLOC_N(opt_junk_free)
#define opt_narenas JEMALLOC_N(opt_narenas)
+#define opt_narenas_ratio JEMALLOC_N(opt_narenas_ratio)
+#define opt_trust_madvise JEMALLOC_N(opt_trust_madvise)
#define opt_utrace JEMALLOC_N(opt_utrace)
#define opt_xmalloc JEMALLOC_N(opt_xmalloc)
#define opt_zero JEMALLOC_N(opt_zero)
+#define opt_zero_realloc_action JEMALLOC_N(opt_zero_realloc_action)
#define sdallocx_default JEMALLOC_N(sdallocx_default)
-#define arena_alloc_junk_small JEMALLOC_N(arena_alloc_junk_small)
+#define zero_realloc_count JEMALLOC_N(zero_realloc_count)
+#define zero_realloc_mode_names JEMALLOC_N(zero_realloc_mode_names)
#define arena_basic_stats_merge JEMALLOC_N(arena_basic_stats_merge)
-#define arena_bin_choose_lock JEMALLOC_N(arena_bin_choose_lock)
+#define arena_bin_choose JEMALLOC_N(arena_bin_choose)
+#define arena_bin_offsets JEMALLOC_N(arena_bin_offsets)
+#define arena_binind_div_info JEMALLOC_N(arena_binind_div_info)
#define arena_boot JEMALLOC_N(arena_boot)
+#define arena_cache_bin_fill_small JEMALLOC_N(arena_cache_bin_fill_small)
#define arena_choose_huge JEMALLOC_N(arena_choose_huge)
-#define arena_dalloc_bin_junked_locked JEMALLOC_N(arena_dalloc_bin_junked_locked)
-#define arena_dalloc_junk_small JEMALLOC_N(arena_dalloc_junk_small)
+#define arena_config_default JEMALLOC_N(arena_config_default)
+#define arena_dalloc_bin_locked_handle_newly_empty JEMALLOC_N(arena_dalloc_bin_locked_handle_newly_empty)
+#define arena_dalloc_bin_locked_handle_newly_nonempty JEMALLOC_N(arena_dalloc_bin_locked_handle_newly_nonempty)
#define arena_dalloc_promoted JEMALLOC_N(arena_dalloc_promoted)
#define arena_dalloc_small JEMALLOC_N(arena_dalloc_small)
#define arena_decay JEMALLOC_N(arena_decay)
+#define arena_decay_ms_get JEMALLOC_N(arena_decay_ms_get)
+#define arena_decay_ms_set JEMALLOC_N(arena_decay_ms_set)
#define arena_destroy JEMALLOC_N(arena_destroy)
#define arena_dirty_decay_ms_default_get JEMALLOC_N(arena_dirty_decay_ms_default_get)
#define arena_dirty_decay_ms_default_set JEMALLOC_N(arena_dirty_decay_ms_default_set)
-#define arena_dirty_decay_ms_get JEMALLOC_N(arena_dirty_decay_ms_get)
-#define arena_dirty_decay_ms_set JEMALLOC_N(arena_dirty_decay_ms_set)
+#define arena_do_deferred_work JEMALLOC_N(arena_do_deferred_work)
#define arena_dss_prec_get JEMALLOC_N(arena_dss_prec_get)
#define arena_dss_prec_set JEMALLOC_N(arena_dss_prec_set)
+#define arena_emap_global JEMALLOC_N(arena_emap_global)
#define arena_extent_alloc_large JEMALLOC_N(arena_extent_alloc_large)
#define arena_extent_dalloc_large_prep JEMALLOC_N(arena_extent_dalloc_large_prep)
#define arena_extent_ralloc_large_expand JEMALLOC_N(arena_extent_ralloc_large_expand)
#define arena_extent_ralloc_large_shrink JEMALLOC_N(arena_extent_ralloc_large_shrink)
-#define arena_extent_sn_next JEMALLOC_N(arena_extent_sn_next)
-#define arena_extents_dirty_dalloc JEMALLOC_N(arena_extents_dirty_dalloc)
+#define arena_fill_small_fresh JEMALLOC_N(arena_fill_small_fresh)
+#define arena_get_ehooks JEMALLOC_N(arena_get_ehooks)
+#define arena_handle_deferred_work JEMALLOC_N(arena_handle_deferred_work)
#define arena_init_huge JEMALLOC_N(arena_init_huge)
#define arena_is_huge JEMALLOC_N(arena_is_huge)
#define arena_malloc_hard JEMALLOC_N(arena_malloc_hard)
#define arena_muzzy_decay_ms_default_get JEMALLOC_N(arena_muzzy_decay_ms_default_get)
#define arena_muzzy_decay_ms_default_set JEMALLOC_N(arena_muzzy_decay_ms_default_set)
-#define arena_muzzy_decay_ms_get JEMALLOC_N(arena_muzzy_decay_ms_get)
-#define arena_muzzy_decay_ms_set JEMALLOC_N(arena_muzzy_decay_ms_set)
#define arena_new JEMALLOC_N(arena_new)
#define arena_nthreads_dec JEMALLOC_N(arena_nthreads_dec)
#define arena_nthreads_get JEMALLOC_N(arena_nthreads_get)
#define arena_nthreads_inc JEMALLOC_N(arena_nthreads_inc)
+#define arena_pa_central_global JEMALLOC_N(arena_pa_central_global)
#define arena_palloc JEMALLOC_N(arena_palloc)
#define arena_postfork_child JEMALLOC_N(arena_postfork_child)
#define arena_postfork_parent JEMALLOC_N(arena_postfork_parent)
@@ -79,14 +95,15 @@
#define arena_prefork5 JEMALLOC_N(arena_prefork5)
#define arena_prefork6 JEMALLOC_N(arena_prefork6)
#define arena_prefork7 JEMALLOC_N(arena_prefork7)
+#define arena_prefork8 JEMALLOC_N(arena_prefork8)
#define arena_prof_promote JEMALLOC_N(arena_prof_promote)
#define arena_ralloc JEMALLOC_N(arena_ralloc)
#define arena_ralloc_no_move JEMALLOC_N(arena_ralloc_no_move)
#define arena_reset JEMALLOC_N(arena_reset)
#define arena_retain_grow_limit_get_set JEMALLOC_N(arena_retain_grow_limit_get_set)
+#define arena_set_extent_hooks JEMALLOC_N(arena_set_extent_hooks)
+#define arena_slab_dalloc JEMALLOC_N(arena_slab_dalloc)
#define arena_stats_merge JEMALLOC_N(arena_stats_merge)
-#define arena_tcache_fill_small JEMALLOC_N(arena_tcache_fill_small)
-#define h_steps JEMALLOC_N(h_steps)
#define opt_dirty_decay_ms JEMALLOC_N(opt_dirty_decay_ms)
#define opt_muzzy_decay_ms JEMALLOC_N(opt_muzzy_decay_ms)
#define opt_oversize_threshold JEMALLOC_N(opt_oversize_threshold)
@@ -99,13 +116,14 @@
#define background_thread_ctl_init JEMALLOC_N(background_thread_ctl_init)
#define background_thread_enabled_state JEMALLOC_N(background_thread_enabled_state)
#define background_thread_info JEMALLOC_N(background_thread_info)
-#define background_thread_interval_check JEMALLOC_N(background_thread_interval_check)
+#define background_thread_is_started JEMALLOC_N(background_thread_is_started)
#define background_thread_lock JEMALLOC_N(background_thread_lock)
#define background_thread_postfork_child JEMALLOC_N(background_thread_postfork_child)
#define background_thread_postfork_parent JEMALLOC_N(background_thread_postfork_parent)
#define background_thread_prefork0 JEMALLOC_N(background_thread_prefork0)
#define background_thread_prefork1 JEMALLOC_N(background_thread_prefork1)
#define background_thread_stats_read JEMALLOC_N(background_thread_stats_read)
+#define background_thread_wakeup_early JEMALLOC_N(background_thread_wakeup_early)
#define background_threads_disable JEMALLOC_N(background_threads_disable)
#define background_threads_enable JEMALLOC_N(background_threads_enable)
#define max_background_threads JEMALLOC_N(max_background_threads)
@@ -115,10 +133,11 @@
#define pthread_create_wrapper JEMALLOC_N(pthread_create_wrapper)
#define b0get JEMALLOC_N(b0get)
#define base_alloc JEMALLOC_N(base_alloc)
-#define base_alloc_extent JEMALLOC_N(base_alloc_extent)
+#define base_alloc_edata JEMALLOC_N(base_alloc_edata)
#define base_boot JEMALLOC_N(base_boot)
#define base_delete JEMALLOC_N(base_delete)
-#define base_extent_hooks_get JEMALLOC_N(base_extent_hooks_get)
+#define base_ehooks_get JEMALLOC_N(base_ehooks_get)
+#define base_ehooks_get_for_metadata JEMALLOC_N(base_ehooks_get_for_metadata)
#define base_extent_hooks_set JEMALLOC_N(base_extent_hooks_set)
#define base_new JEMALLOC_N(base_new)
#define base_postfork_child JEMALLOC_N(base_postfork_child)
@@ -127,17 +146,28 @@
#define base_stats_get JEMALLOC_N(base_stats_get)
#define metadata_thp_mode_names JEMALLOC_N(metadata_thp_mode_names)
#define opt_metadata_thp JEMALLOC_N(opt_metadata_thp)
-#define bin_boot JEMALLOC_N(bin_boot)
-#define bin_infos JEMALLOC_N(bin_infos)
#define bin_init JEMALLOC_N(bin_init)
#define bin_postfork_child JEMALLOC_N(bin_postfork_child)
#define bin_postfork_parent JEMALLOC_N(bin_postfork_parent)
#define bin_prefork JEMALLOC_N(bin_prefork)
#define bin_shard_sizes_boot JEMALLOC_N(bin_shard_sizes_boot)
#define bin_update_shard_size JEMALLOC_N(bin_update_shard_size)
+#define bin_info_boot JEMALLOC_N(bin_info_boot)
+#define bin_infos JEMALLOC_N(bin_infos)
#define bitmap_info_init JEMALLOC_N(bitmap_info_init)
#define bitmap_init JEMALLOC_N(bitmap_init)
#define bitmap_size JEMALLOC_N(bitmap_size)
+#define buf_writer_cb JEMALLOC_N(buf_writer_cb)
+#define buf_writer_flush JEMALLOC_N(buf_writer_flush)
+#define buf_writer_init JEMALLOC_N(buf_writer_init)
+#define buf_writer_pipe JEMALLOC_N(buf_writer_pipe)
+#define buf_writer_terminate JEMALLOC_N(buf_writer_terminate)
+#define cache_bin_info_compute_alloc JEMALLOC_N(cache_bin_info_compute_alloc)
+#define cache_bin_info_init JEMALLOC_N(cache_bin_info_init)
+#define cache_bin_init JEMALLOC_N(cache_bin_init)
+#define cache_bin_postincrement JEMALLOC_N(cache_bin_postincrement)
+#define cache_bin_preincrement JEMALLOC_N(cache_bin_preincrement)
+#define cache_bin_still_zero_initialized JEMALLOC_N(cache_bin_still_zero_initialized)
#define ckh_count JEMALLOC_N(ckh_count)
#define ckh_delete JEMALLOC_N(ckh_delete)
#define ckh_insert JEMALLOC_N(ckh_insert)
@@ -149,61 +179,116 @@
#define ckh_search JEMALLOC_N(ckh_search)
#define ckh_string_hash JEMALLOC_N(ckh_string_hash)
#define ckh_string_keycomp JEMALLOC_N(ckh_string_keycomp)
+#define counter_accum_init JEMALLOC_N(counter_accum_init)
+#define counter_postfork_child JEMALLOC_N(counter_postfork_child)
+#define counter_postfork_parent JEMALLOC_N(counter_postfork_parent)
+#define counter_prefork JEMALLOC_N(counter_prefork)
#define ctl_boot JEMALLOC_N(ctl_boot)
#define ctl_bymib JEMALLOC_N(ctl_bymib)
+#define ctl_bymibname JEMALLOC_N(ctl_bymibname)
#define ctl_byname JEMALLOC_N(ctl_byname)
+#define ctl_mibnametomib JEMALLOC_N(ctl_mibnametomib)
+#define ctl_mtx_assert_held JEMALLOC_N(ctl_mtx_assert_held)
#define ctl_nametomib JEMALLOC_N(ctl_nametomib)
#define ctl_postfork_child JEMALLOC_N(ctl_postfork_child)
#define ctl_postfork_parent JEMALLOC_N(ctl_postfork_parent)
#define ctl_prefork JEMALLOC_N(ctl_prefork)
+#define decay_deadline_init JEMALLOC_N(decay_deadline_init)
+#define decay_init JEMALLOC_N(decay_init)
+#define decay_maybe_advance_epoch JEMALLOC_N(decay_maybe_advance_epoch)
+#define decay_ms_valid JEMALLOC_N(decay_ms_valid)
+#define decay_npages_purge_in JEMALLOC_N(decay_npages_purge_in)
+#define decay_ns_until_purge JEMALLOC_N(decay_ns_until_purge)
+#define decay_reinit JEMALLOC_N(decay_reinit)
#define div_init JEMALLOC_N(div_init)
-#define extent_alloc JEMALLOC_N(extent_alloc)
+#define ecache_init JEMALLOC_N(ecache_init)
+#define ecache_postfork_child JEMALLOC_N(ecache_postfork_child)
+#define ecache_postfork_parent JEMALLOC_N(ecache_postfork_parent)
+#define ecache_prefork JEMALLOC_N(ecache_prefork)
+#define edata_avail_any JEMALLOC_N(edata_avail_any)
+#define edata_avail_empty JEMALLOC_N(edata_avail_empty)
+#define edata_avail_first JEMALLOC_N(edata_avail_first)
+#define edata_avail_insert JEMALLOC_N(edata_avail_insert)
+#define edata_avail_new JEMALLOC_N(edata_avail_new)
+#define edata_avail_remove JEMALLOC_N(edata_avail_remove)
+#define edata_avail_remove_any JEMALLOC_N(edata_avail_remove_any)
+#define edata_avail_remove_first JEMALLOC_N(edata_avail_remove_first)
+#define edata_heap_any JEMALLOC_N(edata_heap_any)
+#define edata_heap_empty JEMALLOC_N(edata_heap_empty)
+#define edata_heap_first JEMALLOC_N(edata_heap_first)
+#define edata_heap_insert JEMALLOC_N(edata_heap_insert)
+#define edata_heap_new JEMALLOC_N(edata_heap_new)
+#define edata_heap_remove JEMALLOC_N(edata_heap_remove)
+#define edata_heap_remove_any JEMALLOC_N(edata_heap_remove_any)
+#define edata_heap_remove_first JEMALLOC_N(edata_heap_remove_first)
+#define edata_cache_fast_disable JEMALLOC_N(edata_cache_fast_disable)
+#define edata_cache_fast_get JEMALLOC_N(edata_cache_fast_get)
+#define edata_cache_fast_init JEMALLOC_N(edata_cache_fast_init)
+#define edata_cache_fast_put JEMALLOC_N(edata_cache_fast_put)
+#define edata_cache_get JEMALLOC_N(edata_cache_get)
+#define edata_cache_init JEMALLOC_N(edata_cache_init)
+#define edata_cache_postfork_child JEMALLOC_N(edata_cache_postfork_child)
+#define edata_cache_postfork_parent JEMALLOC_N(edata_cache_postfork_parent)
+#define edata_cache_prefork JEMALLOC_N(edata_cache_prefork)
+#define edata_cache_put JEMALLOC_N(edata_cache_put)
+#define ehooks_default_alloc_impl JEMALLOC_N(ehooks_default_alloc_impl)
+#define ehooks_default_commit_impl JEMALLOC_N(ehooks_default_commit_impl)
+#define ehooks_default_dalloc_impl JEMALLOC_N(ehooks_default_dalloc_impl)
+#define ehooks_default_decommit_impl JEMALLOC_N(ehooks_default_decommit_impl)
+#define ehooks_default_destroy_impl JEMALLOC_N(ehooks_default_destroy_impl)
+#define ehooks_default_extent_hooks JEMALLOC_N(ehooks_default_extent_hooks)
+#define ehooks_default_guard_impl JEMALLOC_N(ehooks_default_guard_impl)
+#define ehooks_default_merge JEMALLOC_N(ehooks_default_merge)
+#define ehooks_default_merge_impl JEMALLOC_N(ehooks_default_merge_impl)
+#define ehooks_default_purge_forced_impl JEMALLOC_N(ehooks_default_purge_forced_impl)
+#define ehooks_default_purge_lazy_impl JEMALLOC_N(ehooks_default_purge_lazy_impl)
+#define ehooks_default_split_impl JEMALLOC_N(ehooks_default_split_impl)
+#define ehooks_default_unguard_impl JEMALLOC_N(ehooks_default_unguard_impl)
+#define ehooks_default_zero_impl JEMALLOC_N(ehooks_default_zero_impl)
+#define ehooks_init JEMALLOC_N(ehooks_init)
+#define emap_deregister_boundary JEMALLOC_N(emap_deregister_boundary)
+#define emap_deregister_interior JEMALLOC_N(emap_deregister_interior)
+#define emap_do_assert_mapped JEMALLOC_N(emap_do_assert_mapped)
+#define emap_do_assert_not_mapped JEMALLOC_N(emap_do_assert_not_mapped)
+#define emap_init JEMALLOC_N(emap_init)
+#define emap_merge_commit JEMALLOC_N(emap_merge_commit)
+#define emap_merge_prepare JEMALLOC_N(emap_merge_prepare)
+#define emap_register_boundary JEMALLOC_N(emap_register_boundary)
+#define emap_register_interior JEMALLOC_N(emap_register_interior)
+#define emap_release_edata JEMALLOC_N(emap_release_edata)
+#define emap_remap JEMALLOC_N(emap_remap)
+#define emap_split_commit JEMALLOC_N(emap_split_commit)
+#define emap_split_prepare JEMALLOC_N(emap_split_prepare)
+#define emap_try_acquire_edata_neighbor JEMALLOC_N(emap_try_acquire_edata_neighbor)
+#define emap_try_acquire_edata_neighbor_expand JEMALLOC_N(emap_try_acquire_edata_neighbor_expand)
+#define emap_update_edata_state JEMALLOC_N(emap_update_edata_state)
+#define eset_fit JEMALLOC_N(eset_fit)
+#define eset_init JEMALLOC_N(eset_init)
+#define eset_insert JEMALLOC_N(eset_insert)
+#define eset_nbytes_get JEMALLOC_N(eset_nbytes_get)
+#define eset_nextents_get JEMALLOC_N(eset_nextents_get)
+#define eset_npages_get JEMALLOC_N(eset_npages_get)
+#define eset_remove JEMALLOC_N(eset_remove)
+#define exp_grow_init JEMALLOC_N(exp_grow_init)
+#define ecache_alloc JEMALLOC_N(ecache_alloc)
+#define ecache_alloc_grow JEMALLOC_N(ecache_alloc_grow)
+#define ecache_dalloc JEMALLOC_N(ecache_dalloc)
+#define ecache_evict JEMALLOC_N(ecache_evict)
#define extent_alloc_wrapper JEMALLOC_N(extent_alloc_wrapper)
-#define extent_avail_any JEMALLOC_N(extent_avail_any)
-#define extent_avail_empty JEMALLOC_N(extent_avail_empty)
-#define extent_avail_first JEMALLOC_N(extent_avail_first)
-#define extent_avail_insert JEMALLOC_N(extent_avail_insert)
-#define extent_avail_new JEMALLOC_N(extent_avail_new)
-#define extent_avail_remove JEMALLOC_N(extent_avail_remove)
-#define extent_avail_remove_any JEMALLOC_N(extent_avail_remove_any)
-#define extent_avail_remove_first JEMALLOC_N(extent_avail_remove_first)
#define extent_boot JEMALLOC_N(extent_boot)
#define extent_commit_wrapper JEMALLOC_N(extent_commit_wrapper)
-#define extent_dalloc JEMALLOC_N(extent_dalloc)
+#define extent_commit_zero JEMALLOC_N(extent_commit_zero)
#define extent_dalloc_gap JEMALLOC_N(extent_dalloc_gap)
#define extent_dalloc_wrapper JEMALLOC_N(extent_dalloc_wrapper)
#define extent_decommit_wrapper JEMALLOC_N(extent_decommit_wrapper)
#define extent_destroy_wrapper JEMALLOC_N(extent_destroy_wrapper)
-#define extent_heap_any JEMALLOC_N(extent_heap_any)
-#define extent_heap_empty JEMALLOC_N(extent_heap_empty)
-#define extent_heap_first JEMALLOC_N(extent_heap_first)
-#define extent_heap_insert JEMALLOC_N(extent_heap_insert)
-#define extent_heap_new JEMALLOC_N(extent_heap_new)
-#define extent_heap_remove JEMALLOC_N(extent_heap_remove)
-#define extent_heap_remove_any JEMALLOC_N(extent_heap_remove_any)
-#define extent_heap_remove_first JEMALLOC_N(extent_heap_remove_first)
-#define extent_hooks_default JEMALLOC_N(extent_hooks_default)
-#define extent_hooks_get JEMALLOC_N(extent_hooks_get)
-#define extent_hooks_set JEMALLOC_N(extent_hooks_set)
+#define extent_gdump_add JEMALLOC_N(extent_gdump_add)
#define extent_merge_wrapper JEMALLOC_N(extent_merge_wrapper)
-#define extent_mutex_pool JEMALLOC_N(extent_mutex_pool)
#define extent_purge_forced_wrapper JEMALLOC_N(extent_purge_forced_wrapper)
#define extent_purge_lazy_wrapper JEMALLOC_N(extent_purge_lazy_wrapper)
+#define extent_record JEMALLOC_N(extent_record)
+#define extent_sn_next JEMALLOC_N(extent_sn_next)
#define extent_split_wrapper JEMALLOC_N(extent_split_wrapper)
-#define extent_util_stats_get JEMALLOC_N(extent_util_stats_get)
-#define extent_util_stats_verbose_get JEMALLOC_N(extent_util_stats_verbose_get)
-#define extents_alloc JEMALLOC_N(extents_alloc)
-#define extents_dalloc JEMALLOC_N(extents_dalloc)
-#define extents_evict JEMALLOC_N(extents_evict)
-#define extents_init JEMALLOC_N(extents_init)
-#define extents_nbytes_get JEMALLOC_N(extents_nbytes_get)
-#define extents_nextents_get JEMALLOC_N(extents_nextents_get)
-#define extents_npages_get JEMALLOC_N(extents_npages_get)
-#define extents_postfork_child JEMALLOC_N(extents_postfork_child)
-#define extents_postfork_parent JEMALLOC_N(extents_postfork_parent)
-#define extents_prefork JEMALLOC_N(extents_prefork)
-#define extents_rtree JEMALLOC_N(extents_rtree)
-#define extents_state_get JEMALLOC_N(extents_state_get)
#define opt_lg_extent_max_active_fit JEMALLOC_N(opt_lg_extent_max_active_fit)
#define dss_prec_names JEMALLOC_N(dss_prec_names)
#define extent_alloc_dss JEMALLOC_N(extent_alloc_dss)
@@ -216,24 +301,66 @@
#define extent_alloc_mmap JEMALLOC_N(extent_alloc_mmap)
#define extent_dalloc_mmap JEMALLOC_N(extent_dalloc_mmap)
#define opt_retain JEMALLOC_N(opt_retain)
+#define fxp_parse JEMALLOC_N(fxp_parse)
+#define fxp_print JEMALLOC_N(fxp_print)
+#define opt_lg_san_uaf_align JEMALLOC_N(opt_lg_san_uaf_align)
+#define opt_san_guard_large JEMALLOC_N(opt_san_guard_large)
+#define opt_san_guard_small JEMALLOC_N(opt_san_guard_small)
+#define san_cache_bin_nonfast_mask JEMALLOC_N(san_cache_bin_nonfast_mask)
+#define san_check_stashed_ptrs JEMALLOC_N(san_check_stashed_ptrs)
+#define san_guard_pages JEMALLOC_N(san_guard_pages)
+#define san_init JEMALLOC_N(san_init)
+#define san_unguard_pages JEMALLOC_N(san_unguard_pages)
+#define san_unguard_pages_pre_destroy JEMALLOC_N(san_unguard_pages_pre_destroy)
+#define tsd_san_init JEMALLOC_N(tsd_san_init)
+#define san_bump_alloc JEMALLOC_N(san_bump_alloc)
#define hook_boot JEMALLOC_N(hook_boot)
#define hook_install JEMALLOC_N(hook_install)
#define hook_invoke_alloc JEMALLOC_N(hook_invoke_alloc)
#define hook_invoke_dalloc JEMALLOC_N(hook_invoke_dalloc)
#define hook_invoke_expand JEMALLOC_N(hook_invoke_expand)
#define hook_remove JEMALLOC_N(hook_remove)
+#define hpa_central_extract JEMALLOC_N(hpa_central_extract)
+#define hpa_central_init JEMALLOC_N(hpa_central_init)
+#define hpa_shard_destroy JEMALLOC_N(hpa_shard_destroy)
+#define hpa_shard_disable JEMALLOC_N(hpa_shard_disable)
+#define hpa_shard_do_deferred_work JEMALLOC_N(hpa_shard_do_deferred_work)
+#define hpa_shard_init JEMALLOC_N(hpa_shard_init)
+#define hpa_shard_postfork_child JEMALLOC_N(hpa_shard_postfork_child)
+#define hpa_shard_postfork_parent JEMALLOC_N(hpa_shard_postfork_parent)
+#define hpa_shard_prefork3 JEMALLOC_N(hpa_shard_prefork3)
+#define hpa_shard_prefork4 JEMALLOC_N(hpa_shard_prefork4)
+#define hpa_shard_set_deferral_allowed JEMALLOC_N(hpa_shard_set_deferral_allowed)
+#define hpa_shard_stats_accum JEMALLOC_N(hpa_shard_stats_accum)
+#define hpa_shard_stats_merge JEMALLOC_N(hpa_shard_stats_merge)
+#define hpa_supported JEMALLOC_N(hpa_supported)
+#define hpa_hooks_default JEMALLOC_N(hpa_hooks_default)
+#define hpdata_age_heap_any JEMALLOC_N(hpdata_age_heap_any)
+#define hpdata_age_heap_empty JEMALLOC_N(hpdata_age_heap_empty)
+#define hpdata_age_heap_first JEMALLOC_N(hpdata_age_heap_first)
+#define hpdata_age_heap_insert JEMALLOC_N(hpdata_age_heap_insert)
+#define hpdata_age_heap_new JEMALLOC_N(hpdata_age_heap_new)
+#define hpdata_age_heap_remove JEMALLOC_N(hpdata_age_heap_remove)
+#define hpdata_age_heap_remove_any JEMALLOC_N(hpdata_age_heap_remove_any)
+#define hpdata_age_heap_remove_first JEMALLOC_N(hpdata_age_heap_remove_first)
+#define hpdata_dehugify JEMALLOC_N(hpdata_dehugify)
+#define hpdata_hugify JEMALLOC_N(hpdata_hugify)
+#define hpdata_init JEMALLOC_N(hpdata_init)
+#define hpdata_purge_begin JEMALLOC_N(hpdata_purge_begin)
+#define hpdata_purge_end JEMALLOC_N(hpdata_purge_end)
+#define hpdata_purge_next JEMALLOC_N(hpdata_purge_next)
+#define hpdata_reserve_alloc JEMALLOC_N(hpdata_reserve_alloc)
+#define hpdata_unreserve JEMALLOC_N(hpdata_unreserve)
+#define inspect_extent_util_stats_get JEMALLOC_N(inspect_extent_util_stats_get)
+#define inspect_extent_util_stats_verbose_get JEMALLOC_N(inspect_extent_util_stats_verbose_get)
#define large_dalloc JEMALLOC_N(large_dalloc)
#define large_dalloc_finish JEMALLOC_N(large_dalloc_finish)
-#define large_dalloc_junk JEMALLOC_N(large_dalloc_junk)
-#define large_dalloc_maybe_junk JEMALLOC_N(large_dalloc_maybe_junk)
-#define large_dalloc_prep_junked_locked JEMALLOC_N(large_dalloc_prep_junked_locked)
+#define large_dalloc_prep_locked JEMALLOC_N(large_dalloc_prep_locked)
#define large_malloc JEMALLOC_N(large_malloc)
#define large_palloc JEMALLOC_N(large_palloc)
-#define large_prof_alloc_time_get JEMALLOC_N(large_prof_alloc_time_get)
-#define large_prof_alloc_time_set JEMALLOC_N(large_prof_alloc_time_set)
-#define large_prof_tctx_get JEMALLOC_N(large_prof_tctx_get)
+#define large_prof_info_get JEMALLOC_N(large_prof_info_get)
+#define large_prof_info_set JEMALLOC_N(large_prof_info_set)
#define large_prof_tctx_reset JEMALLOC_N(large_prof_tctx_reset)
-#define large_prof_tctx_set JEMALLOC_N(large_prof_tctx_set)
#define large_ralloc JEMALLOC_N(large_ralloc)
#define large_ralloc_no_move JEMALLOC_N(large_ralloc_no_move)
#define large_salloc JEMALLOC_N(large_salloc)
@@ -248,14 +375,17 @@
#define malloc_vcprintf JEMALLOC_N(malloc_vcprintf)
#define malloc_vsnprintf JEMALLOC_N(malloc_vsnprintf)
#define malloc_write JEMALLOC_N(malloc_write)
+#define wrtmessage JEMALLOC_N(wrtmessage)
+#define wrtmessage_1_0 JEMALLOC_N(wrtmessage_1_0)
#define malloc_mutex_boot JEMALLOC_N(malloc_mutex_boot)
+#define malloc_mutex_first_thread JEMALLOC_N(malloc_mutex_first_thread)
#define malloc_mutex_init JEMALLOC_N(malloc_mutex_init)
#define malloc_mutex_lock_slow JEMALLOC_N(malloc_mutex_lock_slow)
#define malloc_mutex_postfork_child JEMALLOC_N(malloc_mutex_postfork_child)
#define malloc_mutex_postfork_parent JEMALLOC_N(malloc_mutex_postfork_parent)
#define malloc_mutex_prefork JEMALLOC_N(malloc_mutex_prefork)
#define malloc_mutex_prof_data_reset JEMALLOC_N(malloc_mutex_prof_data_reset)
-#define mutex_pool_init JEMALLOC_N(mutex_pool_init)
+#define opt_mutex_max_spin JEMALLOC_N(opt_mutex_max_spin)
#define nstime_add JEMALLOC_N(nstime_add)
#define nstime_compare JEMALLOC_N(nstime_compare)
#define nstime_copy JEMALLOC_N(nstime_copy)
@@ -265,14 +395,56 @@
#define nstime_imultiply JEMALLOC_N(nstime_imultiply)
#define nstime_init JEMALLOC_N(nstime_init)
#define nstime_init2 JEMALLOC_N(nstime_init2)
+#define nstime_init_update JEMALLOC_N(nstime_init_update)
#define nstime_isubtract JEMALLOC_N(nstime_isubtract)
#define nstime_monotonic JEMALLOC_N(nstime_monotonic)
#define nstime_msec JEMALLOC_N(nstime_msec)
#define nstime_ns JEMALLOC_N(nstime_ns)
+#define nstime_ns_since JEMALLOC_N(nstime_ns_since)
#define nstime_nsec JEMALLOC_N(nstime_nsec)
+#define nstime_prof_init_update JEMALLOC_N(nstime_prof_init_update)
+#define nstime_prof_update JEMALLOC_N(nstime_prof_update)
#define nstime_sec JEMALLOC_N(nstime_sec)
#define nstime_subtract JEMALLOC_N(nstime_subtract)
#define nstime_update JEMALLOC_N(nstime_update)
+#define opt_prof_time_res JEMALLOC_N(opt_prof_time_res)
+#define prof_time_res_mode_names JEMALLOC_N(prof_time_res_mode_names)
+#define pa_alloc JEMALLOC_N(pa_alloc)
+#define pa_central_init JEMALLOC_N(pa_central_init)
+#define pa_dalloc JEMALLOC_N(pa_dalloc)
+#define pa_decay_ms_get JEMALLOC_N(pa_decay_ms_get)
+#define pa_decay_ms_set JEMALLOC_N(pa_decay_ms_set)
+#define pa_expand JEMALLOC_N(pa_expand)
+#define pa_shard_destroy JEMALLOC_N(pa_shard_destroy)
+#define pa_shard_disable_hpa JEMALLOC_N(pa_shard_disable_hpa)
+#define pa_shard_do_deferred_work JEMALLOC_N(pa_shard_do_deferred_work)
+#define pa_shard_enable_hpa JEMALLOC_N(pa_shard_enable_hpa)
+#define pa_shard_init JEMALLOC_N(pa_shard_init)
+#define pa_shard_reset JEMALLOC_N(pa_shard_reset)
+#define pa_shard_retain_grow_limit_get_set JEMALLOC_N(pa_shard_retain_grow_limit_get_set)
+#define pa_shard_set_deferral_allowed JEMALLOC_N(pa_shard_set_deferral_allowed)
+#define pa_shard_time_until_deferred_work JEMALLOC_N(pa_shard_time_until_deferred_work)
+#define pa_shrink JEMALLOC_N(pa_shrink)
+#define pa_shard_basic_stats_merge JEMALLOC_N(pa_shard_basic_stats_merge)
+#define pa_shard_mtx_stats_read JEMALLOC_N(pa_shard_mtx_stats_read)
+#define pa_shard_postfork_child JEMALLOC_N(pa_shard_postfork_child)
+#define pa_shard_postfork_parent JEMALLOC_N(pa_shard_postfork_parent)
+#define pa_shard_prefork0 JEMALLOC_N(pa_shard_prefork0)
+#define pa_shard_prefork2 JEMALLOC_N(pa_shard_prefork2)
+#define pa_shard_prefork3 JEMALLOC_N(pa_shard_prefork3)
+#define pa_shard_prefork4 JEMALLOC_N(pa_shard_prefork4)
+#define pa_shard_prefork5 JEMALLOC_N(pa_shard_prefork5)
+#define pa_shard_stats_merge JEMALLOC_N(pa_shard_stats_merge)
+#define pai_alloc_batch_default JEMALLOC_N(pai_alloc_batch_default)
+#define pai_dalloc_batch_default JEMALLOC_N(pai_dalloc_batch_default)
+#define pac_decay_all JEMALLOC_N(pac_decay_all)
+#define pac_decay_ms_get JEMALLOC_N(pac_decay_ms_get)
+#define pac_decay_ms_set JEMALLOC_N(pac_decay_ms_set)
+#define pac_destroy JEMALLOC_N(pac_destroy)
+#define pac_init JEMALLOC_N(pac_init)
+#define pac_maybe_decay_purge JEMALLOC_N(pac_maybe_decay_purge)
+#define pac_reset JEMALLOC_N(pac_reset)
+#define pac_retain_grow_limit_get_set JEMALLOC_N(pac_retain_grow_limit_get_set)
#define init_system_thp_mode JEMALLOC_N(init_system_thp_mode)
#define opt_thp JEMALLOC_N(opt_thp)
#define pages_boot JEMALLOC_N(pages_boot)
@@ -282,14 +454,23 @@
#define pages_dontdump JEMALLOC_N(pages_dontdump)
#define pages_huge JEMALLOC_N(pages_huge)
#define pages_map JEMALLOC_N(pages_map)
+#define pages_mark_guards JEMALLOC_N(pages_mark_guards)
#define pages_nohuge JEMALLOC_N(pages_nohuge)
#define pages_purge_forced JEMALLOC_N(pages_purge_forced)
#define pages_purge_lazy JEMALLOC_N(pages_purge_lazy)
#define pages_set_thp_state JEMALLOC_N(pages_set_thp_state)
#define pages_unmap JEMALLOC_N(pages_unmap)
+#define pages_unmark_guards JEMALLOC_N(pages_unmark_guards)
#define thp_mode_names JEMALLOC_N(thp_mode_names)
-#define bt2gctx_mtx JEMALLOC_N(bt2gctx_mtx)
-#define bt_init JEMALLOC_N(bt_init)
+#define peak_alloc_event_handler JEMALLOC_N(peak_alloc_event_handler)
+#define peak_alloc_new_event_wait JEMALLOC_N(peak_alloc_new_event_wait)
+#define peak_alloc_postponed_event_wait JEMALLOC_N(peak_alloc_postponed_event_wait)
+#define peak_dalloc_event_handler JEMALLOC_N(peak_dalloc_event_handler)
+#define peak_dalloc_new_event_wait JEMALLOC_N(peak_dalloc_new_event_wait)
+#define peak_dalloc_postponed_event_wait JEMALLOC_N(peak_dalloc_postponed_event_wait)
+#define peak_event_max JEMALLOC_N(peak_event_max)
+#define peak_event_update JEMALLOC_N(peak_event_update)
+#define peak_event_zero JEMALLOC_N(peak_event_zero)
#define lg_prof_sample JEMALLOC_N(lg_prof_sample)
#define opt_lg_prof_interval JEMALLOC_N(opt_lg_prof_interval)
#define opt_lg_prof_sample JEMALLOC_N(opt_lg_prof_sample)
@@ -299,20 +480,25 @@
#define opt_prof_final JEMALLOC_N(opt_prof_final)
#define opt_prof_gdump JEMALLOC_N(opt_prof_gdump)
#define opt_prof_leak JEMALLOC_N(opt_prof_leak)
-#define opt_prof_log JEMALLOC_N(opt_prof_log)
+#define opt_prof_leak_error JEMALLOC_N(opt_prof_leak_error)
#define opt_prof_prefix JEMALLOC_N(opt_prof_prefix)
+#define opt_prof_sys_thread_name JEMALLOC_N(opt_prof_sys_thread_name)
#define opt_prof_thread_active_init JEMALLOC_N(opt_prof_thread_active_init)
-#define prof_accum_init JEMALLOC_N(prof_accum_init)
-#define prof_active JEMALLOC_N(prof_active)
+#define opt_prof_unbias JEMALLOC_N(opt_prof_unbias)
#define prof_active_get JEMALLOC_N(prof_active_get)
#define prof_active_set JEMALLOC_N(prof_active_set)
+#define prof_active_state JEMALLOC_N(prof_active_state)
#define prof_alloc_rollback JEMALLOC_N(prof_alloc_rollback)
-#define prof_backtrace JEMALLOC_N(prof_backtrace)
+#define prof_backtrace_hook JEMALLOC_N(prof_backtrace_hook)
+#define prof_backtrace_hook_get JEMALLOC_N(prof_backtrace_hook_get)
+#define prof_backtrace_hook_set JEMALLOC_N(prof_backtrace_hook_set)
#define prof_boot0 JEMALLOC_N(prof_boot0)
#define prof_boot1 JEMALLOC_N(prof_boot1)
#define prof_boot2 JEMALLOC_N(prof_boot2)
-#define prof_dump_header JEMALLOC_N(prof_dump_header)
-#define prof_dump_open JEMALLOC_N(prof_dump_open)
+#define prof_booted JEMALLOC_N(prof_booted)
+#define prof_dump_hook JEMALLOC_N(prof_dump_hook)
+#define prof_dump_hook_get JEMALLOC_N(prof_dump_hook_get)
+#define prof_dump_hook_set JEMALLOC_N(prof_dump_hook_set)
#define prof_free_sampled_object JEMALLOC_N(prof_free_sampled_object)
#define prof_gdump JEMALLOC_N(prof_gdump)
#define prof_gdump_get JEMALLOC_N(prof_gdump_get)
@@ -320,18 +506,16 @@
#define prof_gdump_val JEMALLOC_N(prof_gdump_val)
#define prof_idump JEMALLOC_N(prof_idump)
#define prof_interval JEMALLOC_N(prof_interval)
-#define prof_log_start JEMALLOC_N(prof_log_start)
-#define prof_log_stop JEMALLOC_N(prof_log_stop)
-#define prof_logging_state JEMALLOC_N(prof_logging_state)
-#define prof_lookup JEMALLOC_N(prof_lookup)
#define prof_malloc_sample_object JEMALLOC_N(prof_malloc_sample_object)
#define prof_mdump JEMALLOC_N(prof_mdump)
#define prof_postfork_child JEMALLOC_N(prof_postfork_child)
#define prof_postfork_parent JEMALLOC_N(prof_postfork_parent)
#define prof_prefork0 JEMALLOC_N(prof_prefork0)
#define prof_prefork1 JEMALLOC_N(prof_prefork1)
-#define prof_reset JEMALLOC_N(prof_reset)
-#define prof_sample_threshold_update JEMALLOC_N(prof_sample_threshold_update)
+#define prof_sample_event_handler JEMALLOC_N(prof_sample_event_handler)
+#define prof_sample_new_event_wait JEMALLOC_N(prof_sample_new_event_wait)
+#define prof_sample_postponed_event_wait JEMALLOC_N(prof_sample_postponed_event_wait)
+#define prof_tctx_create JEMALLOC_N(prof_tctx_create)
#define prof_tdata_cleanup JEMALLOC_N(prof_tdata_cleanup)
#define prof_tdata_init JEMALLOC_N(prof_tdata_init)
#define prof_tdata_reinit JEMALLOC_N(prof_tdata_reinit)
@@ -341,42 +525,157 @@
#define prof_thread_active_set JEMALLOC_N(prof_thread_active_set)
#define prof_thread_name_get JEMALLOC_N(prof_thread_name_get)
#define prof_thread_name_set JEMALLOC_N(prof_thread_name_set)
+#define bt2gctx_mtx JEMALLOC_N(bt2gctx_mtx)
+#define gctx_locks JEMALLOC_N(gctx_locks)
+#define prof_bt_count JEMALLOC_N(prof_bt_count)
+#define prof_bt_hash JEMALLOC_N(prof_bt_hash)
+#define prof_bt_keycomp JEMALLOC_N(prof_bt_keycomp)
+#define prof_cnt_all JEMALLOC_N(prof_cnt_all)
+#define prof_data_init JEMALLOC_N(prof_data_init)
+#define prof_dump_impl JEMALLOC_N(prof_dump_impl)
+#define prof_dump_mtx JEMALLOC_N(prof_dump_mtx)
+#define prof_lookup JEMALLOC_N(prof_lookup)
+#define prof_reset JEMALLOC_N(prof_reset)
+#define prof_shifted_unbiased_cnt JEMALLOC_N(prof_shifted_unbiased_cnt)
+#define prof_tctx_try_destroy JEMALLOC_N(prof_tctx_try_destroy)
+#define prof_tdata_count JEMALLOC_N(prof_tdata_count)
+#define prof_tdata_detach JEMALLOC_N(prof_tdata_detach)
+#define prof_tdata_init_impl JEMALLOC_N(prof_tdata_init_impl)
+#define prof_thread_name_alloc JEMALLOC_N(prof_thread_name_alloc)
+#define prof_thread_name_set_impl JEMALLOC_N(prof_thread_name_set_impl)
+#define prof_unbias_map_init JEMALLOC_N(prof_unbias_map_init)
+#define prof_unbiased_sz JEMALLOC_N(prof_unbiased_sz)
+#define tdata_locks JEMALLOC_N(tdata_locks)
+#define tdatas_mtx JEMALLOC_N(tdatas_mtx)
+#define log_mtx JEMALLOC_N(log_mtx)
+#define opt_prof_log JEMALLOC_N(opt_prof_log)
+#define prof_log_alloc_count JEMALLOC_N(prof_log_alloc_count)
+#define prof_log_bt_count JEMALLOC_N(prof_log_bt_count)
+#define prof_log_dummy_set JEMALLOC_N(prof_log_dummy_set)
+#define prof_log_init JEMALLOC_N(prof_log_init)
+#define prof_log_is_logging JEMALLOC_N(prof_log_is_logging)
+#define prof_log_rep_check JEMALLOC_N(prof_log_rep_check)
+#define prof_log_start JEMALLOC_N(prof_log_start)
+#define prof_log_stop JEMALLOC_N(prof_log_stop)
+#define prof_log_thr_count JEMALLOC_N(prof_log_thr_count)
+#define prof_logging_state JEMALLOC_N(prof_logging_state)
+#define prof_try_log JEMALLOC_N(prof_try_log)
+#define edata_prof_recent_alloc_get_no_lock_test JEMALLOC_N(edata_prof_recent_alloc_get_no_lock_test)
+#define edata_prof_recent_alloc_init JEMALLOC_N(edata_prof_recent_alloc_init)
+#define opt_prof_recent_alloc_max JEMALLOC_N(opt_prof_recent_alloc_max)
+#define prof_recent_alloc JEMALLOC_N(prof_recent_alloc)
+#define prof_recent_alloc_dump JEMALLOC_N(prof_recent_alloc_dump)
+#define prof_recent_alloc_edata_get_no_lock_test JEMALLOC_N(prof_recent_alloc_edata_get_no_lock_test)
+#define prof_recent_alloc_list JEMALLOC_N(prof_recent_alloc_list)
+#define prof_recent_alloc_max_ctl_read JEMALLOC_N(prof_recent_alloc_max_ctl_read)
+#define prof_recent_alloc_max_ctl_write JEMALLOC_N(prof_recent_alloc_max_ctl_write)
+#define prof_recent_alloc_mtx JEMALLOC_N(prof_recent_alloc_mtx)
+#define prof_recent_alloc_prepare JEMALLOC_N(prof_recent_alloc_prepare)
+#define prof_recent_alloc_reset JEMALLOC_N(prof_recent_alloc_reset)
+#define prof_recent_dump_mtx JEMALLOC_N(prof_recent_dump_mtx)
+#define prof_recent_init JEMALLOC_N(prof_recent_init)
+#define opt_prof_stats JEMALLOC_N(opt_prof_stats)
+#define prof_stats_dec JEMALLOC_N(prof_stats_dec)
+#define prof_stats_get_accum JEMALLOC_N(prof_stats_get_accum)
+#define prof_stats_get_live JEMALLOC_N(prof_stats_get_live)
+#define prof_stats_inc JEMALLOC_N(prof_stats_inc)
+#define prof_stats_mtx JEMALLOC_N(prof_stats_mtx)
+#define bt_init JEMALLOC_N(bt_init)
+#define prof_backtrace JEMALLOC_N(prof_backtrace)
+#define prof_base JEMALLOC_N(prof_base)
+#define prof_do_mock JEMALLOC_N(prof_do_mock)
+#define prof_dump_filename_mtx JEMALLOC_N(prof_dump_filename_mtx)
+#define prof_dump_open_file JEMALLOC_N(prof_dump_open_file)
+#define prof_dump_open_maps JEMALLOC_N(prof_dump_open_maps)
+#define prof_dump_write_file JEMALLOC_N(prof_dump_write_file)
+#define prof_fdump_impl JEMALLOC_N(prof_fdump_impl)
+#define prof_gdump_impl JEMALLOC_N(prof_gdump_impl)
+#define prof_get_default_filename JEMALLOC_N(prof_get_default_filename)
+#define prof_getpid JEMALLOC_N(prof_getpid)
+#define prof_hooks_init JEMALLOC_N(prof_hooks_init)
+#define prof_idump_impl JEMALLOC_N(prof_idump_impl)
+#define prof_mdump_impl JEMALLOC_N(prof_mdump_impl)
+#define prof_prefix_set JEMALLOC_N(prof_prefix_set)
+#define prof_sys_thread_name_fetch JEMALLOC_N(prof_sys_thread_name_fetch)
+#define prof_sys_thread_name_read JEMALLOC_N(prof_sys_thread_name_read)
+#define prof_unwind_init JEMALLOC_N(prof_unwind_init)
+#define psset_init JEMALLOC_N(psset_init)
+#define psset_insert JEMALLOC_N(psset_insert)
+#define psset_pick_alloc JEMALLOC_N(psset_pick_alloc)
+#define psset_pick_hugify JEMALLOC_N(psset_pick_hugify)
+#define psset_pick_purge JEMALLOC_N(psset_pick_purge)
+#define psset_remove JEMALLOC_N(psset_remove)
+#define psset_stats_accum JEMALLOC_N(psset_stats_accum)
+#define psset_update_begin JEMALLOC_N(psset_update_begin)
+#define psset_update_end JEMALLOC_N(psset_update_end)
#define rtree_ctx_data_init JEMALLOC_N(rtree_ctx_data_init)
-#define rtree_leaf_alloc JEMALLOC_N(rtree_leaf_alloc)
-#define rtree_leaf_dalloc JEMALLOC_N(rtree_leaf_dalloc)
#define rtree_leaf_elm_lookup_hard JEMALLOC_N(rtree_leaf_elm_lookup_hard)
#define rtree_new JEMALLOC_N(rtree_new)
-#define rtree_node_alloc JEMALLOC_N(rtree_node_alloc)
-#define rtree_node_dalloc JEMALLOC_N(rtree_node_dalloc)
#define safety_check_fail JEMALLOC_N(safety_check_fail)
+#define safety_check_fail_sized_dealloc JEMALLOC_N(safety_check_fail_sized_dealloc)
#define safety_check_set_abort JEMALLOC_N(safety_check_set_abort)
+#define reg_size_compute JEMALLOC_N(reg_size_compute)
+#define sc_boot JEMALLOC_N(sc_boot)
+#define sc_data_init JEMALLOC_N(sc_data_init)
+#define sc_data_update_slab_size JEMALLOC_N(sc_data_update_slab_size)
+#define sec_disable JEMALLOC_N(sec_disable)
+#define sec_flush JEMALLOC_N(sec_flush)
+#define sec_init JEMALLOC_N(sec_init)
+#define sec_mutex_stats_read JEMALLOC_N(sec_mutex_stats_read)
+#define sec_postfork_child JEMALLOC_N(sec_postfork_child)
+#define sec_postfork_parent JEMALLOC_N(sec_postfork_parent)
+#define sec_prefork2 JEMALLOC_N(sec_prefork2)
+#define sec_stats_merge JEMALLOC_N(sec_stats_merge)
#define arena_mutex_names JEMALLOC_N(arena_mutex_names)
#define global_mutex_names JEMALLOC_N(global_mutex_names)
+#define opt_stats_interval JEMALLOC_N(opt_stats_interval)
+#define opt_stats_interval_opts JEMALLOC_N(opt_stats_interval_opts)
#define opt_stats_print JEMALLOC_N(opt_stats_print)
#define opt_stats_print_opts JEMALLOC_N(opt_stats_print_opts)
+#define stats_boot JEMALLOC_N(stats_boot)
+#define stats_interval_event_handler JEMALLOC_N(stats_interval_event_handler)
+#define stats_interval_new_event_wait JEMALLOC_N(stats_interval_new_event_wait)
+#define stats_interval_postponed_event_wait JEMALLOC_N(stats_interval_postponed_event_wait)
+#define stats_postfork_child JEMALLOC_N(stats_postfork_child)
+#define stats_postfork_parent JEMALLOC_N(stats_postfork_parent)
+#define stats_prefork JEMALLOC_N(stats_prefork)
#define stats_print JEMALLOC_N(stats_print)
-#define sc_boot JEMALLOC_N(sc_boot)
-#define sc_data_global JEMALLOC_N(sc_data_global)
-#define sc_data_init JEMALLOC_N(sc_data_init)
-#define sc_data_update_slab_size JEMALLOC_N(sc_data_update_slab_size)
#define sz_boot JEMALLOC_N(sz_boot)
#define sz_index2size_tab JEMALLOC_N(sz_index2size_tab)
+#define sz_large_pad JEMALLOC_N(sz_large_pad)
#define sz_pind2sz_tab JEMALLOC_N(sz_pind2sz_tab)
+#define sz_psz_quantize_ceil JEMALLOC_N(sz_psz_quantize_ceil)
+#define sz_psz_quantize_floor JEMALLOC_N(sz_psz_quantize_floor)
#define sz_size2index_tab JEMALLOC_N(sz_size2index_tab)
#define nhbins JEMALLOC_N(nhbins)
-#define opt_lg_tcache_max JEMALLOC_N(opt_lg_tcache_max)
+#define opt_lg_tcache_flush_large_div JEMALLOC_N(opt_lg_tcache_flush_large_div)
+#define opt_lg_tcache_flush_small_div JEMALLOC_N(opt_lg_tcache_flush_small_div)
+#define opt_lg_tcache_nslots_mul JEMALLOC_N(opt_lg_tcache_nslots_mul)
#define opt_tcache JEMALLOC_N(opt_tcache)
+#define opt_tcache_gc_delay_bytes JEMALLOC_N(opt_tcache_gc_delay_bytes)
+#define opt_tcache_gc_incr_bytes JEMALLOC_N(opt_tcache_gc_incr_bytes)
+#define opt_tcache_max JEMALLOC_N(opt_tcache_max)
+#define opt_tcache_nslots_large JEMALLOC_N(opt_tcache_nslots_large)
+#define opt_tcache_nslots_small_max JEMALLOC_N(opt_tcache_nslots_small_max)
+#define opt_tcache_nslots_small_min JEMALLOC_N(opt_tcache_nslots_small_min)
#define tcache_alloc_small_hard JEMALLOC_N(tcache_alloc_small_hard)
#define tcache_arena_associate JEMALLOC_N(tcache_arena_associate)
#define tcache_arena_reassociate JEMALLOC_N(tcache_arena_reassociate)
+#define tcache_assert_initialized JEMALLOC_N(tcache_assert_initialized)
#define tcache_bin_flush_large JEMALLOC_N(tcache_bin_flush_large)
#define tcache_bin_flush_small JEMALLOC_N(tcache_bin_flush_small)
+#define tcache_bin_flush_stashed JEMALLOC_N(tcache_bin_flush_stashed)
#define tcache_bin_info JEMALLOC_N(tcache_bin_info)
#define tcache_boot JEMALLOC_N(tcache_boot)
#define tcache_cleanup JEMALLOC_N(tcache_cleanup)
#define tcache_create_explicit JEMALLOC_N(tcache_create_explicit)
-#define tcache_event_hard JEMALLOC_N(tcache_event_hard)
#define tcache_flush JEMALLOC_N(tcache_flush)
+#define tcache_gc_dalloc_event_handler JEMALLOC_N(tcache_gc_dalloc_event_handler)
+#define tcache_gc_dalloc_new_event_wait JEMALLOC_N(tcache_gc_dalloc_new_event_wait)
+#define tcache_gc_dalloc_postponed_event_wait JEMALLOC_N(tcache_gc_dalloc_postponed_event_wait)
+#define tcache_gc_event_handler JEMALLOC_N(tcache_gc_event_handler)
+#define tcache_gc_new_event_wait JEMALLOC_N(tcache_gc_new_event_wait)
+#define tcache_gc_postponed_event_wait JEMALLOC_N(tcache_gc_postponed_event_wait)
#define tcache_maxclass JEMALLOC_N(tcache_maxclass)
#define tcache_postfork_child JEMALLOC_N(tcache_postfork_child)
#define tcache_postfork_parent JEMALLOC_N(tcache_postfork_parent)
@@ -391,9 +690,13 @@
#define tsd_tcache_enabled_data_init JEMALLOC_N(tsd_tcache_enabled_data_init)
#define test_hooks_arena_new_hook JEMALLOC_N(test_hooks_arena_new_hook)
#define test_hooks_libc_hook JEMALLOC_N(test_hooks_libc_hook)
+#define te_assert_invariants_debug JEMALLOC_N(te_assert_invariants_debug)
+#define te_event_trigger JEMALLOC_N(te_event_trigger)
+#define te_recompute_fast_threshold JEMALLOC_N(te_recompute_fast_threshold)
+#define tsd_te_init JEMALLOC_N(tsd_te_init)
+#define ticker_geom_table JEMALLOC_N(ticker_geom_table)
#define malloc_tsd_boot0 JEMALLOC_N(malloc_tsd_boot0)
#define malloc_tsd_boot1 JEMALLOC_N(malloc_tsd_boot1)
-#define malloc_tsd_cleanup_register JEMALLOC_N(malloc_tsd_cleanup_register)
#define malloc_tsd_dalloc JEMALLOC_N(malloc_tsd_dalloc)
#define malloc_tsd_malloc JEMALLOC_N(malloc_tsd_malloc)
#define tsd_booted JEMALLOC_N(tsd_booted)
diff --git a/lib/libc/stdlib/malloc/jemalloc/include/jemalloc/internal/public_namespace.h b/lib/libc/stdlib/malloc/jemalloc/include/jemalloc/internal/public_namespace.h
index 78d5c66377c3..6363f085f34b 100644
--- a/lib/libc/stdlib/malloc/jemalloc/include/jemalloc/internal/public_namespace.h
+++ b/lib/libc/stdlib/malloc/jemalloc/include/jemalloc/internal/public_namespace.h
@@ -7,11 +7,12 @@
#define je_mallctlnametomib JEMALLOC_N(mallctlnametomib)
#define je_malloc JEMALLOC_N(malloc)
#define je_malloc_conf JEMALLOC_N(malloc_conf)
+#define je_malloc_conf_2_conf_harder JEMALLOC_N(malloc_conf_2_conf_harder)
#define je_malloc_message JEMALLOC_N(malloc_message)
#define je_malloc_stats_print JEMALLOC_N(malloc_stats_print)
#define je_malloc_usable_size JEMALLOC_N(malloc_usable_size)
#define je_mallocx JEMALLOC_N(mallocx)
-#define je_smallocx_ea6b3e973b477b8061e0076bb257dbd7f3faa756 JEMALLOC_N(smallocx_ea6b3e973b477b8061e0076bb257dbd7f3faa756)
+#define je_smallocx_54eaed1d8b56b1aa528be3bdd1877e59c56fa90c JEMALLOC_N(smallocx_54eaed1d8b56b1aa528be3bdd1877e59c56fa90c)
#define je_nallocx JEMALLOC_N(nallocx)
#define je_posix_memalign JEMALLOC_N(posix_memalign)
#define je_rallocx JEMALLOC_N(rallocx)
@@ -19,4 +20,5 @@
#define je_sallocx JEMALLOC_N(sallocx)
#define je_sdallocx JEMALLOC_N(sdallocx)
#define je_xallocx JEMALLOC_N(xallocx)
+#define je_memalign JEMALLOC_N(memalign)
#define je_valloc JEMALLOC_N(valloc)
diff --git a/lib/libc/stdlib/malloc/jemalloc/include/jemalloc/jemalloc.h b/lib/libc/stdlib/malloc/jemalloc/include/jemalloc/jemalloc.h
index c3fa08e83f22..f9ed38656a87 100644
--- a/lib/libc/stdlib/malloc/jemalloc/include/jemalloc/jemalloc.h
+++ b/lib/libc/stdlib/malloc/jemalloc/include/jemalloc/jemalloc.h
@@ -19,6 +19,12 @@ extern "C" {
/* Defined if format(printf, ...) attribute is supported. */
#define JEMALLOC_HAVE_ATTR_FORMAT_PRINTF
+/* Defined if fallthrough attribute is supported. */
+#define JEMALLOC_HAVE_ATTR_FALLTHROUGH
+
+/* Defined if cold attribute is supported. */
+#define JEMALLOC_HAVE_ATTR_COLD
+
/*
* Define overrides for non-standard allocator-related functions if they are
* present on the system.
@@ -68,11 +74,12 @@ extern "C" {
# define je_mallctlnametomib mallctlnametomib
# define je_malloc malloc
# define je_malloc_conf malloc_conf
+# define je_malloc_conf_2_conf_harder malloc_conf_2_conf_harder
# define je_malloc_message malloc_message
# define je_malloc_stats_print malloc_stats_print
# define je_malloc_usable_size malloc_usable_size
# define je_mallocx mallocx
-# define je_smallocx_ea6b3e973b477b8061e0076bb257dbd7f3faa756 smallocx_ea6b3e973b477b8061e0076bb257dbd7f3faa756
+# define je_smallocx_54eaed1d8b56b1aa528be3bdd1877e59c56fa90c smallocx_54eaed1d8b56b1aa528be3bdd1877e59c56fa90c
# define je_nallocx nallocx
# define je_posix_memalign posix_memalign
# define je_rallocx rallocx
@@ -80,6 +87,7 @@ extern "C" {
# define je_sallocx sallocx
# define je_sdallocx sdallocx
# define je_xallocx xallocx
+# define je_memalign memalign
# define je_valloc valloc
#endif
@@ -91,13 +99,13 @@ extern "C" {
#include <limits.h>
#include <strings.h>
-#define JEMALLOC_VERSION "5.2.1-0-gea6b3e973b477b8061e0076bb257dbd7f3faa756"
+#define JEMALLOC_VERSION "5.3.0-0-g54eaed1d8b56b1aa528be3bdd1877e59c56fa90c"
#define JEMALLOC_VERSION_MAJOR 5
-#define JEMALLOC_VERSION_MINOR 2
-#define JEMALLOC_VERSION_BUGFIX 1
+#define JEMALLOC_VERSION_MINOR 3
+#define JEMALLOC_VERSION_BUGFIX 0
#define JEMALLOC_VERSION_NREV 0
-#define JEMALLOC_VERSION_GID "ea6b3e973b477b8061e0076bb257dbd7f3faa756"
-#define JEMALLOC_VERSION_GID_IDENT ea6b3e973b477b8061e0076bb257dbd7f3faa756
+#define JEMALLOC_VERSION_GID "54eaed1d8b56b1aa528be3bdd1877e59c56fa90c"
+#define JEMALLOC_VERSION_GID_IDENT 54eaed1d8b56b1aa528be3bdd1877e59c56fa90c
#define MALLOCX_LG_ALIGN(la) ((int)(la))
#if LG_SIZEOF_PTR == 2
@@ -158,6 +166,7 @@ extern "C" {
# endif
# define JEMALLOC_FORMAT_ARG(i)
# define JEMALLOC_FORMAT_PRINTF(s, i)
+# define JEMALLOC_FALLTHROUGH
# define JEMALLOC_NOINLINE __declspec(noinline)
# ifdef __cplusplus
# define JEMALLOC_NOTHROW __declspec(nothrow)
@@ -171,6 +180,7 @@ extern "C" {
# else
# define JEMALLOC_ALLOCATOR
# endif
+# define JEMALLOC_COLD
#elif defined(JEMALLOC_HAVE_ATTR)
# define JEMALLOC_ATTR(s) __attribute__((s))
# define JEMALLOC_ALIGNED(s) JEMALLOC_ATTR(aligned(s))
@@ -196,11 +206,21 @@ extern "C" {
# else
# define JEMALLOC_FORMAT_PRINTF(s, i)
# endif
+# ifdef JEMALLOC_HAVE_ATTR_FALLTHROUGH
+# define JEMALLOC_FALLTHROUGH JEMALLOC_ATTR(fallthrough)
+# else
+# define JEMALLOC_FALLTHROUGH
+# endif
# define JEMALLOC_NOINLINE JEMALLOC_ATTR(noinline)
# define JEMALLOC_NOTHROW JEMALLOC_ATTR(nothrow)
# define JEMALLOC_SECTION(s) JEMALLOC_ATTR(section(s))
# define JEMALLOC_RESTRICT_RETURN
# define JEMALLOC_ALLOCATOR
+# ifdef JEMALLOC_HAVE_ATTR_COLD
+# define JEMALLOC_COLD JEMALLOC_ATTR(__cold__)
+# else
+# define JEMALLOC_COLD
+# endif
#else
# define JEMALLOC_ATTR(s)
# define JEMALLOC_ALIGNED(s)
@@ -208,11 +228,19 @@ extern "C" {
# define JEMALLOC_ALLOC_SIZE2(s1, s2)
# define JEMALLOC_EXPORT
# define JEMALLOC_FORMAT_PRINTF(s, i)
+# define JEMALLOC_FALLTHROUGH
# define JEMALLOC_NOINLINE
# define JEMALLOC_NOTHROW
# define JEMALLOC_SECTION(s)
# define JEMALLOC_RESTRICT_RETURN
# define JEMALLOC_ALLOCATOR
+# define JEMALLOC_COLD
+#endif
+
+#if (defined(__APPLE__) || defined(__FreeBSD__)) && !defined(JEMALLOC_NO_RENAME)
+# define JEMALLOC_SYS_NOTHROW
+#else
+# define JEMALLOC_SYS_NOTHROW JEMALLOC_NOTHROW
#endif
/*
@@ -225,21 +253,22 @@ extern JEMALLOC_EXPORT void (*je_malloc_message)(void *cbopaque,
const char *s);
JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
- void JEMALLOC_NOTHROW *je_malloc(size_t size)
+ void JEMALLOC_SYS_NOTHROW *je_malloc(size_t size)
JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc) JEMALLOC_ALLOC_SIZE(1);
JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
- void JEMALLOC_NOTHROW *je_calloc(size_t num, size_t size)
+ void JEMALLOC_SYS_NOTHROW *je_calloc(size_t num, size_t size)
JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc) JEMALLOC_ALLOC_SIZE2(1, 2);
-JEMALLOC_EXPORT int JEMALLOC_NOTHROW je_posix_memalign(void **memptr,
- size_t alignment, size_t size) JEMALLOC_CXX_THROW JEMALLOC_ATTR(nonnull(1));
+JEMALLOC_EXPORT int JEMALLOC_SYS_NOTHROW je_posix_memalign(
+ void **memptr, size_t alignment, size_t size) JEMALLOC_CXX_THROW
+ JEMALLOC_ATTR(nonnull(1));
JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
- void JEMALLOC_NOTHROW *je_aligned_alloc(size_t alignment,
+ void JEMALLOC_SYS_NOTHROW *je_aligned_alloc(size_t alignment,
size_t size) JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc)
JEMALLOC_ALLOC_SIZE(2);
JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
- void JEMALLOC_NOTHROW *je_realloc(void *ptr, size_t size)
+ void JEMALLOC_SYS_NOTHROW *je_realloc(void *ptr, size_t size)
JEMALLOC_CXX_THROW JEMALLOC_ALLOC_SIZE(2);
-JEMALLOC_EXPORT void JEMALLOC_NOTHROW je_free(void *ptr)
+JEMALLOC_EXPORT void JEMALLOC_SYS_NOTHROW je_free(void *ptr)
JEMALLOC_CXX_THROW;
JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
@@ -269,16 +298,20 @@ JEMALLOC_EXPORT void JEMALLOC_NOTHROW je_malloc_stats_print(
const char *opts);
JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW je_malloc_usable_size(
JEMALLOC_USABLE_SIZE_CONST void *ptr) JEMALLOC_CXX_THROW;
+#ifdef JEMALLOC_HAVE_MALLOC_SIZE
+JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW je_malloc_size(
+ const void *ptr);
+#endif
#ifdef JEMALLOC_OVERRIDE_MEMALIGN
JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
- void JEMALLOC_NOTHROW *je_memalign(size_t alignment, size_t size)
+ void JEMALLOC_SYS_NOTHROW *je_memalign(size_t alignment, size_t size)
JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc);
#endif
#ifdef JEMALLOC_OVERRIDE_VALLOC
JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
- void JEMALLOC_NOTHROW *je_valloc(size_t size) JEMALLOC_CXX_THROW
+ void JEMALLOC_SYS_NOTHROW *je_valloc(size_t size) JEMALLOC_CXX_THROW
JEMALLOC_ATTR(malloc);
#endif
@@ -380,11 +413,12 @@ struct extent_hooks_s {
# define mallctlnametomib je_mallctlnametomib
# define malloc je_malloc
# define malloc_conf je_malloc_conf
+# define malloc_conf_2_conf_harder je_malloc_conf_2_conf_harder
# define malloc_message je_malloc_message
# define malloc_stats_print je_malloc_stats_print
# define malloc_usable_size je_malloc_usable_size
# define mallocx je_mallocx
-# define smallocx_ea6b3e973b477b8061e0076bb257dbd7f3faa756 je_smallocx_ea6b3e973b477b8061e0076bb257dbd7f3faa756
+# define smallocx_54eaed1d8b56b1aa528be3bdd1877e59c56fa90c je_smallocx_54eaed1d8b56b1aa528be3bdd1877e59c56fa90c
# define nallocx je_nallocx
# define posix_memalign je_posix_memalign
# define rallocx je_rallocx
@@ -412,11 +446,12 @@ struct extent_hooks_s {
# undef je_mallctlnametomib
# undef je_malloc
# undef je_malloc_conf
+# undef je_malloc_conf_2_conf_harder
# undef je_malloc_message
# undef je_malloc_stats_print
# undef je_malloc_usable_size
# undef je_mallocx
-# undef je_smallocx_ea6b3e973b477b8061e0076bb257dbd7f3faa756
+# undef je_smallocx_54eaed1d8b56b1aa528be3bdd1877e59c56fa90c
# undef je_nallocx
# undef je_posix_memalign
# undef je_rallocx
diff --git a/lib/libc/stdlib/malloc/jemalloc/include/jemalloc/jemalloc_FreeBSD.h b/lib/libc/stdlib/malloc/jemalloc/include/jemalloc/jemalloc_FreeBSD.h
index e733906bc146..34c86271ab2e 100644
--- a/lib/libc/stdlib/malloc/jemalloc/include/jemalloc/jemalloc_FreeBSD.h
+++ b/lib/libc/stdlib/malloc/jemalloc/include/jemalloc/jemalloc_FreeBSD.h
@@ -2,6 +2,8 @@
* Override settings that were generated in jemalloc_defs.h as necessary.
*/
+#ifndef JEMALLOC_NO_PRIVATE_NAMESPACE
+
#undef JEMALLOC_OVERRIDE_VALLOC
#ifndef MALLOC_PRODUCTION
@@ -96,8 +98,12 @@
#include <machine/cpufunc.h>
#define CPU_SPINWAIT cpu_spinwait()
-/* Disable lazy-lock machinery, mangle isthreaded, and adjust its type. */
+/*
+ * Disable lazy-lock machinery, redirect isthreaded to libc's flag, undo
+ * jemalloc's namespace stuff for it and adjust its type.
+ */
#undef JEMALLOC_LAZY_LOCK
+#undef isthreaded
extern int __isthreaded;
#define isthreaded ((bool)__isthreaded)
@@ -197,3 +203,5 @@ __sym_compat(sallocm, weak_sallocm, FBSD_1.3);
__sym_compat(dallocm, weak_dallocm, FBSD_1.3);
__sym_compat(nallocm, weak_nallocm, FBSD_1.3);
#endif
+
+#endif
diff --git a/lib/libc/stdlib/malloc/jemalloc/include/jemalloc/jemalloc_defs.h b/lib/libc/stdlib/malloc/jemalloc/include/jemalloc/jemalloc_defs.h
new file mode 100644
index 000000000000..fb104aaeec98
--- /dev/null
+++ b/lib/libc/stdlib/malloc/jemalloc/include/jemalloc/jemalloc_defs.h
@@ -0,0 +1,55 @@
+/* include/jemalloc/jemalloc_defs.h. Generated from jemalloc_defs.h.in by configure. */
+/* Defined if __attribute__((...)) syntax is supported. */
+#define JEMALLOC_HAVE_ATTR
+
+/* Defined if alloc_size attribute is supported. */
+#define JEMALLOC_HAVE_ATTR_ALLOC_SIZE
+
+/* Defined if format_arg(...) attribute is supported. */
+#define JEMALLOC_HAVE_ATTR_FORMAT_ARG
+
+/* Defined if format(gnu_printf, ...) attribute is supported. */
+#define JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF
+
+/* Defined if format(printf, ...) attribute is supported. */
+#define JEMALLOC_HAVE_ATTR_FORMAT_PRINTF
+
+/* Defined if fallthrough attribute is supported. */
+#define JEMALLOC_HAVE_ATTR_FALLTHROUGH
+
+/* Defined if cold attribute is supported. */
+#define JEMALLOC_HAVE_ATTR_COLD
+
+/*
+ * Define overrides for non-standard allocator-related functions if they are
+ * present on the system.
+ */
+#define JEMALLOC_OVERRIDE_MEMALIGN
+#define JEMALLOC_OVERRIDE_VALLOC
+
+/*
+ * At least Linux omits the "const" in:
+ *
+ * size_t malloc_usable_size(const void *ptr);
+ *
+ * Match the operating system's prototype.
+ */
+#define JEMALLOC_USABLE_SIZE_CONST const
+
+/*
+ * If defined, specify throw() for the public function prototypes when compiling
+ * with C++. The only justification for this is to match the prototypes that
+ * glibc defines.
+ */
+/* #undef JEMALLOC_USE_CXX_THROW */
+
+#ifdef _MSC_VER
+# ifdef _WIN64
+# define LG_SIZEOF_PTR_WIN 3
+# else
+# define LG_SIZEOF_PTR_WIN 2
+# endif
+#endif
+
+/* sizeof(void *) == 2^LG_SIZEOF_PTR. */
+#define LG_SIZEOF_PTR 3
diff --git a/lib/libc/stdlib/qsort.c b/lib/libc/stdlib/qsort.c
index e0b06494cf98..400124593d07 100644
--- a/lib/libc/stdlib/qsort.c
+++ b/lib/libc/stdlib/qsort.c
@@ -106,13 +106,11 @@ local_qsort(void *a, size_t n, size_t es, cmp_t *cmp, void *thunk)
char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
size_t d1, d2;
int cmp_result;
- int swap_cnt;
/* if there are less than 2 elements, then sorting is not needed */
if (__predict_false(n < 2))
return;
loop:
- swap_cnt = 0;
if (n < 7) {
for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
for (pl = pm;
@@ -141,7 +139,6 @@ loop:
for (;;) {
while (pb <= pc && (cmp_result = CMP(thunk, pb, a)) <= 0) {
if (cmp_result == 0) {
- swap_cnt = 1;
swapfunc(pa, pb, es);
pa += es;
}
@@ -149,7 +146,6 @@ loop:
}
while (pb <= pc && (cmp_result = CMP(thunk, pc, a)) >= 0) {
if (cmp_result == 0) {
- swap_cnt = 1;
swapfunc(pc, pd, es);
pd -= es;
}
@@ -158,18 +154,9 @@ loop:
if (pb > pc)
break;
swapfunc(pb, pc, es);
- swap_cnt = 1;
pb += es;
pc -= es;
}
- if (swap_cnt == 0) { /* Switch to insertion sort */
- for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
- for (pl = pm;
- pl > (char *)a && CMP(thunk, pl - es, pl) > 0;
- pl -= es)
- swapfunc(pl, pl - es, es);
- return;
- }
pn = (char *)a + n * es;
d1 = MIN(pa - (char *)a, pb - pa);
diff --git a/lib/libc/tests/stdio/flushlbuf_test.c b/lib/libc/tests/stdio/flushlbuf_test.c
index 11d9ea4ecc6c..3f8a6378f933 100644
--- a/lib/libc/tests/stdio/flushlbuf_test.c
+++ b/lib/libc/tests/stdio/flushlbuf_test.c
@@ -22,22 +22,23 @@ struct stream {
unsigned int pos;
};
-static int writefn(void *cookie, const char *buf, int len)
+static int
+writefn(void *cookie, const char *buf, int len)
{
struct stream *s = cookie;
int written = 0;
if (len <= 0)
- return 0;
+ return (0);
while (len > 0 && s->pos < s->len) {
s->buf[s->pos++] = *buf++;
written++;
len--;
}
if (written > 0)
- return written;
+ return (written);
errno = EAGAIN;
- return -1;
+ return (-1);
}
ATF_TC_WITHOUT_HEAD(flushlbuf_partial);
@@ -147,7 +148,6 @@ ATF_TC_BODY(flushlbuf_full, tc)
ATF_TP_ADD_TCS(tp)
{
-
ATF_TP_ADD_TC(tp, flushlbuf_partial);
ATF_TP_ADD_TC(tp, flushlbuf_full);
diff --git a/lib/libc/tests/stdio/sscanf_test.c b/lib/libc/tests/stdio/sscanf_test.c
index e916873d38c3..e43292820eeb 100644
--- a/lib/libc/tests/stdio/sscanf_test.c
+++ b/lib/libc/tests/stdio/sscanf_test.c
@@ -68,6 +68,31 @@ static const struct sscanf_test_case {
{ "0e", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 14, 2 }, { 1, 0, 1 }, },
{ "0f", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 15, 2 }, { 1, 0, 1 }, },
{ "0x", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, },
+ // all digits with two leading zeroes
+ { "000", { 1, 0, 3 }, { 1, 0, 3 }, { 1, 0, 3 }, { 1, 0, 3 }, { 1, 0, 3 }, },
+ { "001", { 1, 1, 3 }, { 1, 1, 3 }, { 1, 1, 3 }, { 1, 1, 3 }, { 1, 1, 3 }, },
+ { "002", { 1, 0, 2 }, { 1, 2, 3 }, { 1, 2, 3 }, { 1, 2, 3 }, { 1, 2, 3 }, },
+ { "003", { 1, 0, 2 }, { 1, 3, 3 }, { 1, 3, 3 }, { 1, 3, 3 }, { 1, 3, 3 }, },
+ { "004", { 1, 0, 2 }, { 1, 4, 3 }, { 1, 4, 3 }, { 1, 4, 3 }, { 1, 4, 3 }, },
+ { "005", { 1, 0, 2 }, { 1, 5, 3 }, { 1, 5, 3 }, { 1, 5, 3 }, { 1, 5, 3 }, },
+ { "006", { 1, 0, 2 }, { 1, 6, 3 }, { 1, 6, 3 }, { 1, 6, 3 }, { 1, 6, 3 }, },
+ { "007", { 1, 0, 2 }, { 1, 7, 3 }, { 1, 7, 3 }, { 1, 7, 3 }, { 1, 7, 3 }, },
+ { "008", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 8, 3 }, { 1, 8, 3 }, { 1, 0, 2 }, },
+ { "009", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 9, 3 }, { 1, 9, 3 }, { 1, 0, 2 }, },
+ { "00A", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 10, 3 }, { 1, 0, 2 }, },
+ { "00B", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 11, 3 }, { 1, 0, 2 }, },
+ { "00C", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 12, 3 }, { 1, 0, 2 }, },
+ { "00D", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 13, 3 }, { 1, 0, 2 }, },
+ { "00E", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 14, 3 }, { 1, 0, 2 }, },
+ { "00F", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 15, 3 }, { 1, 0, 2 }, },
+ { "00X", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, },
+ { "00a", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 10, 3 }, { 1, 0, 2 }, },
+ { "00b", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 11, 3 }, { 1, 0, 2 }, },
+ { "00c", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 12, 3 }, { 1, 0, 2 }, },
+ { "00d", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 13, 3 }, { 1, 0, 2 }, },
+ { "00e", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 14, 3 }, { 1, 0, 2 }, },
+ { "00f", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 15, 3 }, { 1, 0, 2 }, },
+ { "00x", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, },
// all digits with leading one
{ "10", { 1, 2, 2 }, { 1, 8, 2 }, { 1, 10, 2 }, { 1, 16, 2 }, { 1, 10, 2 }, },
{ "11", { 1, 3, 2 }, { 1, 9, 2 }, { 1, 11, 2 }, { 1, 17, 2 }, { 1, 11, 2 }, },
diff --git a/lib/libc/tests/stdio/swscanf_test.c b/lib/libc/tests/stdio/swscanf_test.c
index f7ad30b963a7..f0638081e16f 100644
--- a/lib/libc/tests/stdio/swscanf_test.c
+++ b/lib/libc/tests/stdio/swscanf_test.c
@@ -71,6 +71,31 @@ static const struct swscanf_test_case {
{ L"0e", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 14, 2 }, { 1, 0, 1 }, },
{ L"0f", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 15, 2 }, { 1, 0, 1 }, },
{ L"0x", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, },
+ // all digits with two leading zeroes
+ { L"000", { 1, 0, 3 }, { 1, 0, 3 }, { 1, 0, 3 }, { 1, 0, 3 }, { 1, 0, 3 }, },
+ { L"001", { 1, 1, 3 }, { 1, 1, 3 }, { 1, 1, 3 }, { 1, 1, 3 }, { 1, 1, 3 }, },
+ { L"002", { 1, 0, 2 }, { 1, 2, 3 }, { 1, 2, 3 }, { 1, 2, 3 }, { 1, 2, 3 }, },
+ { L"003", { 1, 0, 2 }, { 1, 3, 3 }, { 1, 3, 3 }, { 1, 3, 3 }, { 1, 3, 3 }, },
+ { L"004", { 1, 0, 2 }, { 1, 4, 3 }, { 1, 4, 3 }, { 1, 4, 3 }, { 1, 4, 3 }, },
+ { L"005", { 1, 0, 2 }, { 1, 5, 3 }, { 1, 5, 3 }, { 1, 5, 3 }, { 1, 5, 3 }, },
+ { L"006", { 1, 0, 2 }, { 1, 6, 3 }, { 1, 6, 3 }, { 1, 6, 3 }, { 1, 6, 3 }, },
+ { L"007", { 1, 0, 2 }, { 1, 7, 3 }, { 1, 7, 3 }, { 1, 7, 3 }, { 1, 7, 3 }, },
+ { L"008", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 8, 3 }, { 1, 8, 3 }, { 1, 0, 2 }, },
+ { L"009", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 9, 3 }, { 1, 9, 3 }, { 1, 0, 2 }, },
+ { L"00A", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 10, 3 }, { 1, 0, 2 }, },
+ { L"00B", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 11, 3 }, { 1, 0, 2 }, },
+ { L"00C", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 12, 3 }, { 1, 0, 2 }, },
+ { L"00D", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 13, 3 }, { 1, 0, 2 }, },
+ { L"00E", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 14, 3 }, { 1, 0, 2 }, },
+ { L"00F", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 15, 3 }, { 1, 0, 2 }, },
+ { L"00X", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, },
+ { L"00a", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 10, 3 }, { 1, 0, 2 }, },
+ { L"00b", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 11, 3 }, { 1, 0, 2 }, },
+ { L"00c", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 12, 3 }, { 1, 0, 2 }, },
+ { L"00d", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 13, 3 }, { 1, 0, 2 }, },
+ { L"00e", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 14, 3 }, { 1, 0, 2 }, },
+ { L"00f", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 15, 3 }, { 1, 0, 2 }, },
+ { L"00x", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, },
// all digits with leading one
{ L"10", { 1, 2, 2 }, { 1, 8, 2 }, { 1, 10, 2 }, { 1, 16, 2 }, { 1, 10, 2 }, },
{ L"11", { 1, 3, 2 }, { 1, 9, 2 }, { 1, 11, 2 }, { 1, 17, 2 }, { 1, 11, 2 }, },
diff --git a/lib/libc/tests/stdlib/Makefile b/lib/libc/tests/stdlib/Makefile
index 50726a5d8af6..9d84becfbd1f 100644
--- a/lib/libc/tests/stdlib/Makefile
+++ b/lib/libc/tests/stdlib/Makefile
@@ -14,6 +14,7 @@ ATF_TESTS_C+= qsort_b_test
ATF_TESTS_C+= qsort_r_compat_test
ATF_TESTS_C+= qsort_r_test
ATF_TESTS_C+= qsort_s_test
+ATF_TESTS_C+= qsort_bench
ATF_TESTS_C+= set_constraint_handler_s_test
ATF_TESTS_C+= strfmon_test
ATF_TESTS_C+= tsearch_test
diff --git a/lib/libc/tests/stdlib/qsort_bench.c b/lib/libc/tests/stdlib/qsort_bench.c
new file mode 100644
index 000000000000..5f2cfae40140
--- /dev/null
+++ b/lib/libc/tests/stdlib/qsort_bench.c
@@ -0,0 +1,113 @@
+/*-
+ * Copyright (c) 2025 Dag-Erling Smørgrav <des@FreeBSD.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <atf-c.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <unistd.h>
+
+/*-
+ * Measures qsort(3) runtime with pathological input and verify that it
+ * stays close to N * log2(N).
+ *
+ * Thanks to Vivian Hussey for the proof of concept.
+ *
+ * The input we construct is similar to a sweep from 0 to N where each
+ * half, except for the first element, has been reversed; for instance,
+ * with N = 8, we get { 0, 3, 2, 1, 4, 8, 7, 6 }. This triggers a bug in
+ * the BSD qsort(3) where it will switch to insertion sort if the pivots
+ * are sorted.
+ *
+ * This article goes into more detail about the bug and its origin:
+ *
+ * https://www.raygard.net/2022/02/26/Re-engineering-a-qsort-part-3
+ *
+ * With this optimization (the `if (swap_cnt == 0)` block), qsort(3) needs
+ * roughly N * N / 4 comparisons to sort our pathological input. Without
+ * it, it needs only a little more than N * log2(N) comparisons.
+ */
+
+/* we stop testing once a single takes longer than this */
+#define MAXRUNSECS 10
+
+static bool debugging;
+
+static uintmax_t ncmp;
+
+static int
+intcmp(const void *a, const void *b)
+{
+ ncmp++;
+ return ((*(int *)a > *(int *)b) - (*(int *)a < *(int *)b));
+}
+
+static void
+qsort_bench(int log2n)
+{
+ uintmax_t n = 1LLU << log2n;
+ int *buf;
+
+ /* fill an array with a pathological pattern */
+ ATF_REQUIRE(buf = malloc(n * sizeof(*buf)));
+ buf[0] = 0;
+ buf[n / 2] = n / 2;
+ for (unsigned int i = 1; i < n / 2; i++) {
+ buf[i] = n / 2 - i;
+ buf[n / 2 + i] = n - i;
+ }
+
+ ncmp = 0;
+ qsort(buf, n, sizeof(*buf), intcmp);
+
+ /* check result and free array */
+ if (debugging) {
+ for (unsigned int i = 1; i < n; i++) {
+ ATF_REQUIRE_MSG(buf[i] > buf[i - 1],
+ "array is not sorted");
+ }
+ }
+ free(buf);
+
+ /* check that runtime does not exceed N² */
+ ATF_CHECK_MSG(ncmp / n < n,
+ "runtime %ju exceeds N² for N = %ju", ncmp, n);
+
+ /* check that runtime does not exceed N log N by much */
+ ATF_CHECK_MSG(ncmp / n <= log2n + 1,
+ "runtime %ju exceeds N log N for N = %ju", ncmp, n);
+}
+
+ATF_TC_WITHOUT_HEAD(qsort_bench);
+ATF_TC_BODY(qsort_bench, tc)
+{
+ struct timespec t0, t1;
+ uintmax_t tus;
+
+ for (int i = 10; i <= 30; i++) {
+ clock_gettime(CLOCK_UPTIME, &t0);
+ qsort_bench(i);
+ clock_gettime(CLOCK_UPTIME, &t1);
+ tus = t1.tv_sec * 1000000 + t1.tv_nsec / 1000;
+ tus -= t0.tv_sec * 1000000 + t0.tv_nsec / 1000;
+ if (debugging) {
+ fprintf(stderr, "N = 2^%d in %ju.%06jus\n",
+ i, tus / 1000000, tus % 1000000);
+ }
+ /* stop once an individual run exceeds our limit */
+ if (tus / 1000000 >= MAXRUNSECS)
+ break;
+ }
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ debugging = !getenv("__RUNNING_INSIDE_ATF_RUN") &&
+ isatty(STDERR_FILENO);
+ ATF_TP_ADD_TC(tp, qsort_bench);
+ return (atf_no_error());
+}
diff --git a/lib/libcasper/services/cap_fileargs/cap_fileargs.3 b/lib/libcasper/services/cap_fileargs/cap_fileargs.3
index c7ce45c518d1..6a69fe7e1f4a 100644
--- a/lib/libcasper/services/cap_fileargs/cap_fileargs.3
+++ b/lib/libcasper/services/cap_fileargs/cap_fileargs.3
@@ -22,10 +22,11 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd December 6, 2023
+.Dd August 8, 2025
.Dt CAP_FILEARGS 3
.Os
.Sh NAME
+.Nm cap_fileargs ,
.Nm fileargs_cinit ,
.Nm fileargs_cinitnv ,
.Nm fileargs_init ,
@@ -35,9 +36,8 @@
.Nm fileargs_open ,
.Nm fileargs_fopen
.Nd "library for handling files in capability mode"
-.Sh LIBRARY
-.Lb libcap_fileargs
.Sh SYNOPSIS
+.Lb libcap_fileargs
.In sys/nv.h
.In libcasper.h
.In casper/cap_fileargs.h
@@ -60,52 +60,57 @@
.Ft "char *"
.Fn fileargs_realpath "fileargs_t *fa" "const char *pathname" "char *reserved_path"
.Sh DESCRIPTION
-The library is used to simplify Capsicumizing a tools that are using file system.
-Idea behind the library is that we are passing a remaining
-.Fa argc
-and
+The
+.Nm
+library is used to simplify Capsicumizing tools that are using file system.
+The idea behind the library is that we pass the remaining arguments from
.Fa argv
-which contains a list of files that should be open for this program.
-The library will create a service that will serve those files.
+(with count specified by
+.Fa argc )
+which contains the list of files that should be opened by the program.
+The library creates a service that will serve those files.
.Pp
The function
.Fn fileargs_init
-create a service to the
+creates a service to the
.Nm system.fileargs .
The
.Fa argv
contains a list of files that should be opened.
The argument can be set to
.Dv NULL
-which will not create a service and all files will be prohibited to be opened.
+to create no service and prohibit all files from being opened.
The
.Fa argc
-argument contains a number of passed files.
+argument contains the number of files passed to the program.
The
.Fa flags
-argument limits opened files for either execution or reading and/or writing.
+argument specifies whether files can be opened for execution, for reading,
+and/or for writing.
The
.Fa mode
-argument tells which what mode file should be created if the
-.Dv O_CREATE
-flag is present .
-For more details of the
+argument specifies the permissions to use when creating new files if the
+.Dv O_CREAT
+flag is set.
+For more information about the
.Fa flags
and
.Fa mode
-arguments see
+arguments, see
.Xr open 2 .
The
.Fa rightsp
-argument contains a list of the capability rights which file should be limited to.
-For more details of the capability rights see
+argument specifies the capability rights that will be applied to restrict
+access to the files.
+For more information about capability rights, see
.Xr cap_rights_init 3 .
The
.Fa operations
-argument limits the operations that are available using
+argument specifies which operations are permitted when using
.Nm system.fileargs .
+The following flags can be combined to form the
.Fa operations
-is a combination of:
+value:
.Bl -ohang -offset indent
.It FA_OPEN
Allow
@@ -122,121 +127,117 @@ Allow
.Pp
The function
.Fn fileargs_cinit
-is equivalent to
-.Fn fileargs_init
-except that the connection to the Casper needs to be provided.
+behaves identically to
+.Fn fileargs_init ,
+but requires an existing Casper connection to be passed as an argument.
.Pp
The functions
.Fn fileargs_initnv
and
.Fn fileargs_cinitnv
-are respectively equivalent to
+are equivalent to
.Fn fileargs_init
and
.Fn fileargs_cinit
-expect that all arguments all provided as
-.Xr nvlist 9 .
-For details see
-.Sx LIMITS .
+respectively, but take their arguments in the form of an
+.Xr nvlist 9
+structure.
+See the
+.Sx LIMITS
+section for details on the expected argument types and values.
.Pp
The
-.Fa fileargs_free
-close connection to the
+.Fn fileargs_free
+function closes the connection to the
.Nm system.fileargs
-service and free are structures.
-The function handle
+service and frees all associated data structures.
+The function safely handles
.Dv NULL
-argument.
+arguments.
.Pp
The function
.Fn fileargs_lstat
-is equivalent to
+provides the same functionality as
.Xr lstat 2 .
.Pp
The functions
.Fn fileargs_open
and
.Fn fileargs_fopen
-are respectively equivalent to
+behave identically to
.Xr open 2
and
.Xr fopen 3
-expect that all arguments are fetched from the
+respectively, but retrieve their arguments from the
.Va fileargs_t
structure.
.Pp
The function
.Fn fileargs_realpath
-is equivalent to
-.Xr realpath 3 .
+provides the same functionality as the standard C library function
+.Xr realpath 3 ,
+resolving all symbolic links and references in a pathname.
.Pp
+The following functions are reentrant but require synchronization for
+thread safety:
.Fn fileargs_open ,
.Fn fileargs_lstat ,
.Fn fileargs_realpath ,
.Fn fileargs_cinitnv ,
.Fn fileargs_initnv ,
and
-.Fn fileargs_fopen
-are reentrant but not thread-safe.
-That is, they may be called from separate threads only with different
+.Fn fileargs_fopen .
+Multiple threads can call these functions safely only if they use different
.Vt cap_channel_t
-arguments or with synchronization.
+arguments or proper synchronization mechanisms.
.Sh LIMITS
-This section describe which values and types should be used to pass arguments to the
+This section describes the required and optional arguments that must be
+passed to
.Fa system.fileargs
-through the
+via the
.Fn fileargs_initnv
and
.Fn fileargs_cinitnv
-functions.
-The
+functions using an
.Xr nvlist 9
-for that functions must contain the following values and types:
+structure.
+.Pp
+The following arguments are required:
.Bl -ohang -offset indent
-.It flags ( NV_TYPE_NUMBER )
-The
-.Va flags
-limits opened files for either execution or reading and/or writing.
-.It mode (NV_TYPE_NUMBER)
-If in the
-.Va flags
-argument the
+.It flags Pq Dv NV_TYPE_NUMBER
+Specifies access permissions for opened files.
+.It mode Pq Dv NV_TYPE_NUMBER
+Required when the
.Dv O_CREATE
-flag was defined the
-.Xr nvlist 9
-must contain the
-.Va mode .
-The
-.Va mode
-argument tells which what mode file should be created.
-.It operations (NV_TYPE_NUMBER)
-The
-.Va operations
-limits the usable operations for
+flag is set in
+.Va flags .
+Specifies the permissions to use when creating new files.
+.It operations Pq Dv NV_TYPE_NUMBER
+Specifies which operations are allowed for
.Fa system.fileargs .
-The possible values are explained as
+See the description of the
.Va operations
-argument with
-.Fn fileargs_init .
+argument in
+.Fn fileargs_init
+for possible values.
.El
.Pp
-The
+The following arguments are optional in the
.Xr nvlist 9
-for that functions may contain the following values and types:
+structure:
.Bl -ohang -offset indent
-.It cap_rights ( NV_TYPE_BINARY )
+.It cap_rights Pq Dv NV_TYPE_BINARY
The
.Va cap_rights
-argument contains a list of the capability rights which file should be limited to.
-.It ( NV_TYPE_NULL )
-Any number of
+argument specifies the capability rights that will be applied to restrict
+access to opened files.
+.It filenames Pq Dv NV_TYPE_NULL
+Multiple
.Dv NV_TYPE_NULL
-where the name of the element is name of the file which can be opened.
+elements can be provided, where each element's name represents a file
+path that is allowed to be opened.
.El
.Sh EXAMPLES
-The following example first parse some options and then create the
-.Nm system.fileargs
-service with remaining arguments.
.Bd -literal
int ch, fd, i;
cap_rights_t rights;
@@ -287,16 +288,13 @@ fileargs_free(fa);
.Xr nv 9
.Sh HISTORY
The
-.Nm cap_fileargs
+.Nm
service first appeared in
.Fx 10.3 .
.Sh AUTHORS
.An Mariusz Zaborski Aq Mt oshogbo@FreeBSD.org
.Sh BUGS
The
-.Lb cap_fileargs
-included in
-.Fx
-is considered experimental, and should not be deployed in production
-environments without careful consideration of the risks associated with
-the use of experimental operating system features.
+.Nm
+service is considered experimental and should be thoroughly evaluated
+for risks before deploying in production environments.
diff --git a/lib/libmilter/Makefile b/lib/libmilter/Makefile
index dd6a481d1a15..ff16b4d00297 100644
--- a/lib/libmilter/Makefile
+++ b/lib/libmilter/Makefile
@@ -1,6 +1,6 @@
.include <src.opts.mk>
-PACKAGE=sendmail
+PACKAGE=lib${LIB}
SENDMAIL_DIR=${SRCTOP}/contrib/sendmail
.PATH: ${SENDMAIL_DIR}/libmilter ${SENDMAIL_DIR}/libsm
diff --git a/lib/libpam/modules/pam_ksu/pam_ksu.c b/lib/libpam/modules/pam_ksu/pam_ksu.c
index 002613188d8c..04c276a423d3 100644
--- a/lib/libpam/modules/pam_ksu/pam_ksu.c
+++ b/lib/libpam/modules/pam_ksu/pam_ksu.c
@@ -58,24 +58,13 @@ static int auth_krb5(pam_handle_t *, krb5_context, const char *,
#define KRB5_DEFAULT_CCFILE_ROOT "/tmp/krb5cc_"
#define KRB5_DEFAULT_CCROOT "FILE:" KRB5_DEFAULT_CCFILE_ROOT
-/*
- * XXX We will replace krb5_build_principal_va() with
- * XXX krb5_build_principal_alloc_va() when Heimdal is finally
- * XXX removed.
- */
-krb5_error_code KRB5_CALLCONV
-krb5_build_principal_va(krb5_context context,
- krb5_principal princ,
- unsigned int rlen,
- const char *realm,
- va_list ap);
typedef char *heim_general_string;
typedef heim_general_string Realm;
typedef Realm krb5_realm;
typedef const char *krb5_const_realm;
static krb5_error_code
-krb5_make_principal(krb5_context context, krb5_principal principal,
+krb5_make_principal(krb5_context context, krb5_principal *principal,
krb5_const_realm realm, ...)
{
krb5_realm temp_realm = NULL;
@@ -88,15 +77,9 @@ krb5_make_principal(krb5_context context, krb5_principal principal,
realm=temp_realm;
}
va_start(ap, realm);
- /*
- * XXX Ideally we should be using krb5_build_principal_alloc_va()
- * XXX here because krb5_build_principal_va() is deprecated. But,
- * XXX this would require changes elsewhere in the calling code
- * XXX to call krb5_free_principal() elsewhere to free the
- * XXX principal. We can do that after Heimdal is removed from
- * XXX our tree.
- */
- rc = krb5_build_principal_va(context, principal, strlen(realm), realm, ap);
+
+ rc = krb5_build_principal_alloc_va(context, principal, strlen(realm),
+ realm, ap);
va_end(ap);
if (temp_realm)
free(temp_realm);
@@ -273,13 +256,7 @@ get_su_principal(krb5_context context, const char *target_user, const char *curr
if (rv != 0)
return (errno);
if (default_principal == NULL) {
-#ifdef MK_MITKRB5
- /* For MIT KRB5. */
- rv = krb5_make_principal(context, default_principal, NULL, current_user, NULL);
-#else
- /* For Heimdal. */
rv = krb5_make_principal(context, &default_principal, NULL, current_user, NULL);
-#endif
if (rv != 0) {
PAM_LOG("Could not determine default principal name.");
return (rv);
diff --git a/lib/libregex/tests/gnuext.in b/lib/libregex/tests/gnuext.in
index 8f49854235a9..3ce0f4af1b34 100644
--- a/lib/libregex/tests/gnuext.in
+++ b/lib/libregex/tests/gnuext.in
@@ -10,9 +10,9 @@ a\|b\|c b abc a
(ab)\1 - abab abab
\1(ab) C ESUBREG
(a)(b)(c)(d)(e)(f)(g)(h)(i)\9 - abcdefghii abcdefghii
-# \w, \W, \s, \S (alnum, ^alnum, space, ^space)
-\w+ - -%@a0X- a0X
-\w\+ b -%@a0X- a0X
+# \w, \W, \s, \S (_alnum, ^_alnum, space, ^space)
+\w+ - -%@a_0X- a_0X
+\w\+ b -%@a_0X- a_0X
\s+ - aSNTb SNT
\s\+ b aSNTb SNT
# Word boundaries (\b, \B, \<, \>, \`, \')
diff --git a/lib/librpcsec_gss/Makefile b/lib/librpcsec_gss/Makefile
index a29d9780c1ab..eebc975acbd2 100644
--- a/lib/librpcsec_gss/Makefile
+++ b/lib/librpcsec_gss/Makefile
@@ -1,10 +1,16 @@
+.include <src.opts.mk>
+
PACKAGE=lib${LIB}
LIB= rpcsec_gss
SHLIB_MAJOR= 1
SRCS+= rpcsec_gss.c rpcsec_gss_prot.c rpcsec_gss_conf.c rpcsec_gss_misc.c \
svc_rpcsec_gss.c
+.if ${MK_MITKRB5} == "no"
LIBADD= gssapi
+.else
+LIBADD= gssapi_krb5
+.endif
VERSION_DEF= ${SRCTOP}/lib/libc/Versions.def
SYMBOL_MAPS= ${.CURDIR}/Symbol.map
diff --git a/lib/libsys/Makefile.sys b/lib/libsys/Makefile.sys
index 7871731dcdcd..bd65b58083c2 100644
--- a/lib/libsys/Makefile.sys
+++ b/lib/libsys/Makefile.sys
@@ -52,7 +52,6 @@ STATICOBJS+= interposing_table.o
PSEUDO= \
__realpathat \
clock_gettime \
- exit \
getlogin \
gettimeofday \
sched_getcpu
diff --git a/lib/libsys/Symbol.sys.map b/lib/libsys/Symbol.sys.map
index 45e0160100af..1a297f9df581 100644
--- a/lib/libsys/Symbol.sys.map
+++ b/lib/libsys/Symbol.sys.map
@@ -89,7 +89,6 @@ FBSD_1.0 {
geteuid;
getfh;
getgid;
- getgroups;
getitimer;
getpagesize;
getpeername;
@@ -204,7 +203,6 @@ FBSD_1.0 {
setegid;
seteuid;
setgid;
- setgroups;
setitimer;
setlogin;
setpgid;
@@ -380,11 +378,13 @@ FBSD_1.7 {
FBSD_1.8 {
exterrctl;
fchroot;
+ getgroups;
getrlimitusage;
inotify_add_watch_at;
inotify_rm_watch;
kcmp;
setcred;
+ setgroups;
};
FBSDprivate_1.0 {
diff --git a/lib/libsys/_libsys.h b/lib/libsys/_libsys.h
index 7a1685cca2d1..34eebc1aa67a 100644
--- a/lib/libsys/_libsys.h
+++ b/lib/libsys/_libsys.h
@@ -65,7 +65,7 @@ struct uuid;
union semun;
__BEGIN_DECLS
-typedef void (__sys_exit_t)(int);
+typedef void (__sys__exit_t)(int);
typedef int (__sys_fork_t)(void);
typedef ssize_t (__sys_read_t)(int, void *, size_t);
typedef ssize_t (__sys_write_t)(int, const void *, size_t);
@@ -121,8 +121,6 @@ typedef int (__sys_munmap_t)(void *, size_t);
typedef int (__sys_mprotect_t)(void *, size_t, int);
typedef int (__sys_madvise_t)(void *, size_t, int);
typedef int (__sys_mincore_t)(const void *, size_t, char *);
-typedef int (__sys_getgroups_t)(int, gid_t *);
-typedef int (__sys_setgroups_t)(int, const gid_t *);
typedef int (__sys_getpgrp_t)(void);
typedef int (__sys_setpgid_t)(int, int);
typedef int (__sys_setitimer_t)(int, const struct itimerval *, struct itimerval *);
@@ -468,8 +466,10 @@ typedef int (__sys_setcred_t)(u_int, const struct setcred *, size_t);
typedef int (__sys_exterrctl_t)(u_int, u_int, void *);
typedef int (__sys_inotify_add_watch_at_t)(int, int, const char *, uint32_t);
typedef int (__sys_inotify_rm_watch_t)(int, int);
+typedef int (__sys_getgroups_t)(int, gid_t *);
+typedef int (__sys_setgroups_t)(int, const gid_t *);
-void __sys_exit(int rval);
+_Noreturn void __sys__exit(int rval);
int __sys_fork(void);
ssize_t __sys_read(int fd, void * buf, size_t nbyte);
ssize_t __sys_write(int fd, const void * buf, size_t nbyte);
@@ -525,8 +525,6 @@ int __sys_munmap(void * addr, size_t len);
int __sys_mprotect(void * addr, size_t len, int prot);
int __sys_madvise(void * addr, size_t len, int behav);
int __sys_mincore(const void * addr, size_t len, char * vec);
-int __sys_getgroups(int gidsetsize, gid_t * gidset);
-int __sys_setgroups(int gidsetsize, const gid_t * gidset);
int __sys_getpgrp(void);
int __sys_setpgid(int pid, int pgid);
int __sys_setitimer(int which, const struct itimerval * itv, struct itimerval * oitv);
@@ -872,6 +870,8 @@ int __sys_setcred(u_int flags, const struct setcred * wcred, size_t size);
int __sys_exterrctl(u_int op, u_int flags, void * ptr);
int __sys_inotify_add_watch_at(int fd, int dfd, const char * path, uint32_t mask);
int __sys_inotify_rm_watch(int fd, int wd);
+int __sys_getgroups(int gidsetsize, gid_t * gidset);
+int __sys_setgroups(int gidsetsize, const gid_t * gidset);
__END_DECLS
#endif /* __LIBSYS_H_ */
diff --git a/lib/libsys/amd64/amd64_get_fsbase.c b/lib/libsys/amd64/amd64_get_fsbase.c
index 00f16a5e404f..b5e87f8a3ce5 100644
--- a/lib/libsys/amd64/amd64_get_fsbase.c
+++ b/lib/libsys/amd64/amd64_get_fsbase.c
@@ -30,7 +30,6 @@
* SUCH DAMAGE.
*/
-#define _WANT_P_OSREL
#include <sys/param.h>
#include <machine/cpufunc.h>
#include <machine/specialreg.h>
@@ -41,7 +40,6 @@
static int
amd64_get_fsbase_cpu(void **addr)
{
-
*addr = (void *)rdfsbase();
return (0);
}
@@ -49,15 +47,12 @@ amd64_get_fsbase_cpu(void **addr)
static int
amd64_get_fsbase_syscall(void **addr)
{
-
return (sysarch(AMD64_GET_FSBASE, addr));
}
DEFINE_UIFUNC(, int, amd64_get_fsbase, (void **))
{
-
- if (__getosreldate() >= P_OSREL_WRFSBASE &&
- (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0)
+ if ((cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0)
return (amd64_get_fsbase_cpu);
return (amd64_get_fsbase_syscall);
}
diff --git a/lib/libsys/amd64/amd64_get_gsbase.c b/lib/libsys/amd64/amd64_get_gsbase.c
index ef135b1eed7f..51be412ddd7a 100644
--- a/lib/libsys/amd64/amd64_get_gsbase.c
+++ b/lib/libsys/amd64/amd64_get_gsbase.c
@@ -30,7 +30,6 @@
* SUCH DAMAGE.
*/
-#define _WANT_P_OSREL
#include <sys/param.h>
#include <machine/cpufunc.h>
#include <machine/specialreg.h>
@@ -41,7 +40,6 @@
static int
amd64_get_gsbase_cpu(void **addr)
{
-
*addr = (void *)rdgsbase();
return (0);
}
@@ -49,15 +47,12 @@ amd64_get_gsbase_cpu(void **addr)
static int
amd64_get_gsbase_syscall(void **addr)
{
-
return (sysarch(AMD64_GET_GSBASE, addr));
}
DEFINE_UIFUNC(, int, amd64_get_gsbase, (void **))
{
-
- if (__getosreldate() >= P_OSREL_WRFSBASE &&
- (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0)
+ if ((cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0)
return (amd64_get_gsbase_cpu);
return (amd64_get_gsbase_syscall);
}
diff --git a/lib/libsys/amd64/amd64_set_fsbase.c b/lib/libsys/amd64/amd64_set_fsbase.c
index f1690fde6e17..5265bd712f17 100644
--- a/lib/libsys/amd64/amd64_set_fsbase.c
+++ b/lib/libsys/amd64/amd64_set_fsbase.c
@@ -30,7 +30,6 @@
* SUCH DAMAGE.
*/
-#define _WANT_P_OSREL
#include <sys/param.h>
#include <machine/cpufunc.h>
#include <machine/specialreg.h>
@@ -41,7 +40,6 @@
static int
amd64_set_fsbase_cpu(void *addr)
{
-
wrfsbase((uintptr_t)addr);
return (0);
}
@@ -49,15 +47,12 @@ amd64_set_fsbase_cpu(void *addr)
static int
amd64_set_fsbase_syscall(void *addr)
{
-
return (sysarch(AMD64_SET_FSBASE, &addr));
}
DEFINE_UIFUNC(, int, amd64_set_fsbase, (void *))
{
-
- if (__getosreldate() >= P_OSREL_WRFSBASE &&
- (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0)
+ if ((cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0)
return (amd64_set_fsbase_cpu);
return (amd64_set_fsbase_syscall);
}
diff --git a/lib/libsys/amd64/amd64_set_gsbase.c b/lib/libsys/amd64/amd64_set_gsbase.c
index 756bbae18844..94f5736ed1ab 100644
--- a/lib/libsys/amd64/amd64_set_gsbase.c
+++ b/lib/libsys/amd64/amd64_set_gsbase.c
@@ -30,7 +30,6 @@
* SUCH DAMAGE.
*/
-#define _WANT_P_OSREL
#include <sys/param.h>
#include <machine/cpufunc.h>
#include <machine/specialreg.h>
@@ -41,7 +40,6 @@
static int
amd64_set_gsbase_cpu(void *addr)
{
-
wrgsbase((uintptr_t)addr);
return (0);
}
@@ -49,15 +47,12 @@ amd64_set_gsbase_cpu(void *addr)
static int
amd64_set_gsbase_syscall(void *addr)
{
-
return (sysarch(AMD64_SET_GSBASE, &addr));
}
DEFINE_UIFUNC(, int, amd64_set_gsbase, (void *))
{
-
- if (__getosreldate() >= P_OSREL_WRFSBASE &&
- (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0)
+ if ((cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0)
return (amd64_set_gsbase_cpu);
return (amd64_set_gsbase_syscall);
}
diff --git a/lib/libsys/getgroups.2 b/lib/libsys/getgroups.2
index 91cca2748ec2..37c8fbad7215 100644
--- a/lib/libsys/getgroups.2
+++ b/lib/libsys/getgroups.2
@@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd January 21, 2011
+.Dd August 1, 2025
.Dt GETGROUPS 2
.Os
.Sh NAME
@@ -41,8 +41,8 @@
The
.Fn getgroups
system call
-gets the current group access list of the user process
-and stores it in the array
+gets the current supplementary groups of the user process and stores it in the
+array
.Fa gidset .
The
.Fa gidsetlen
@@ -54,7 +54,7 @@ The
system call
returns the actual number of groups returned in
.Fa gidset .
-At least one and as many as {NGROUPS_MAX}+1 values may be returned.
+As many as {NGROUPS_MAX} values may be returned.
If
.Fa gidsetlen
is zero,
@@ -102,3 +102,10 @@ The
.Fn getgroups
system call appeared in
.Bx 4.2 .
+.Pp
+Before
+.Fx 15.0 ,
+the
+.Fn getgroups
+system call always returned the effective group ID for the process as the first
+element of the array, before the supplementary groups.
diff --git a/lib/libsys/pathconf.2 b/lib/libsys/pathconf.2
index 79ac8310000d..5a983a3a13e2 100644
--- a/lib/libsys/pathconf.2
+++ b/lib/libsys/pathconf.2
@@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd July 5, 2025
+.Dd August 6, 2025
.Dt PATHCONF 2
.Os
.Sh NAME
@@ -187,6 +187,11 @@ and
flags can be set by
.Xr chflags 2 ,
otherwise 0.
+.It Li _PC_CLONE_BLKSIZE
+Returns the block size required for block cloning via
+.Xr copy_file_range 2
+for a file system if block cloning is supported,
+otherwise 0.
.El
.Sh RETURN VALUES
If the call to
@@ -264,6 +269,7 @@ Corrupted data was detected while reading from the file system.
.El
.Sh SEE ALSO
.Xr chflags 2 ,
+.Xr copy_file_range 2 ,
.Xr lseek 2 ,
.Xr sysctl 3
.Sh HISTORY
diff --git a/lib/libsys/setgroups.2 b/lib/libsys/setgroups.2
index a226aeafea96..451f63ba1266 100644
--- a/lib/libsys/setgroups.2
+++ b/lib/libsys/setgroups.2
@@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd January 19, 2018
+.Dd August 1, 2025
.Dt SETGROUPS 2
.Os
.Sh NAME
@@ -42,7 +42,7 @@
The
.Fn setgroups
system call
-sets the group access list of the current user process
+sets the supplementary group list of the current user process
according to the array
.Fa gidset .
The
@@ -50,26 +50,12 @@ The
argument
indicates the number of entries in the array and must be no
more than
-.Dv {NGROUPS_MAX}+1 .
-.Pp
-Only the super-user may set a new group list.
+.Dv {NGROUPS_MAX} .
+The
+.Fa ngroups
+argument may be set to 0 to clear the supplementary group list.
.Pp
-The first entry of the group array
-.Pq Va gidset[0]
-is used as the effective group-ID for the process.
-This entry is over-written when a setgid program is run.
-To avoid losing access to the privileges of the
-.Va gidset[0]
-entry, it should be duplicated later in the group array.
-By convention,
-this happens because the group value indicated
-in the password file also appears in
-.Pa /etc/group .
-The group value in the password file is placed in
-.Va gidset[0]
-and that value then gets added a second time when the
-.Pa /etc/group
-file is scanned to create the group set.
+Only the super-user may set a new supplementary group list.
.Sh RETURN VALUES
.Rv -std setgroups
.Sh ERRORS
@@ -99,3 +85,11 @@ The
.Fn setgroups
system call appeared in
.Bx 4.2 .
+.Pp
+Before
+.Fx 15.0 ,
+the
+.Fn setgroups
+system call would set the effective group ID for the process to the first
+element of
+.Fa gidset .
diff --git a/lib/libsys/shm_open.2 b/lib/libsys/shm_open.2
index 8bea939690ba..c3196d966e6b 100644
--- a/lib/libsys/shm_open.2
+++ b/lib/libsys/shm_open.2
@@ -26,7 +26,7 @@
.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd January 30, 2023
+.Dd August 4, 2025
.Dt SHM_OPEN 2
.Os
.Sh NAME
@@ -74,8 +74,9 @@ must be included in
The optional flags
.Dv O_CREAT ,
.Dv O_EXCL ,
+.Dv O_TRUNC ,
and
-.Dv O_TRUNC
+.Dv O_CLOFORK
may also be specified.
.Pp
If
diff --git a/lib/libsys/syscalls.map b/lib/libsys/syscalls.map
index 69fce2ea7c63..4cf80a2ffc69 100644
--- a/lib/libsys/syscalls.map
+++ b/lib/libsys/syscalls.map
@@ -7,7 +7,7 @@
FBSDprivate_1.0 {
_syscall;
__sys_syscall;
- __sys_exit;
+ __sys__exit;
_fork;
__sys_fork;
_read;
@@ -117,10 +117,6 @@ FBSDprivate_1.0 {
__sys_madvise;
_mincore;
__sys_mincore;
- _getgroups;
- __sys_getgroups;
- _setgroups;
- __sys_setgroups;
_getpgrp;
__sys_getpgrp;
_setpgid;
@@ -813,4 +809,8 @@ FBSDprivate_1.0 {
__sys_inotify_add_watch_at;
_inotify_rm_watch;
__sys_inotify_rm_watch;
+ _getgroups;
+ __sys_getgroups;
+ _setgroups;
+ __sys_setgroups;
};
diff --git a/lib/libutil++/Makefile b/lib/libutil++/Makefile
index df3074c2278e..56b64bbf358c 100644
--- a/lib/libutil++/Makefile
+++ b/lib/libutil++/Makefile
@@ -1,4 +1,3 @@
-PACKAGE= lib${LIB}
LIB_CXX= util++
INTERNALLIB= true
SHLIB_MAJOR= 1
diff --git a/lib/libutil++/libutil++.hh b/lib/libutil++/libutil++.hh
index ecf737f2fcb0..60e6b3fc5fde 100644
--- a/lib/libutil++/libutil++.hh
+++ b/lib/libutil++/libutil++.hh
@@ -70,7 +70,7 @@ namespace freebsd {
class fd_up {
public:
fd_up() : fd(-1) {}
- fd_up(int fd) : fd(fd) {}
+ fd_up(int _fd) : fd(_fd) {}
fd_up(fd_up &&other) : fd(other.release()) {}
fd_up(fd_up const &) = delete;
@@ -159,7 +159,7 @@ namespace freebsd {
class pidfile {
public:
pidfile() = default;
- pidfile(struct pidfh *pfh) : pfh(pfh) {}
+ pidfile(struct pidfh *_pfh) : pfh(_pfh) {}
pidfile(pidfile &&other) : pfh(other.release()) {}
pidfile(pidfile const &) = delete;
diff --git a/lib/libutil/Makefile b/lib/libutil/Makefile
index f8c566ca731a..f6251c093345 100644
--- a/lib/libutil/Makefile
+++ b/lib/libutil/Makefile
@@ -136,7 +136,6 @@ MLINKS+=quotafile.3 quota_on.3
MLINKS+=quotafile.3 quota_open.3
MLINKS+=quotafile.3 quota_qfname.3
MLINKS+=quotafile.3 quota_read.3
-MLINKS+=quotafile.3 quota_statfs.3
MLINKS+=quotafile.3 quota_write_limits.3
MLINKS+=quotafile.3 quota_write_usage.3
MAN+= realhostname.3
diff --git a/lib/libutil/Symbol.map b/lib/libutil/Symbol.map
index 8c8fff451cd1..2b28456f4406 100644
--- a/lib/libutil/Symbol.map
+++ b/lib/libutil/Symbol.map
@@ -13,6 +13,7 @@ FBSD_1.8 {
cpuset_parselist;
domainset_parselist;
expand_number;
+ expand_unsigned;
flopen;
flopenat;
forkpty;
@@ -119,6 +120,14 @@ FBSD_1.8 {
uu_lock;
uu_lockerr;
uu_unlock;
+
+ /*
+ * login_setcryptfmt() uses crypt_set_format() from libcrypt. To
+ * avoid forcing a hard dependency on libcrypt, we provide a weak
+ * stub. Applications that use login_setcryptfmt() should link
+ * with libcrypt, whose crypt_set_format() will override the stub.
+ */
+ crypt_set_format;
};
FBSDprivate_1.0 {
diff --git a/lib/libutil/expand_number.3 b/lib/libutil/expand_number.3
index 1b932400de69..b1833cedf406 100644
--- a/lib/libutil/expand_number.3
+++ b/lib/libutil/expand_number.3
@@ -24,11 +24,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd July 25, 2025
+.Dd August 6, 2025
.Dt EXPAND_NUMBER 3
.Os
.Sh NAME
-.Nm expand_number
+.Nm expand_number ,
+.Nm expand_unsigned
.Nd parse a number from human readable form
.Sh LIBRARY
.Lb libutil
@@ -38,6 +39,10 @@
.Fo expand_number
.Fa "const char *buf" "int64_t *num"
.Fc
+.Ft int
+.Fo expand_unsigned
+.Fa "const char *buf" "uint64_t *num"
+.Fc
.Sh DESCRIPTION
The
.Fn expand_number
@@ -48,6 +53,17 @@ quantity in the location pointed to by its
.Fa *num
argument.
.Pp
+The
+.Fn expand_unsigned
+function is similar to
+.Fn expand_number ,
+but accepts only positive numbers in the range
+.Bq 0, Ns Dv UINT64_MAX .
+.Pp
+Both functions interpret the input
+.Dq -0
+as 0.
+.Pp
The input string must consist of a decimal number, optionally preceded
by a
.Sq +
@@ -81,20 +97,38 @@ is interpreted as 5, and
.Dq 5kb
is interpreted as 5,120).
However, the usage of this suffix is discouraged.
+.Pp
+For backward compatibility reasons, if the compiler supports generic
+selection, a macro is provided which automatically replaces calls to
+.Fn expand_number
+with calls to
+.Fn expand_unsigned
+if the type of the actual
+.Va num
+argument is compatible with
+.Vt uint64_t * .
.Sh RETURN VALUES
.Rv -std
.Sh ERRORS
The
.Fn expand_number
-function will fail if:
+and
+.Fn expand_unsigned
+functions will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The given string does not contain a valid number.
.It Bq Er EINVAL
An unrecognized suffix was encountered.
.It Bq Er ERANGE
-The given string represents a number which does not fit into a
-.Vt int64_t .
+The given string represents a number which does not fit into an
+.Vt int64_t
+(for
+.Fn expand_number )
+or
+.Vt uint64_t
+(for
+.Fn expand_unsigned ) .
.El
.Sh SEE ALSO
.Xr humanize_number 3
@@ -103,3 +137,17 @@ The
.Fn expand_number
function first appeared in
.Fx 6.3 .
+The original implementation did not handle negative numbers correctly,
+and it was switched to taking a
+.Vt uint64_t *
+and accepting only positive numbers in
+.Fx 9.0 .
+The
+.Fn expand_unsigned
+function was added,
+and
+.Fn expand_number
+switched back to
+.Vt int64_t * ,
+in
+.Fx 15.0 .
diff --git a/lib/libutil/expand_number.c b/lib/libutil/expand_number.c
index f4c19d7867a3..a3313ba39d98 100644
--- a/lib/libutil/expand_number.c
+++ b/lib/libutil/expand_number.c
@@ -37,13 +37,12 @@
#include <stdbool.h>
#include <stdint.h>
-int
-expand_number(const char *buf, int64_t *num)
+static int
+expand_impl(const char *buf, uint64_t *num, bool *neg)
{
char *endptr;
uintmax_t number;
unsigned int shift;
- bool neg;
int serrno;
/*
@@ -52,10 +51,10 @@ expand_number(const char *buf, int64_t *num)
while (isspace((unsigned char)*buf))
buf++;
if (*buf == '-') {
- neg = true;
+ *neg = true;
buf++;
} else {
- neg = false;
+ *neg = false;
if (*buf == '+')
buf++;
}
@@ -127,6 +126,22 @@ expand_number(const char *buf, int64_t *num)
}
number <<= shift;
+ *num = number;
+ return (0);
+}
+
+int
+(expand_number)(const char *buf, int64_t *num)
+{
+ uint64_t number;
+ bool neg;
+
+ /*
+ * Parse the number.
+ */
+ if (expand_impl(buf, &number, &neg) != 0)
+ return (-1);
+
/*
* Apply the sign and check for overflow.
*/
@@ -146,3 +161,27 @@ expand_number(const char *buf, int64_t *num)
return (0);
}
+
+int
+expand_unsigned(const char *buf, uint64_t *num)
+{
+ uint64_t number;
+ bool neg;
+
+ /*
+ * Parse the number.
+ */
+ if (expand_impl(buf, &number, &neg) != 0)
+ return (-1);
+
+ /*
+ * Negative numbers are out of range.
+ */
+ if (neg && number > 0) {
+ errno = ERANGE;
+ return (-1);
+ }
+
+ *num = number;
+ return (0);
+}
diff --git a/lib/libutil/libutil.h b/lib/libutil/libutil.h
index d27262e44daf..9b5b2abe7f09 100644
--- a/lib/libutil/libutil.h
+++ b/lib/libutil/libutil.h
@@ -89,6 +89,14 @@ __BEGIN_DECLS
void clean_environment(const char * const *_white,
const char * const *_more_white);
int expand_number(const char *_buf, int64_t *_num);
+int expand_unsigned(const char *_buf, uint64_t *_num);
+#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
+ __has_extension(c_generic_selections)
+#define expand_number(_buf, _num) \
+ _Generic((_num), \
+ uint64_t *: expand_unsigned, \
+ default: expand_number)((_buf), (_num))
+#endif
int extattr_namespace_to_string(int _attrnamespace, char **_string);
int extattr_string_to_namespace(const char *_string, int *_attrnamespace);
int flopen(const char *_path, int _flags, ...);
diff --git a/lib/libutil/login.conf.5 b/lib/libutil/login.conf.5
index d43fdfb761f3..27f37fb5fc30 100644
--- a/lib/libutil/login.conf.5
+++ b/lib/libutil/login.conf.5
@@ -380,14 +380,15 @@ If
is specified, then logins are only allowed during the periods given.
If
.Em times.deny
-is specified, then logins are denied during the periods given, regardless of whether
-one of the periods specified in
+is specified, then logins are denied during the periods given,
+regardless of whether one of the periods specified in
.Em times.allow
applies.
.Pp
Note that
.Xr login 1
-enforces only that the actual login falls within periods allowed by these entries.
+enforces only that the actual login falls within periods allowed by
+these entries.
Further enforcement over the life of a session requires a separate daemon to
monitor transitions from an allowed period to a non-allowed one.
.Pp
diff --git a/lib/libutil/login_auth.3 b/lib/libutil/login_auth.3
index fafe43b906e6..dd5ba3e01265 100644
--- a/lib/libutil/login_auth.3
+++ b/lib/libutil/login_auth.3
@@ -58,8 +58,8 @@
.\" .Ft int
.\" .Fn auth_timesok "login_cap_t *lc" "time_t now"
.Sh DESCRIPTION
-This set of functions support the login class authorisation style interface provided
-by
+This set of functions support the login class authorisation style
+interface provided by
.Xr login.conf 5 .
.\" .Sh RETURN VALUES
.Sh SEE ALSO
diff --git a/lib/libutil/login_cap.3 b/lib/libutil/login_cap.3
index 86142c3b19f9..48af0e3c9c46 100644
--- a/lib/libutil/login_cap.3
+++ b/lib/libutil/login_cap.3
@@ -31,6 +31,7 @@
.Nm login_getcaptime ,
.Nm login_getclass ,
.Nm login_getclassbyname ,
+.Nm login_getpath ,
.Nm login_getpwclass ,
.Nm login_getstyle ,
.Nm login_getuserclass ,
diff --git a/lib/libutil/mntopts.3 b/lib/libutil/mntopts.3
index 35f6d476fcec..28e5a02442c2 100644
--- a/lib/libutil/mntopts.3
+++ b/lib/libutil/mntopts.3
@@ -342,9 +342,9 @@ By default
.Va getmnt_silent
is zero.
.Sh SEE ALSO
+.Xr nmount 2 ,
.Xr err 3 ,
-.Xr mount 8 ,
-.Xr nmount 8
+.Xr mount 8
.Sh HISTORY
The
.Fn getmntopts
@@ -358,7 +358,7 @@ The
and
.Fn rmslashes
functions were added with
-.Xr nmount 8
+.Xr nmount 2
in
.Fx 5.0 .
The
@@ -368,7 +368,9 @@ and
functions were added in
.Fx 13.2 .
.Pp
-Historically, these functions were found in getmntopts.c in the sources for the
+Historically, these functions were found in
+.Pa getmntopts.c
+in the source code of the
.Xr mount 8
program.
As of
diff --git a/lib/libutil/tests/expand_number_test.c b/lib/libutil/tests/expand_number_test.c
index 8e7458994de4..9bd339298575 100644
--- a/lib/libutil/tests/expand_number_test.c
+++ b/lib/libutil/tests/expand_number_test.c
@@ -206,10 +206,89 @@ ATF_TC_BODY(expand_number__bad, tp)
require_error(" + 1", EINVAL);
}
+ATF_TC_WITHOUT_HEAD(expand_unsigned);
+ATF_TC_BODY(expand_unsigned, tp)
+{
+ static struct tc {
+ const char *str;
+ uint64_t num;
+ int error;
+ } tcs[] = {
+ { "0", 0, 0 },
+ { "+0", 0, 0 },
+ { "-0", 0, 0 },
+ { "1", 1, 0 },
+ { "+1", 1, 0 },
+ { "-1", 0, ERANGE },
+ { "18446744073709551615", UINT64_MAX, 0 },
+ { "+18446744073709551615", UINT64_MAX, 0 },
+ { "-18446744073709551615", 0, ERANGE },
+ { 0 },
+ };
+ struct tc *tc;
+ uint64_t num;
+ int error, ret;
+
+ for (tc = tcs; tc->str != NULL; tc++) {
+ ret = expand_number(tc->str, &num);
+ error = errno;
+ if (tc->error == 0) {
+ ATF_REQUIRE_EQ_MSG(0, ret,
+ "%s ret = %d", tc->str, ret);
+ ATF_REQUIRE_EQ_MSG(tc->num, num,
+ "%s num = %ju", tc->str, (uintmax_t)num);
+ } else {
+ ATF_REQUIRE_EQ_MSG(-1, ret,
+ "%s ret = %d", tc->str, ret);
+ ATF_REQUIRE_EQ_MSG(tc->error, error,
+ "%s errno = %d", tc->str, error);
+ }
+ }
+}
+
+ATF_TC_WITHOUT_HEAD(expand_generic);
+ATF_TC_BODY(expand_generic, tp)
+{
+ uint64_t uint64;
+ int64_t int64;
+#ifdef __LP64__
+ size_t size;
+#endif
+ off_t off;
+
+ ATF_REQUIRE_EQ(0, expand_number("18446744073709551615", &uint64));
+ ATF_REQUIRE_EQ(UINT64_MAX, uint64);
+ ATF_REQUIRE_EQ(-1, expand_number("-1", &uint64));
+ ATF_REQUIRE_EQ(ERANGE, errno);
+
+ ATF_REQUIRE_EQ(0, expand_number("9223372036854775807", &int64));
+ ATF_REQUIRE_EQ(INT64_MAX, int64);
+ ATF_REQUIRE_EQ(-1, expand_number("9223372036854775808", &int64));
+ ATF_REQUIRE_EQ(ERANGE, errno);
+ ATF_REQUIRE_EQ(0, expand_number("-9223372036854775808", &int64));
+ ATF_REQUIRE_EQ(INT64_MIN, int64);
+
+#ifdef __LP64__
+ ATF_REQUIRE_EQ(0, expand_number("18446744073709551615", &size));
+ ATF_REQUIRE_EQ(UINT64_MAX, size);
+ ATF_REQUIRE_EQ(-1, expand_number("-1", &size));
+ ATF_REQUIRE_EQ(ERANGE, errno);
+#endif
+
+ ATF_REQUIRE_EQ(0, expand_number("9223372036854775807", &off));
+ ATF_REQUIRE_EQ(INT64_MAX, off);
+ ATF_REQUIRE_EQ(-1, expand_number("9223372036854775808", &off));
+ ATF_REQUIRE_EQ(ERANGE, errno);
+ ATF_REQUIRE_EQ(0, expand_number("-9223372036854775808", &off));
+ ATF_REQUIRE_EQ(INT64_MIN, off);
+}
+
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, expand_number__ok);
ATF_TP_ADD_TC(tp, expand_number__bad);
+ ATF_TP_ADD_TC(tp, expand_unsigned);
+ ATF_TP_ADD_TC(tp, expand_generic);
return (atf_no_error());
}
diff --git a/lib/libutil/uucplock.3 b/lib/libutil/uucplock.3
index dd19d0311b4e..ee8c9f6bb995 100644
--- a/lib/libutil/uucplock.3
+++ b/lib/libutil/uucplock.3
@@ -28,6 +28,7 @@
.Os
.Sh NAME
.Nm uu_lock ,
+.Nm uu_lock_txfr ,
.Nm uu_unlock ,
.Nm uu_lockerr
.Nd acquire and release control of a serial device
diff --git a/lib/msun/bsdsrc/b_tgamma.c b/lib/msun/bsdsrc/b_tgamma.c
index 8369477c18b7..a7e97bc777c3 100644
--- a/lib/msun/bsdsrc/b_tgamma.c
+++ b/lib/msun/bsdsrc/b_tgamma.c
@@ -259,7 +259,7 @@ small_gam(double x)
static double
smaller_gam(double x)
{
- double d, rhi, rlo, t, xhi, xlo;
+ double d, t, xhi, xlo;
struct Double r;
if (x < x0 + left) {
diff --git a/lib/msun/src/e_fmod.c b/lib/msun/src/e_fmod.c
index 77afd116c658..ced9cce33aa0 100644
--- a/lib/msun/src/e_fmod.c
+++ b/lib/msun/src/e_fmod.c
@@ -26,14 +26,14 @@ static const double one = 1.0, Zero[] = {0.0, -0.0,};
double
fmod(double x, double y)
{
- int32_t n,hx,hy,hz,ix,iy,sx,i;
- u_int32_t lx,ly,lz;
+ int32_t hx, hy, hz, ix, iy, n, sx;
+ u_int32_t lx, ly, lz;
EXTRACT_WORDS(hx,lx,x);
EXTRACT_WORDS(hy,ly,y);
sx = hx&0x80000000; /* sign of x */
- hx ^=sx; /* |x| */
- hy &= 0x7fffffff; /* |y| */
+ hx ^= sx; /* |x| */
+ hy &= 0x7fffffff; /* |y| */
/* purge off exception values */
if((hy|ly)==0||(hx>=0x7ff00000)|| /* y=0,or x not finite */
@@ -46,22 +46,16 @@ fmod(double x, double y)
}
/* determine ix = ilogb(x) */
- if(hx<0x00100000) { /* subnormal x */
- if(hx==0) {
- for (ix = -1043, i=lx; i>0; i<<=1) ix -=1;
- } else {
- for (ix = -1022,i=(hx<<11); i>0; i<<=1) ix -=1;
- }
- } else ix = (hx>>20)-1023;
+ if(hx<0x00100000)
+ ix = subnormal_ilogb(hx, lx);
+ else
+ ix = (hx>>20)-1023;
/* determine iy = ilogb(y) */
- if(hy<0x00100000) { /* subnormal y */
- if(hy==0) {
- for (iy = -1043, i=ly; i>0; i<<=1) iy -=1;
- } else {
- for (iy = -1022,i=(hy<<11); i>0; i<<=1) iy -=1;
- }
- } else iy = (hy>>20)-1023;
+ if(hy<0x00100000)
+ iy = subnormal_ilogb(hy, ly);
+ else
+ iy = (hy>>20)-1023;
/* set up {hx,lx}, {hy,ly} and align y to x */
if(ix >= -1022)
diff --git a/lib/msun/src/e_fmodf.c b/lib/msun/src/e_fmodf.c
index a7d1a0c22acd..ada969db44c7 100644
--- a/lib/msun/src/e_fmodf.c
+++ b/lib/msun/src/e_fmodf.c
@@ -27,7 +27,7 @@ static const float one = 1.0, Zero[] = {0.0, -0.0,};
float
fmodf(float x, float y)
{
- int32_t n,hx,hy,hz,ix,iy,sx,i;
+ int32_t hx, hy, hz, ix, iy, n, sx;
GET_FLOAT_WORD(hx,x);
GET_FLOAT_WORD(hy,y);
@@ -44,14 +44,16 @@ fmodf(float x, float y)
return Zero[(u_int32_t)sx>>31]; /* |x|=|y| return x*0*/
/* determine ix = ilogb(x) */
- if(hx<0x00800000) { /* subnormal x */
- for (ix = -126,i=(hx<<8); i>0; i<<=1) ix -=1;
- } else ix = (hx>>23)-127;
+ if(hx<0x00800000)
+ ix = subnormal_ilogbf(hx);
+ else
+ ix = (hx>>23)-127;
/* determine iy = ilogb(y) */
- if(hy<0x00800000) { /* subnormal y */
- for (iy = -126,i=(hy<<8); i>=0; i<<=1) iy -=1;
- } else iy = (hy>>23)-127;
+ if(hy<0x00800000)
+ iy = subnormal_ilogbf(hy);
+ else
+ iy = (hy>>23)-127;
/* set up {hx,lx}, {hy,ly} and align y to x */
if(ix >= -126)
diff --git a/lib/msun/src/math_private.h b/lib/msun/src/math_private.h
index 1595f902846c..fbd84e246ca7 100644
--- a/lib/msun/src/math_private.h
+++ b/lib/msun/src/math_private.h
@@ -739,6 +739,41 @@ irintl(long double x)
(ar) = (x) - (ai); \
} while (0)
+/*
+ * For a subnormal double entity split into high and low parts, compute ilogb.
+ */
+static inline int32_t
+subnormal_ilogb(int32_t hi, int32_t lo)
+{
+ int32_t j;
+ uint32_t i;
+
+ j = -1022;
+ if (hi == 0) {
+ j -= 21;
+ i = (uint32_t)lo;
+ } else
+ i = (uint32_t)hi << 11;
+
+ for (; i < 0x7fffffff; i <<= 1) j -= 1;
+
+ return (j);
+}
+
+/*
+ * For a subnormal float entity represented as an int32_t, compute ilogb.
+ */
+static inline int32_t
+subnormal_ilogbf(int32_t hx)
+{
+ int32_t j;
+ uint32_t i;
+ i = (uint32_t) hx << 8;
+ for (j = -126; i < 0x7fffffff; i <<= 1) j -=1;
+
+ return (j);
+}
+
#ifdef DEBUG
#if defined(__amd64__) || defined(__i386__)
#define breakpoint() asm("int $3")
diff --git a/lib/msun/src/s_ccosh.c b/lib/msun/src/s_ccosh.c
index 3d46c993c6f1..14a8931742dc 100644
--- a/lib/msun/src/s_ccosh.c
+++ b/lib/msun/src/s_ccosh.c
@@ -1,7 +1,7 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl
+ * Copyright (c) 2005-2025 Bruce D. Evans and Steven G. Kargl
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -48,7 +48,7 @@ static const double huge = 0x1p1023;
double complex
ccosh(double complex z)
{
- double x, y, h;
+ double c, h, s, x, y;
int32_t hx, hy, ix, iy, lx, ly;
x = creal(z);
@@ -64,14 +64,16 @@ ccosh(double complex z)
if (ix < 0x7ff00000 && iy < 0x7ff00000) {
if ((iy | ly) == 0)
return (CMPLX(cosh(x), x * y));
+
+ sincos(y, &s, &c);
if (ix < 0x40360000) /* |x| < 22: normal case */
- return (CMPLX(cosh(x) * cos(y), sinh(x) * sin(y)));
+ return (CMPLX(cosh(x) * c, sinh(x) * s));
/* |x| >= 22, so cosh(x) ~= exp(|x|) */
if (ix < 0x40862e42) {
/* x < 710: exp(|x|) won't overflow */
- h = exp(fabs(x)) * 0.5;
- return (CMPLX(h * cos(y), copysign(h, x) * sin(y)));
+ h = exp(fabs(x)) / 2;
+ return (CMPLX(h * c, copysign(h, x) * s));
} else if (ix < 0x4096bbaa) {
/* x < 1455: scale to avoid overflow */
z = __ldexp_cexp(CMPLX(fabs(x), y), -1);
@@ -79,7 +81,7 @@ ccosh(double complex z)
} else {
/* x >= 1455: the result always overflows */
h = huge * x;
- return (CMPLX(h * h * cos(y), h * sin(y)));
+ return (CMPLX(h * h * c, h * s));
}
}
@@ -129,7 +131,9 @@ ccosh(double complex z)
if (ix == 0x7ff00000 && lx == 0) {
if (iy >= 0x7ff00000)
return (CMPLX(INFINITY, x * (y - y)));
- return (CMPLX(INFINITY * cos(y), x * sin(y)));
+
+ sincos(y, &s, &c);
+ return (CMPLX(INFINITY * c, x * s));
}
/*
@@ -154,3 +158,8 @@ ccos(double complex z)
/* ccos(z) = ccosh(I * z) */
return (ccosh(CMPLX(-cimag(z), creal(z))));
}
+
+#if (LDBL_MANT_DIG == 53)
+__weak_reference(ccosh, ccoshl);
+__weak_reference(ccos, ccosl);
+#endif
diff --git a/lib/msun/src/s_ccoshf.c b/lib/msun/src/s_ccoshf.c
index aeb2dec23677..fa41fdf4c4ea 100644
--- a/lib/msun/src/s_ccoshf.c
+++ b/lib/msun/src/s_ccoshf.c
@@ -1,7 +1,7 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl
+ * Copyright (c) 2005-2025 Bruce D. Evans and Steven G. Kargl
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -40,7 +40,7 @@ static const float huge = 0x1p127;
float complex
ccoshf(float complex z)
{
- float x, y, h;
+ float c, h, s, x, y;
int32_t hx, hy, ix, iy;
x = crealf(z);
@@ -55,14 +55,16 @@ ccoshf(float complex z)
if (ix < 0x7f800000 && iy < 0x7f800000) {
if (iy == 0)
return (CMPLXF(coshf(x), x * y));
+
+ sincosf(y, &s, &c);
if (ix < 0x41100000) /* |x| < 9: normal case */
- return (CMPLXF(coshf(x) * cosf(y), sinhf(x) * sinf(y)));
+ return (CMPLXF(coshf(x) * c, sinhf(x) * s));
/* |x| >= 9, so cosh(x) ~= exp(|x|) */
if (ix < 0x42b17218) {
/* x < 88.7: expf(|x|) won't overflow */
- h = expf(fabsf(x)) * 0.5F;
- return (CMPLXF(h * cosf(y), copysignf(h, x) * sinf(y)));
+ h = expf(fabsf(x)) / 2;
+ return (CMPLXF(h * c, copysignf(h, x) * s));
} else if (ix < 0x4340b1e7) {
/* x < 192.7: scale to avoid overflow */
z = __ldexp_cexpf(CMPLXF(fabsf(x), y), -1);
@@ -70,7 +72,7 @@ ccoshf(float complex z)
} else {
/* x >= 192.7: the result always overflows */
h = huge * x;
- return (CMPLXF(h * h * cosf(y), h * sinf(y)));
+ return (CMPLXF(h * h * c, h * s));
}
}
@@ -86,7 +88,9 @@ ccoshf(float complex z)
if (ix == 0x7f800000) {
if (iy >= 0x7f800000)
return (CMPLXF(INFINITY, x * (y - y)));
- return (CMPLXF(INFINITY * cosf(y), x * sinf(y)));
+
+ sincosf(y, &s, &c);
+ return (CMPLXF(INFINITY * c, x * s));
}
return (CMPLXF(((long double)x * x) * (y - y),
diff --git a/lib/msun/src/s_csinh.c b/lib/msun/src/s_csinh.c
index e7ed10e7d885..11c2ec345094 100644
--- a/lib/msun/src/s_csinh.c
+++ b/lib/msun/src/s_csinh.c
@@ -1,7 +1,7 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl
+ * Copyright (c) 2005-2025 Bruce D. Evans and Steven G. Kargl
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -48,7 +48,7 @@ static const double huge = 0x1p1023;
double complex
csinh(double complex z)
{
- double x, y, h;
+ double c, h, s, x, y;
int32_t hx, hy, ix, iy, lx, ly;
x = creal(z);
@@ -64,14 +64,16 @@ csinh(double complex z)
if (ix < 0x7ff00000 && iy < 0x7ff00000) {
if ((iy | ly) == 0)
return (CMPLX(sinh(x), y));
+
+ sincos(y, &s, &c);
if (ix < 0x40360000) /* |x| < 22: normal case */
- return (CMPLX(sinh(x) * cos(y), cosh(x) * sin(y)));
+ return (CMPLX(sinh(x) * c, cosh(x) * s));
/* |x| >= 22, so cosh(x) ~= exp(|x|) */
if (ix < 0x40862e42) {
/* x < 710: exp(|x|) won't overflow */
- h = exp(fabs(x)) * 0.5;
- return (CMPLX(copysign(h, x) * cos(y), h * sin(y)));
+ h = exp(fabs(x)) / 2;
+ return (CMPLX(copysign(h, x) * c, h * s));
} else if (ix < 0x4096bbaa) {
/* x < 1455: scale to avoid overflow */
z = __ldexp_cexp(CMPLX(fabs(x), y), -1);
@@ -79,7 +81,7 @@ csinh(double complex z)
} else {
/* x >= 1455: the result always overflows */
h = huge * x;
- return (CMPLX(h * cos(y), h * h * sin(y)));
+ return (CMPLX(h * c, h * h * s));
}
}
@@ -128,7 +130,9 @@ csinh(double complex z)
if (ix == 0x7ff00000 && lx == 0) {
if (iy >= 0x7ff00000)
return (CMPLX(x, y - y));
- return (CMPLX(x * cos(y), INFINITY * sin(y)));
+
+ sincos(y, &s, &c);
+ return (CMPLX(x * c, INFINITY * s));
}
/*
@@ -154,3 +158,8 @@ csin(double complex z)
z = csinh(CMPLX(cimag(z), creal(z)));
return (CMPLX(cimag(z), creal(z)));
}
+
+#if (LDBL_MANT_DIG == 53)
+__weak_reference(csinh, csinhl);
+__weak_reference(csin, csinl);
+#endif
diff --git a/lib/msun/src/s_csinhf.c b/lib/msun/src/s_csinhf.c
index c4392755c482..fcfc011a2484 100644
--- a/lib/msun/src/s_csinhf.c
+++ b/lib/msun/src/s_csinhf.c
@@ -1,7 +1,7 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl
+ * Copyright (c) 2005-2025 Bruce D. Evans and Steven G. Kargl
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -40,7 +40,7 @@ static const float huge = 0x1p127;
float complex
csinhf(float complex z)
{
- float x, y, h;
+ float c, h, s, x, y;
int32_t hx, hy, ix, iy;
x = crealf(z);
@@ -55,14 +55,16 @@ csinhf(float complex z)
if (ix < 0x7f800000 && iy < 0x7f800000) {
if (iy == 0)
return (CMPLXF(sinhf(x), y));
+
+ sincosf(y, &s, &c);
if (ix < 0x41100000) /* |x| < 9: normal case */
- return (CMPLXF(sinhf(x) * cosf(y), coshf(x) * sinf(y)));
+ return (CMPLXF(sinhf(x) * c, coshf(x) * s));
/* |x| >= 9, so cosh(x) ~= exp(|x|) */
if (ix < 0x42b17218) {
/* x < 88.7: expf(|x|) won't overflow */
- h = expf(fabsf(x)) * 0.5F;
- return (CMPLXF(copysignf(h, x) * cosf(y), h * sinf(y)));
+ h = expf(fabsf(x)) / 2;
+ return (CMPLXF(copysignf(h, x) * c, h * s));
} else if (ix < 0x4340b1e7) {
/* x < 192.7: scale to avoid overflow */
z = __ldexp_cexpf(CMPLXF(fabsf(x), y), -1);
@@ -70,7 +72,7 @@ csinhf(float complex z)
} else {
/* x >= 192.7: the result always overflows */
h = huge * x;
- return (CMPLXF(h * cosf(y), h * h * sinf(y)));
+ return (CMPLXF(h * c, h * h * s));
}
}
@@ -86,7 +88,9 @@ csinhf(float complex z)
if (ix == 0x7f800000) {
if (iy >= 0x7f800000)
return (CMPLXF(x, y - y));
- return (CMPLXF(x * cosf(y), INFINITY * sinf(y)));
+
+ sincosf(y, &s, &c);
+ return (CMPLXF(x * c, INFINITY * s));
}
return (CMPLXF(((long double)x + x) * (y - y),
diff --git a/lib/msun/src/s_ilogb.c b/lib/msun/src/s_ilogb.c
index 27e0bbb8735b..aa707d51d7b7 100644
--- a/lib/msun/src/s_ilogb.c
+++ b/lib/msun/src/s_ilogb.c
@@ -21,21 +21,18 @@
#include "math.h"
#include "math_private.h"
- int ilogb(double x)
+int
+ilogb(double x)
{
- int32_t hx,lx,ix;
+ int32_t hx, ix, lx;
EXTRACT_WORDS(hx,lx,x);
hx &= 0x7fffffff;
if(hx<0x00100000) {
if((hx|lx)==0)
return FP_ILOGB0;
- else /* subnormal x */
- if(hx==0) {
- for (ix = -1043; lx>0; lx<<=1) ix -=1;
- } else {
- for (ix = -1022,hx<<=11; hx>0; hx<<=1) ix -=1;
- }
+ else
+ ix = subnormal_ilogb(hx, lx);
return ix;
}
else if (hx<0x7ff00000) return (hx>>20)-1023;
diff --git a/lib/msun/src/s_ilogbf.c b/lib/msun/src/s_ilogbf.c
index e0f8fee26ac8..5195e2331af3 100644
--- a/lib/msun/src/s_ilogbf.c
+++ b/lib/msun/src/s_ilogbf.c
@@ -18,7 +18,8 @@
#include "math.h"
#include "math_private.h"
- int ilogbf(float x)
+int
+ilogbf(float x)
{
int32_t hx,ix;
@@ -28,7 +29,7 @@
if(hx==0)
return FP_ILOGB0;
else /* subnormal x */
- for (ix = -126,hx<<=8; hx>0; hx<<=1) ix -=1;
+ ix = subnormal_ilogbf(hx);
return ix;
}
else if (hx<0x7f800000) return (hx>>23)-127;
diff --git a/lib/msun/src/s_remquo.c b/lib/msun/src/s_remquo.c
index 206d2903cd86..b26b5619f3ad 100644
--- a/lib/msun/src/s_remquo.c
+++ b/lib/msun/src/s_remquo.c
@@ -4,7 +4,7 @@
*
* Developed at SunSoft, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
@@ -27,7 +27,7 @@ static const double Zero[] = {0.0, -0.0,};
double
remquo(double x, double y, int *quo)
{
- int32_t n,hx,hy,hz,ix,iy,sx,i;
+ int32_t hx,hy,hz,ix,iy,n,sx;
u_int32_t lx,ly,lz,q,sxy;
EXTRACT_WORDS(hx,lx,x);
@@ -53,25 +53,19 @@ remquo(double x, double y, int *quo)
}
/* determine ix = ilogb(x) */
- if(hx<0x00100000) { /* subnormal x */
- if(hx==0) {
- for (ix = -1043, i=lx; i>0; i<<=1) ix -=1;
- } else {
- for (ix = -1022,i=(hx<<11); i>0; i<<=1) ix -=1;
- }
- } else ix = (hx>>20)-1023;
+ if(hx<0x00100000)
+ ix = subnormal_ilogb(hx, lx);
+ else
+ ix = (hx>>20)-1023;
/* determine iy = ilogb(y) */
- if(hy<0x00100000) { /* subnormal y */
- if(hy==0) {
- for (iy = -1043, i=ly; i>0; i<<=1) iy -=1;
- } else {
- for (iy = -1022,i=(hy<<11); i>0; i<<=1) iy -=1;
- }
- } else iy = (hy>>20)-1023;
+ if(hy<0x00100000)
+ iy = subnormal_ilogb(hy, ly);
+ else
+ iy = (hy>>20)-1023;
/* set up {hx,lx}, {hy,ly} and align y to x */
- if(ix >= -1022)
+ if(ix >= -1022)
hx = 0x00100000|(0x000fffff&hx);
else { /* subnormal x, shift x to normal */
n = -1022-ix;
@@ -83,7 +77,7 @@ remquo(double x, double y, int *quo)
lx = 0;
}
}
- if(iy >= -1022)
+ if(iy >= -1022)
hy = 0x00100000|(0x000fffff&hy);
else { /* subnormal y, shift y to normal */
n = -1022-iy;
diff --git a/lib/msun/src/s_remquof.c b/lib/msun/src/s_remquof.c
index 9cd148586796..e4adb8321559 100644
--- a/lib/msun/src/s_remquof.c
+++ b/lib/msun/src/s_remquof.c
@@ -25,7 +25,7 @@ static const float Zero[] = {0.0, -0.0,};
float
remquof(float x, float y, int *quo)
{
- int32_t n,hx,hy,hz,ix,iy,sx,i;
+ int32_t hx, hy, hz, ix, iy, n, sx;
u_int32_t q,sxy;
GET_FLOAT_WORD(hx,x);
@@ -47,14 +47,16 @@ remquof(float x, float y, int *quo)
}
/* determine ix = ilogb(x) */
- if(hx<0x00800000) { /* subnormal x */
- for (ix = -126,i=(hx<<8); i>0; i<<=1) ix -=1;
- } else ix = (hx>>23)-127;
+ if(hx<0x00800000)
+ ix = subnormal_ilogbf(hx);
+ else
+ ix = (hx>>23)-127;
/* determine iy = ilogb(y) */
- if(hy<0x00800000) { /* subnormal y */
- for (iy = -126,i=(hy<<8); i>0; i<<=1) iy -=1;
- } else iy = (hy>>23)-127;
+ if(hy<0x00800000)
+ iy = subnormal_ilogbf(hy);
+ else
+ iy = (hy>>23)-127;
/* set up {hx,lx}, {hy,ly} and align y to x */
if(ix >= -126)