From e1e8eb89cfa75c5c887a549a6ff37606a00692e7 Mon Sep 17 00:00:00 2001 From: schwarze <> Date: Sat, 24 May 2025 12:47:11 +0000 Subject: explain more precisely how to initialize malloc_options; OK deraadt@ --- src/lib/libc/stdlib/malloc.3 | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/lib/libc/stdlib') diff --git a/src/lib/libc/stdlib/malloc.3 b/src/lib/libc/stdlib/malloc.3 index b0c6fb782b..361fbe4d1d 100644 --- a/src/lib/libc/stdlib/malloc.3 +++ b/src/lib/libc/stdlib/malloc.3 @@ -30,9 +30,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $OpenBSD: malloc.3,v 1.143 2025/05/23 00:40:05 deraadt Exp $ +.\" $OpenBSD: malloc.3,v 1.144 2025/05/24 12:47:11 schwarze Exp $ .\" -.Dd $Mdocdate: May 23 2025 $ +.Dd $Mdocdate: May 24 2025 $ .Dt MALLOC 3 .Os .Sh NAME @@ -266,10 +266,18 @@ value of the .Xr sysctl 2 , next checks the environment for a variable called .Ev MALLOC_OPTIONS , -and finally looks at the pre-initialized global variable +and finally looks at the global variable .Va malloc_options in the program. -Each is scanned for the flags documented below. +Since +.Fn malloc +might already get called before the beginning of +.Fn main , +either initialize +.Va malloc_options +to a string literal at file scope or do not declare it at all. +.Pp +Each of the three strings is scanned for the flags documented below. Unless otherwise noted uppercase means on, lowercase means off. During initialization, flags occurring later modify the behaviour that was requested by flags processed earlier. -- cgit v1.2.3-55-g6feb