public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* assertion "ptr != MAP_FAILED" failed while using mmap
@ 2003-06-25 15:17 Alex Vinokur
  2003-06-25 16:51 ` Elfyn McBratney
  2003-06-26 19:21 ` Comparative performance : Reading contents from file into one string Alex Vinokur
  0 siblings, 2 replies; 11+ messages in thread
From: Alex Vinokur @ 2003-06-25 15:17 UTC (permalink / raw)
  To: cygwin

===========================================
Windows 2000
CYGWIN_NT-5.0 1.3.22(0.78/3/2)
GNU gcc version 3.2 20020927 (prerelease)
===========================================

Here is some function.

--------------------------------------
void read_file (char* filename_i)
{
int fd = open(filename_i, O_RDONLY);
  assert (fd > 2);

off_t sz = lseek(fd, 0, SEEK_END);
char* ptr = (char*)mmap(0, sz, PROT_READ, 0, fd, 0);

  assert (ptr != MAP_FAILED);  // Here assertion failed
  if (ptr != MAP_FAILED)
  {
    string str(ptr, ptr+sz);
    munmap(ptr, sz);
  }

  close(fd);
}
--------------------------------------

Assertion  "ptr != MAP_FAILED)" failed.
What might cause that?

Thanks,
--
   ==========================================
   Alex Vinokur
     mailto:alexvn@connect.to
     http://www.simtel.net/pub/oth/19088.html
     http://sourceforge.net/users/alexvn
   ==========================================






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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2003-06-26 16:32 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-25 15:17 assertion "ptr != MAP_FAILED" failed while using mmap Alex Vinokur
2003-06-25 16:51 ` Elfyn McBratney
2003-06-25 16:55   ` Ronald Landheer-Cieslak
2003-06-25 21:40     ` Elfyn McBratney
2003-06-26  5:06       ` Igor Pechtchanski
2003-06-26  6:08         ` Alex Vinokur
2003-06-26  8:31           ` Alex Vinokur
2003-06-26  9:53             ` Brian Dessent
2003-06-26 11:33               ` Alex Vinokur
2003-06-26  9:23           ` Brian Dessent
2003-06-26 19:21 ` Comparative performance : Reading contents from file into one string Alex Vinokur

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).