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]

1.1.3: mmap() returns unusable memory segments: segm fault


Hi,

I run Cygwin 133 on NT4.0SP6 (output of cygcheck -s
is attached).  mmap() doesn't work even for a very
simple case.  Try:

#include <stdio.h>
#include <sys/mman.h>

int main() {
    char* core;

    core = mmap(NULL,0x10000,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0);
    if (core == MAP_FAILED) goto err;
    printf("mmap %p\n", core);
    *core = 'A';        /* ok */

    core = mmap(NULL,0x20000,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0);
    if (core == MAP_FAILED) goto err;
    printf("mmap %p\n", core);
    *core = 'A';        /* Segmentation fault */

    return 0;

  err:
    perror("mmap");
    return 1;
}
------------------------- end of test program -----------------
Same, if I use MA_SHARED. Any Help?
When I run this, I get:

mmap 0x1a230000
mmap 0x1a240000
      0 [main] a 126 open_stackdumpfile: Dumping stack trace to a.exe.stackdump Segmentation fault (core dumped)

Lothar.

output of cygcheck -s -v -r

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