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]

MMap offset parameter failing with ENOMEM error


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.

Regards,
Shane

Shane Mann
Software Engineer          Phone: +61-7-3259-2223
LeadUp Software Pty Ltd    Fax:   +61-7-3259-2259
339 Coronation Drive,      Email: shane.mann@leadup.com.au
Milton, QLD, 4064          Web:   http://www.leadup.com.au

Attachment: mmap_file2.c
Description: Binary data

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