From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16465 invoked by alias); 17 Dec 2007 18:10:08 -0000 Received: (qmail 16456 invoked by uid 22791); 17 Dec 2007 18:10:06 -0000 X-Spam-Check-By: sourceware.org Received: from a.mail.sonic.net (HELO a.mail.sonic.net) (64.142.16.245) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 17 Dec 2007 18:09:57 +0000 Received: from [192.168.1.103] (74-95-195-237-SFBA.hfc.comcastbusiness.net [74.95.195.237] (may be forged)) (authenticated bits=0) by a.mail.sonic.net (8.13.8.Beta0-Sonic/8.13.7) with ESMTP id lBHI9s4F010362 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 17 Dec 2007 10:09:55 -0800 Message-ID: <4766BC34.9060203@4raccoons.com> Date: Mon, 17 Dec 2007 18:47:00 -0000 From: Wayne Christopher User-Agent: Thunderbird 1.5.0.4 (X11/20060516) MIME-Version: 1.0 To: cygwin@cygwin.com Subject: Re: mmap failing References: <47616D31.7090002@4raccoons.com> <20071213175934.GB25863@calimero.vinschen.de> <476185AF.5000906@4raccoons.com> <20071214111508.GD25863@calimero.vinschen.de> <20071214134147.GG25863@calimero.vinschen.de> <20071214135239.GJ25863@calimero.vinschen.de> <20071214172454.GL25863@calimero.vinschen.de> <4762FCCD.6030804@4raccoons.com> <20071216110441.GC18860@calimero.vinschen.de> In-Reply-To: <20071216110441.GC18860@calimero.vinschen.de> Content-Type: multipart/mixed; boundary="------------000700040600010608030807" X-IsSubscribed: yes Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2007-12/txt/msg00395.txt.bz2 --------------000700040600010608030807 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1210 My test program is attached. This example works but in my real program the same write+close+mmap sequence did not. It appears that calling fsync before the close sometimes avoids the error but not always. This is Cygwin 1.5.24(0.156/4/2). Any thoughts? Thanks, Wayne Corinna Vinschen wrote: > On Dec 14 13:59, Wayne Christopher wrote: > >> I have a 268MB file open for writing. I close it and then >> immediately try to mmap() it, and a get ENOMEM. However I do have the >> VM space available and can malloc() the size of the file right after the >> failure. Also, I have mmap()'ed other similar files in the same program >> before this, but these had not just been closed. >> >> My initial guess was that it was timing related, but if I wait for 5 >> seconds and try again I still get the failure. >> >> I wasn't able to duplicate it in a small example since my app has a bunch >> of threads and is doing other stuff at the same time. >> >> Any suggestions for solutions or workarounds? >> > > Not without testcase and version information. Is that under 1.5.24-2 > or 1.5.25-x? Could you test if the result differs between these two > versions? If so, how? > > > Corinna > > --------------000700040600010608030807 Content-Type: text/x-c++src; name="mmcheck.c" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="mmcheck.c" Content-length: 795 #include #include #include #include #include #include #include #include #define SIZE 268000000 main() { char* fname = "test_file"; char* data; int fd, i; struct stat sb; caddr_t base; data = malloc(SIZE); fd = open(fname, O_RDWR|O_CREAT, 0666); assert(fd >= 0); i = write(fd, data, SIZE); assert(i == SIZE); close(fd); i = stat(fname, &sb); assert(i >= 0); assert(SIZE == sb.st_size); fd = open(fname, O_RDONLY, 0); assert(fd >= 0); base = (caddr_t) mmap(NULL, SIZE, PROT_READ, MAP_SHARED, fd, 0); printf("base = %ld\n", (long) base); if (MAP_FAILED == base) perror("mmap"); exit(0); } --------------000700040600010608030807 Content-Type: text/plain; charset=us-ascii Content-length: 218 -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ --------------000700040600010608030807--