mmap() question

From: Gábor Lénárt (lgb@viva.uti.hu)
Date: Wed Oct 25 2000 - 04:19:23 EDT

  • Next message: Andi Kleen: "Re: mmap() question"

    Hi,

    Sorry for my stupid question, but I haven't got idea what the problem can be,
    and maybe you can help me. See the following fragment of C code:

    videobuffer=mmap(0,MAX_VIDEO_PACKET_SIZE,PROT_READ|PROT_WRITE,MAP_ANON|MAP_SHARED,-1,0);
    if (videobuffer==(void*)-1) {
            perror("mmap()");
            exit(1);
    }

    This will return with Invalid argument.
    The nice this is that this code runs happyly with 2.4.x-pre kernels but not
    with my 2.2.17 or 2.2.18pre15.

    Maybe because of not page aligned size, so I modify my code:
    I defined MAX_VIDEO_PACKET_SIZE to 4096 for testing (on PC page size is
    4096 bytes, and getpagesize() returns with this as well, I checked).

    The result is the same ! I don't understand what the problem can be ...

    I tried with opening /dev/zero with O_RDWR mode than mapping that, but that
    gave me the same result ;-(

    I'm totally confused.
    Can someone help, please ?

    - Gabor

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    Please read the FAQ at http://www.tux.org/lkml/



    This archive was generated by hypermail 2b29 : Wed Oct 25 2000 - 04:23:17 EDT