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]

mmap example problem in NT and 2000


Sorry if I'm rehashing old stuff.
In trying to build xemacs,  I crashed in
the temacs step.  The following sample program
also crashes in the same way.


I'd go further but for my nubie questions...

how do I get syscall_printf to work?

how I do I make cygwin with -O0 instead of -O2 besides hacking the makefile.
(I noticed emacs debug also builds with -O2)

whenever I compile with -O0, every cygwin app crashes.

gcc --version = 2.95.2-6 if that matters.
~/mmaptest>uname -a
CYGWIN_NT-4.0 FOOBAR 1.3.0(0.36/3/2) 2001-03-13 00:38 i686 unknown

P.S. I did get emacs to build by undefineing HAS_MMAP in emacs's config.h


#include <memory.h>
main()
{
char *a;
char *b;
char *c;
char *d;

a=(char *)mmap(0,4096,3,34,-1,0);    //24930000
b=(char *)mmap(0,4096,3,34,-1,0) ;   //24931000
c=(char *)mmap(0,36864,3,34,-1,0) ;  //24932000

munmap(b,4096)              ;
d=(char *)mmap(0,73728,3,34,-1,0);   //2493b000  // footnote 1
memcpy(d,c,34768);
}

footnote 1
This call apparently succeeds even though

mmap_record::map_map (DWORD off, DWORD len)
knows something is wrong when

   if (os_being_run == winNT
              && !VirtualProtect (base_address_ + off * getpagesize (),
                           len * getpagesize (), prot, &old_prot))
                    syscall_printf ("-1 = map_map (): %E");

calls syscall_printf



--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


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