Subject: Re: mmap and fsync
To: Nick Hudson <skrll@netbsd.org>
From: Chuck Silvers <chuq@chuq.com>
List: tech-kern
Date: 03/28/2001 09:54:34
yes, netbsd 1.5 will fail this test.  this has been fixed in -current
with the integration of the UBC work.

-Chuck


On Wed, Mar 28, 2001 at 06:03:52PM +0100, Nick Hudson wrote:
> The program below is taken from a configure script and "fails". Is this
> correct?
> 
> #include <sys/types.h>
> #include <sys/mman.h>
> #include <fcntl.h>
>  
> main() {
>  
>         char *base;
>  
>         int fd = open("conftestmmap", O_RDWR|O_CREAT|O_TRUNC, 0666);
>         if (fd == -1) exit(1);
>         if (write(fd, "test", 4) != 4) exit(1);
>         fsync(fd);
>  
>         base = mmap((caddr_t)0, 100, PROT_READ, MAP_SHARED | MAP_FILE ,
> fd, 0L);
>  
>         if (base == (caddr_t)-1) exit(1);
>         if (strncmp(base, "test", 4) != 0) exit(1);
>         if (write(fd, "test", 4) != 4) exit(1);
>  
>         fsync(fd);
>         if (strncmp(base+4, "test", 4) != 0) exit(1);
>         exit(0);
> }
> 
> 
> $ uname -a
> NetBSD go61923 1.5 NetBSD 1.5 (GO61923) #0: Tue Nov 21 16:17:23 GMT
> 2000    
> nick@kenny:/dsk/NetBSD/NetBSD-1.5/src/sys/arch/i386/compile/GO61923 i386
> 
> Nick
> -- 
> aka skrll@netbsd.org, skrll@excite.co.uk