Module Name:    src
Committed By:   christos
Date:           Sat Mar  1 16:34:03 UTC 2025

Modified Files:
        src/lib/libc/gen: pthread_atfork.c

Log Message:
Revert for now. There has been a report that arc4random breaks with it,
and the tests for arc4random set RLIMIT_AS to 0 so that mmap fails.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/gen/pthread_atfork.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gen/pthread_atfork.c
diff -u src/lib/libc/gen/pthread_atfork.c:1.20 src/lib/libc/gen/pthread_atfork.c:1.21
--- src/lib/libc/gen/pthread_atfork.c:1.20	Fri Feb 28 18:59:55 2025
+++ src/lib/libc/gen/pthread_atfork.c	Sat Mar  1 11:34:03 2025
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_atfork.c,v 1.20 2025/02/28 23:59:55 kre Exp $	*/
+/*	$NetBSD: pthread_atfork.c,v 1.21 2025/03/01 16:34:03 christos Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -31,17 +31,15 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: pthread_atfork.c,v 1.20 2025/02/28 23:59:55 kre Exp $");
+__RCSID("$NetBSD: pthread_atfork.c,v 1.21 2025/03/01 16:34:03 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
 
-#include <sys/queue.h>
-#include <sys/mman.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <unistd.h>
-
+#include <sys/queue.h>
 #include "extern.h"
 #include "reentrant.h"
 
@@ -80,14 +78,11 @@ static struct atfork_callback_q childq =
 static struct atfork_callback *
 af_alloc(void)
 {
-	void *rv;
 
 	if (atfork_builtin.fn == NULL)
 		return &atfork_builtin;
 
-	rv = mmap(0, sizeof(atfork_builtin), PROT_READ|PROT_WRITE,
-	    MAP_PRIVATE | MAP_ANON, -1, 0);
-	return rv == MAP_FAILED ? NULL : rv;
+	return malloc(sizeof(atfork_builtin));
 }
 
 static void
@@ -95,7 +90,7 @@ af_free(struct atfork_callback *af)
 {
 
 	if (af != &atfork_builtin)
-		munmap(af, sizeof(*af));
+		free(af);
 }
 
 int

Reply via email to