Source-Changes-HG archive

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

[src/trunk]: src/tests Add a comment for the workaround in trigger_bus()



details:   https://anonhg.NetBSD.org/src/rev/85d618bb01a3
branches:  trunk
changeset: 319453:85d618bb01a3
user:      kamil <kamil%NetBSD.org@localhost>
date:      Wed May 30 17:48:13 2018 +0000

description:
Add a comment for the workaround in trigger_bus()

Explain PROT_READ|PROT_WRITE.

diffstat:

 tests/kernel/h_segv.c              |  11 ++++++++---
 tests/lib/libc/sys/t_ptrace_wait.h |   9 +++++++--
 2 files changed, 15 insertions(+), 5 deletions(-)

diffs (55 lines):

diff -r 8a7886f27f39 -r 85d618bb01a3 tests/kernel/h_segv.c
--- a/tests/kernel/h_segv.c     Wed May 30 17:31:34 2018 +0000
+++ b/tests/kernel/h_segv.c     Wed May 30 17:48:13 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: h_segv.c,v 1.6 2018/05/30 17:31:34 kamil Exp $ */
+/*     $NetBSD: h_segv.c,v 1.7 2018/05/30 17:48:13 kamil Exp $ */
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: h_segv.c,v 1.6 2018/05/30 17:31:34 kamil Exp $");
+__RCSID("$NetBSD: h_segv.c,v 1.7 2018/05/30 17:48:13 kamil Exp $");
 
 #include <sys/types.h>
 #include <sys/mman.h>
@@ -119,7 +119,12 @@
        if (fp == NULL)
                err(EXIT_FAILURE, "tmpfile");
 
-       /* Map an empty file with mmap(2) to a pointer. */
+       /*
+        * Map an empty file with mmap(2) to a pointer.
+        *
+        * PROT_READ handles read-modify-write sequences emitted for
+        * certain combinations of CPUs and compilers (e.g. Alpha AXP).
+        */
        p = mmap(0, 1, PROT_READ|PROT_WRITE, MAP_PRIVATE, fileno(fp), 0);
        if (p == MAP_FAILED)
                err(EXIT_FAILURE, "mmap");
diff -r 8a7886f27f39 -r 85d618bb01a3 tests/lib/libc/sys/t_ptrace_wait.h
--- a/tests/lib/libc/sys/t_ptrace_wait.h        Wed May 30 17:31:34 2018 +0000
+++ b/tests/lib/libc/sys/t_ptrace_wait.h        Wed May 30 17:48:13 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_ptrace_wait.h,v 1.10 2018/05/30 17:31:34 kamil Exp $ */
+/*     $NetBSD: t_ptrace_wait.h,v 1.11 2018/05/30 17:48:13 kamil Exp $ */
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -574,7 +574,12 @@
        fp = tmpfile();
        FORKEE_ASSERT_NEQ((uintptr_t)fp, (uintptr_t)NULL);
 
-       /* Map an empty file with mmap(2) to a pointer. */
+       /*
+        * Map an empty file with mmap(2) to a pointer.
+        *
+        * PROT_READ handles read-modify-write sequences emitted for
+        * certain combinations of CPUs and compilers (e.g. Alpha AXP).
+        */
        p = mmap(0, 1, PROT_READ|PROT_WRITE, MAP_PRIVATE, fileno(fp), 0);
        FORKEE_ASSERT_NEQ((uintptr_t)p, (uintptr_t)MAP_FAILED);
 



Home | Main Index | Thread Index | Old Index