Hi, Has this issue been confirmed as a bug? Is it being looked into?
Cheers, Shane Shane Mann Software Engineer Phone: +61-7-3259-2223 LeadUp Software Pty Ltd Fax: +61-7-3259-2259 339 Coronation Drive, Email: [EMAIL PROTECTED] Milton, QLD, 4064 Web: http://www.leadup.com.au > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf > Of Shane Mann > Sent: Friday, 20 September 2002 9:38 > To: [EMAIL PROTECTED] > Subject: RE: MMap offset parameter failing with ENOMEM error > > > Corinna, > > I noticed this while I continued testing last night. > Interestingly Linux and > SunOS don't seem to be bothered by this, however, if you read the IEEE > standard: > http://www.opengroup.org/onlinepubs/007904975/functions/mmap.html > there is the following quote: "The range of bytes starting at off and > continuing for len bytes shall be legitimate for the possible (not > necessarily current) offsets in the file, shared memory object, or [TYM] > typed memory object represented by fildes." Linux and Sun seem > to allow it > and return '0' if you access memory beyond the EOF, go figure. > > Perhaps the wrong error is being returned for this case - I would have > thought the following error code would be more appropriate: > > [ENXIO] > Addresses in the range [off,off+len) are invalid for the object > specified by > fildes. > > I have since amended the code by replacing the following line: > > size = finfo.st_size; > > with > > size = finfo.st_size - foff; > > and I still get the same error. There is some example output below: > > Note: index.idx is a file with a size of 557592 bytes. In the output below > it worked for an offset of 400000 and created a map of 157592 bytes - but > failed for the same file with an offset of 300000 and a potential map of > 257592 bytes. > > Run 1) > ~/c>./a.exe 400000 index.idx > Offset is 400000 > File index.idx opened on descriptor 3. It is 157592 bytes long > --- Syspagesize 4096, pagemask FFFFF000, offmask FFF > foff is 400000 > --- Syspagesize 4096, pagemask FFFFF000, offmask FFF > pfoff is 397312 > **** Vars just before mmap call **** > psyz = 163840 > prot = 1 > fd = 3 > pfoff = 397312 > Mapping 163840 at 2A231000 <---> 397312 (mapping fh > Result from femmap is 2A231A80 > Byte is 127 > > > Run 2) > ~/c>./a.exe 300000 index.idx > Offset is 300000 > File index.idx opened on descriptor 3. It is 257592 bytes long > --- Syspagesize 4096, pagemask FFFFF000, offmask FFF > foff is 300000 > --- Syspagesize 4096, pagemask FFFFF000, offmask FFF > pfoff is 299008 > **** Vars just before mmap call **** > psyz = 262144 > prot = 1 > fd = 3 > pfoff = 299008 > perror reports errno of 12 > Mapping 262144 at FFFFFFFF <---> 299008 (mapping fh > > Any ideas? > > Cheers, > Shane > > Shane Mann > Software Engineer Phone: +61-7-3259-2223 > LeadUp Software Pty Ltd Fax: +61-7-3259-2259 > 339 Coronation Drive, Email: [EMAIL PROTECTED] > Milton, QLD, 4064 Web: http://www.leadup.com.au > > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf > > Of Corinna Vinschen > > Sent: Thursday, 19 September 2002 17:33 > > To: Cygwin@Cygwin. Com > > Subject: Re: MMap offset parameter failing with ENOMEM error > > > > > > On Thu, Sep 19, 2002 at 12:19:06PM +1000, Shane Mann wrote: > > > Hi, > > > > > > I am having trouble with mmap using the last 'offset' > parameter. I have > > > attached a small piece of code (and sample file) which > demonstrates the > > > problem. Basically if the offset parameter is passed as a > > variable to mmap > > > then the call fails with an ENOMEM error. But if you pass 0 as > > the parameter > > > and then access the return address from mmap + offset - it is fine. My > > > question: is mmap handling the offset parameter correctly? > > > > > > Usage for the program: > > > > > > ./a.exe <offset> <file> eg: ./a.exe 11200 index.idx > > > > > > To see the address + offset work, comment out the first mmap > > call and return > > > statement and uncomment the lines below each one. > > > > > > Any help appreciated. > > > > Your application tries to mmap over EOF. > > > > Corinna > > > > -- > > Corinna Vinschen Please, send mails regarding Cygwin to > > Cygwin Developer mailto:[EMAIL PROTECTED] > > Red Hat, Inc. > > > > -- > > Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple > > Bug reporting: http://cygwin.com/bugs.html > > Documentation: http://cygwin.com/docs.html > > FAQ: http://cygwin.com/faq/ > > > > > -- > Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple > Bug reporting: http://cygwin.com/bugs.html > Documentation: http://cygwin.com/docs.html > FAQ: http://cygwin.com/faq/ > -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/