| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-SWARE-Spam-Status: | No, hits=-0.8 required=5.0 tests=AWL,BAYES_00 |
| X-Spam-Check-By: | sourceware.org |
| X-VirusChecked: | Checked |
| X-Env-Sender: | hkehoe AT budcat DOT com |
| X-Msg-Ref: | server-6.tower-203.messagelabs.com!1285012845!49411907!1 |
| X-StarScan-Version: | 6.2.4; banners=budcat.com,-,- |
| Message-ID: | <4C97BD6B.8090900@budcat.com> |
| Date: | Mon, 20 Sep 2010 15:00:43 -0500 |
| From: | Heath Kehoe <hkehoe AT budcat DOT com> |
| User-Agent: | Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.9) Gecko/20100915 Lightning/1.0b2 Thunderbird/3.1.4 |
| MIME-Version: | 1.0 |
| To: | "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com> |
| Subject: | Problem with mmap in latest snapshot |
| X-IsSubscribed: | yes |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
--------------000700010607020406050404
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
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
______________________________________________________________________
--------------000700010607020406050404
Content-Type: text/plain;
name="test.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="test.c"
#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");
}
--------------000700010607020406050404
Content-Type: text/plain; charset=us-ascii
--
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
--------------000700010607020406050404--
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |