My application uses mmap on a 16MB file. On released 1.7.7, there's no
problem. But with the 20100919 snapshot, it crashes when it tries to
access the mmap space past the first 32KB or so. Attached is a simple
test program that illustrates the problem.
***** With 1.7.7 *****
$ uname -a
CYGWIN_NT-6.1-WOW64 hkehoe1 1.7.7(0.230/5/3) 2010-08-31 09:58 i686 Cygwin
$ ./a
creating mmap-test-file
Writing zeros
mmap-ing
writing ones to mmap region
done!
$ ls -l mmap*
-rw-r--r--+ 1 hkehoe Domain Users 16777216 2010-09-20 14:51 mmap-test-file
$ od -tc mmap-test-file
0000000 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001
*
100000000
***** With snapshot *****
$ uname -a
CYGWIN_NT-6.1-WOW64 hkehoe1 1.7.8s(0.231/5/3) 20100919 16:19:37 i686 Cygwin
$ ./a
creating mmap-test-file
Writing zeros
mmap-ing
writing ones to mmap region
Segmentation fault (core dumped)
$ od -tc mmap-test-file
0000000 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001
*
0100000 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
*
100000000
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <fcntl.h>
#include <sys/mman.h>
#define MMAP_FILE "mmap-test-file"
#define MMAP_SIZE 16384*1024
main()
{
int fd;
char* maddr;
printf("creating " MMAP_FILE "\n");
fd = open(MMAP_FILE, O_CREAT|O_TRUNC|O_RDWR, 0666);
if(fd < 0)
{
perror("Could not open " MMAP_FILE);
exit(1);
}
printf("Writing zeros\n");
{
int n = MMAP_SIZE;
char buf[1024];
memset(buf, 0, 1024);
while(n > 0)
{
write(fd, buf, 1024);
n -= 1024;
}
}
printf("mmap-ing\n");
maddr = mmap(NULL, MMAP_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
if(maddr == NULL || maddr == MAP_FAILED)
{
perror("mmap");
exit(1);
}
printf("writing ones to mmap region\n");
{
int n;
for(n = 0; n < MMAP_SIZE; n++)
maddr[n] = 1;
}
printf("done!\n");
}
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple