CVS commit: [netbsd-10] src

"Martin Husemann" <[email protected]>
Newsgroups gmane.os.netbsd.devel.cvs
Message-ID <[email protected]>
Module Name:	src
Committed By:	martin
Date:		Sat Jun 27 19:13:13 UTC 2026

Modified Files:
	src/distrib/sets/lists/base [netbsd-10]: shl.mi
	src/distrib/sets/lists/comp [netbsd-10]: mi
	src/distrib/sets/lists/debug [netbsd-10]: shl.mi
	src/lib/libbsdmalloc [netbsd-10]: Makefile malloc.c shlib_version
	src/tests/lib/libc/stdlib [netbsd-10]: t_posix_memalign.c
Added Files:
	src/lib/libbsdmalloc [netbsd-10]: bsdmalloc.3

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1286):

	lib/libbsdmalloc/bsdmalloc.3: revision 1.1
	lib/libbsdmalloc/bsdmalloc.3: revision 1.2
	lib/libbsdmalloc/bsdmalloc.3: revision 1.3
	distrib/sets/lists/base/shl.mi: revision 1.952
	tests/lib/libc/stdlib/t_posix_memalign.c: revision 1.8
	lib/libbsdmalloc/malloc.c: revision 1.3
	lib/libbsdmalloc/malloc.c: revision 1.4
	lib/libbsdmalloc/malloc.c: revision 1.5
	lib/libbsdmalloc/malloc.c: revision 1.10
	lib/libbsdmalloc/malloc.c: revision 1.6
	lib/libbsdmalloc/malloc.c: revision 1.11
	lib/libbsdmalloc/malloc.c: revision 1.7
	lib/libbsdmalloc/malloc.c: revision 1.8
	lib/libbsdmalloc/malloc.c: revision 1.9
	lib/libbsdmalloc/shlib_version: revision 1.2
	distrib/sets/lists/debug/shl.mi: revision 1.313
	distrib/sets/lists/comp/mi: revision 1.2434
	lib/libbsdmalloc/Makefile: revision 1.5
	lib/libbsdmalloc/Makefile: revision 1.6
	lib/libbsdmalloc/Makefile: revision 1.7
	(all via patch)

libbsdmalloc: Provide all allocator front ends and fork hooks.

Front ends:
- aligned_alloc
- calloc
- posix_memalign

Fork hooks:
- _malloc_prefork
- _malloc_postfork
- _malloc_postfork_child

Otherwise these will pull in the jemalloc definitions from libc,
which (a) defeats the purpose, and (b) won't work correctly with
fork and threads.

Thanks to kre@ and the thread on tech-userlevel for pointing me in
the right direction to making this actually work to override
jemalloc:
https://mail-index.netbsd.org/tech-userlevel/2023/06/30/msg013957.html

Note: libbsdmalloc doesn't set errno=ENOMEM on malloc failure, but
these front ends do (even aligned_alloc, which is from C11, which
doesn't define ENOMEM at all, but this pacifies our aligned_alloc
tests in t_posix_memalign.c).  Might want to fix that.

libbsdmalloc: Nix trailing whitespace.
No functional change intended.

libbsdmalloc: Bump shlib minor.
New symbols, new minor.

libbsdmalloc: New man page.

libbsdmalloc: Nix K&R definitions.  Bump WARNS to 3.

libbsdmalloc: Fix build with DEBUG.
Nix __P while here.

bsdmalloc.3: fix typos in function parameters
libbsdmalloc: Lift C11 divisibility restriction on aligned_alloc.
Restriction was lifted in C17.

libbsdmalloc: Make aligned_alloc(A, S) actually align when A > S.

t_posix_memalign: Simplify.
No functional change intended.

libbsdmalloc: Use a multiply-overflow that clang supports too.

bsdmalloc(3): fix malloc() signature

Make mstats() decl match prototype so this compiles with -DMSTATS.

libbsdmalloc: Fix sense of assertion in aligned_alloc.


To generate a diff of this commit:
cvs rdiff -u -r1.942.2.18 -r1.942.2.19 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.2425.2.13 -r1.2425.2.14 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.298.2.20 -r1.298.2.21 src/distrib/sets/lists/debug/shl.mi
cvs rdiff -u -r1.4 -r1.4.42.1 src/lib/libbsdmalloc/Makefile
cvs rdiff -u -r0 -r1.3.6.2 src/lib/libbsdmalloc/bsdmalloc.3
cvs rdiff -u -r1.2.106.1 -r1.2.106.2 src/lib/libbsdmalloc/malloc.c
cvs rdiff -u -r1.1 -r1.1.106.1 src/lib/libbsdmalloc/shlib_version
cvs rdiff -u -r1.5.10.1 -r1.5.10.2 \
    src/tests/lib/libc/stdlib/t_posix_memalign.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.