On Thu, Feb 25, 2010 at 9:23 AM, Petr Salinger <[email protected]> wrote:
> The file, which have to be copied, have size 1701,
> but two pages (2*4096) are mmaped. It is allowed on both
> Linux and FreeBSD.
> When the 2nd page of that file would be accessed, it would
> generate SIGBUS.
>
> The question is of course whether it really happens and why ?
> Petr
>
> gcc tst.c -o tst
> tst < tst.c
>
> -------------------------------
>    #include <stdio.h>
>    #include <sys/mman.h>
>
>     int main()
>     {
>
>     char *p = mmap(0, 8192,PROT_READ,MAP_PRIVATE,0,0);

File descriptor 0 is standard input and you can't mmap that.

You should also check the return of mmap.

Could you please provide a new test case?

Cheers,
Carlos.


--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: 
http://lists.debian.org/[email protected]

Reply via email to