This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 1.3.20: mmap with nonzero file offset results in seg fault (W in2k )"


On Tue, Feb 25, 2003 at 04:51:33PM +1100, brett dot matson at csiro dot au wrote:
>Christopher, a few points about your comments:
>
>1. I wasn't asking for help. This bug report wasn't for 
>   our benefit. We're content to use version 1.3.19.

You really should try B20 if you want the absolute best cygwin out there.

>2. Next time, read the man page:
>
>   "The actual place where the object is mapped is 
>    returned by mmap, and is never 0." - mmap man page

I am quite familiar with mmap.  No inspection of the man page was needed
to determine that there was an obvious problem with your example.

Hmm.  Now that I look at it again, I will admit that I was wrong in my
analysis.  Your code snippet wouldn't have compiled.  I should have
assumed that you were missing an opening parentheses in the below.  If
your further bug report is true, this wouldn't have done me any good but
it does mean that I had wrongly interpreted your code to assume that
rslt would be set to a boolean value rather than the output of mmap.

You had:
if (rslt = mmap(0, size, prot, MAP_SHARED,  fd, offset)) == MAP_FAILED)

I misread it as:
if (rslt = mmap(0, size, prot, MAP_SHARED,  fd, offset) == MAP_FAILED)

It should be:
if ((rslt = mmap(0, size, prot, MAP_SHARED,  fd, offset)) == MAP_FAILED)

>The seg fault only occurs in version 1.3.20.  The TEST_FILE macro needs
>to be set to the name of a file that is larger than 16 system pages +
>32 bytes.

Although you've taken great offense at the suggestion that a real test
case was required, you seem to have provided something that we can now
use to fix cygwin.  Thank you for the test case and analysis.

cgf

--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]