Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/sys mremap(2): Fix example to use MAP_PRIVATE.



details:   https://anonhg.NetBSD.org/src/rev/a53279dbee7b
branches:  trunk
changeset: 373805:a53279dbee7b
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Mar 01 20:08:41 2023 +0000

description:
mremap(2): Fix example to use MAP_PRIVATE.

It is a historical accident that MAP_PRIVATE is assumed when neither
it nor MAP_SHARED is specified.

XXX pullup-9
XXX pullup-10

diffstat:

 lib/libc/sys/mremap.2 |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r 7618a46d771a -r a53279dbee7b lib/libc/sys/mremap.2
--- a/lib/libc/sys/mremap.2     Wed Mar 01 16:21:26 2023 +0000
+++ b/lib/libc/sys/mremap.2     Wed Mar 01 20:08:41 2023 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: mremap.2,v 1.7 2018/05/03 05:09:48 wiz Exp $
+.\"    $NetBSD: mremap.2,v 1.8 2023/03/01 20:08:41 riastradh Exp $
 .\"
 .\" Copyright (c) 2007 Thomas Klausner and Joerg Sonnenberger
 .\" All rights reserved.
@@ -137,7 +137,7 @@
        // protections only
        maprw = mmap(NULL, page,
            PROT_MPROTECT(PROT_EXEC|PROT_WRITE|PROT_READ),
-            MAP_ANON, -1, 0);
+            MAP_ANON|MAP_PRIVATE, -1, 0);
        if (maprw == MAP_FAILED)
                err(EXIT_FAILURE, "mmap failed");
 



Home | Main Index | Thread Index | Old Index