summaryrefslogtreecommitdiff
path: root/open_issues/mmap_write-only.mdwn
diff options
context:
space:
mode:
Diffstat (limited to 'open_issues/mmap_write-only.mdwn')
-rw-r--r--open_issues/mmap_write-only.mdwn56
1 files changed, 56 insertions, 0 deletions
diff --git a/open_issues/mmap_write-only.mdwn b/open_issues/mmap_write-only.mdwn
new file mode 100644
index 00000000..467274c5
--- /dev/null
+++ b/open_issues/mmap_write-only.mdwn
@@ -0,0 +1,56 @@
+[[!meta copyright="Copyright © 2011, 2012 Free Software Foundation, Inc."]]
+
+[[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable
+id="license" text="Permission is granted to copy, distribute and/or modify this
+document under the terms of the GNU Free Documentation License, Version 1.2 or
+any later version published by the Free Software Foundation; with no Invariant
+Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license
+is included in the section entitled [[GNU Free Documentation
+License|/fdl]]."]]"""]]
+
+[[!tag open_issue_glibc]]
+
+# IRC, freenode, #hurd, 2011-12-14
+
+ <pinotree> hm, interesting mmap bug
+ <youpi> ?
+ <pinotree> youpi: http://paste.debian.net/149252/
+ #include <sys/types.h>
+ #include <sys/mman.h>
+ #include <fcntl.h>
+ #include <stdio.h>
+ #include <errno.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <unistd.h>
+
+ void die(int x, const char *s)
+ {
+ perror(s);
+ exit(x);
+ }
+
+ static const char s_file[] = "foo-mmaptest";
+
+ int main()
+ {
+ int fd;
+ void *p;
+
+ fd = creat(s_file, 0777);
+ if (fd < 0) die(1, "creat");
+ errno = 0;
+ p = mmap(NULL, 1, PROT_READ, MAP_SHARED, fd, 0);
+ printf("> %p vs %p, %d (%s)\n", p, MAP_FAILED, errno, strerror(errno));
+ unlink(s_file);
+ return (p != MAP_FAILED);
+ }
+ <pinotree> on linux it returns 0 and fails with EACCESS (as it seems it
+ should, by reading the mmap posix docs), on hurd it returns 1 and the
+ mmap succeeds
+ <pinotree> (taken from llvm's configure)
+ <youpi> why should it? file size extension ?
+ <pinotree> creat creates a o_wronly file, while the mmap specifies only
+ read protection
+ <youpi> oh, craet is always wo
+ <youpi> I didn't know that