Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Apr 2006 16:43:04 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Wojciech Puchar <wojtek@tensor.3miasto.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: programmer questions - MMAP
Message-ID:  <20060405214304.GG32089@dan.emsphone.com>
In-Reply-To: <20060405231726.W81334@chylonia.3miasto.net>
References:  <20060405231726.W81334@chylonia.3miasto.net>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Apr 05), Wojciech Puchar said:
> the question is - why character 'a' isn't written!??!?!
> 
> #include <sys/mman.h>
> #include <fcntl.h>
> #include <stdio.h>
> #include <unistd.h>
> main() {
>  int ff=open("test",O_RDWR|O_CREAT,0666);
>  char *adr;
>  lseek(ff,1<<24,0);
>  write(ff,"",1);
>  adr=mmap(0,1<<24,PROT_READ|PROT_WRITE,MAP_NOCORE,ff,0);

Try MAP_NOCORE|MAP_SHARED here. It's probably defaulting to a private
mapping.

-- 
	Dan Nelson
	dnelson@allantgroup.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060405214304.GG32089>