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

Lothar Linhard lothar@concept.de
Mon Nov 5 12:08:00 GMT 2001


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out
Type: text/x-algol68
Size: 8610 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20011105/e9a0cc5c/attachment.bin>


More information about the Cygwin mailing list