public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Concerning a post that you made about expandable anonymous shared mappings
@ 2007-06-29 19:52 William Tambe
  2007-07-02 15:33 ` Hugh Dickins
  0 siblings, 1 reply; 12+ messages in thread
From: William Tambe @ 2007-06-29 19:52 UTC (permalink / raw)
  To: linux-kernel

I read a post that you made about not being able to expand anonymous 
shared mapping with mremap(). And I am actually having that issue now.

You made the post in 2004 and we are now in 2007. I would like to know 
if that feature was added because the code below always fail with bus 
error on my machine. I use glibc 2.5

Thank you for helping.

#define _GNU_SOURCE
#include <sys/mman.h>
#include <unistd.h>

#include <stdio.h>

main() {
         void *ptr;
         if ((ptr=mmap(0, 4096, PROT_READ|PROT_WRITE,
                 MAP_ANONYMOUS|MAP_SHARED|MAP_GROWSDOWN, 0, 0)) == -1) {
                 printf("failed to mmap\n");
                 return;
         }

         if ((ptr=mremap(ptr, 4096, 8192, MREMAP_MAYMOVE)) == -1) {
                 printf("failed to mremap\n");
                 return;
         }

         //why does this failed. I am well in the interval [4096, 8192]
         *(unsigned int *)(ptr + 4096 + 8)= 10;
}

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2007-07-12  6:39 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-29 19:52 Concerning a post that you made about expandable anonymous shared mappings William Tambe
2007-07-02 15:33 ` Hugh Dickins
2007-07-02 17:35   ` William Tambe
2007-07-02 18:21     ` Stas Sergeev
2007-07-02 18:10   ` Stas Sergeev
2007-07-03 15:48     ` Hugh Dickins
2007-07-03 18:29       ` Stas Sergeev
2007-07-10  1:50       ` William Tambe
2007-07-10 20:10         ` Hugh Dickins
2007-07-10 20:55           ` William Tambe
2007-07-11  4:12             ` Stas Sergeev
2007-07-12  6:35               ` William Tambe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox