Previously in the non-circular memory map call, a private mapping was created
and then this private mapping was then remapped as a shared mapping.  This
doesn't work on sparc architecture port of Linux, and in general isn't
necessary.

Signed-off-by: Steven Dake <[email protected]>
---
 exec/coroipcs.c |   18 ++++--------------
 lib/coroipcc.c  |   17 ++++-------------
 2 files changed, 8 insertions(+), 27 deletions(-)

diff --git a/exec/coroipcs.c b/exec/coroipcs.c
index a58c269..bc24b22 100644
--- a/exec/coroipcs.c
+++ b/exec/coroipcs.c
@@ -229,7 +229,6 @@ memory_map (
        void **buf)
 {
        int32_t fd;
-       void *addr_orig;
        void *addr;
        int32_t res;
 
@@ -246,18 +245,9 @@ memory_map (
                goto error_close_unlink;
        }
 
-       addr_orig = mmap (NULL, bytes, PROT_NONE,
-               MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
-
-       if (addr_orig == MAP_FAILED) {
-               goto error_close_unlink;
-       }
-
-       addr = mmap (addr_orig, bytes, PROT_READ | PROT_WRITE,
-               MAP_FIXED | MAP_SHARED, fd, 0);
-
-       if (addr != addr_orig) {
-               munmap(addr_orig, bytes);
+       addr = mmap (NULL, bytes, PROT_READ | PROT_WRITE,
+               MAP_SHARED, fd, 0);
+       if (addr == MAP_FAILED) {
                goto error_close_unlink;
        }
 #ifdef COROSYNC_BSD
@@ -268,7 +258,7 @@ memory_map (
        if (res) {
                return (-1);
        }
-       *buf = addr_orig;
+       *buf = addr;
        return (0);
 
 error_close_unlink:
diff --git a/lib/coroipcc.c b/lib/coroipcc.c
index 34db980..f963f0c 100644
--- a/lib/coroipcc.c
+++ b/lib/coroipcc.c
@@ -391,7 +391,6 @@ static int
 memory_map (char *path, const char *file, void **buf, size_t bytes)
 {
        int32_t fd;
-       void *addr_orig;
        void *addr;
        int32_t res;
        char *buffer;
@@ -433,17 +432,9 @@ retry_write:
        }
        free (buffer);
 
-       addr_orig = mmap (NULL, bytes, PROT_NONE,
-               MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
-
-       if (addr_orig == MAP_FAILED) {
-               goto error_close_unlink;
-       }
-
-       addr = mmap (addr_orig, bytes, PROT_READ | PROT_WRITE,
-               MAP_FIXED | MAP_SHARED, fd, 0);
-
-       if (addr != addr_orig) {
+       addr = mmap (NULL, bytes, PROT_READ | PROT_WRITE,
+               MAP_SHARED, fd, 0);
+       if (addr == MAP_FAILED) {
                goto error_close_unlink;
        }
 #ifdef COROSYNC_BSD
@@ -454,7 +445,7 @@ retry_write:
        if (res) {
                return (-1);
        }
-       *buf = addr_orig;
+       *buf = addr;
 
        return 0;
 
-- 
1.7.4.4

_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to