Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Dec 1996 23:31:06 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        gena@NetVision.net.il, hackers@FreeBSD.ORG
Subject:   Re: mmap() with offset
Message-ID:  <199612131231.XAA32237@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>For some reason mmap(...) call with offset other then 0 fails with invalid
>argument error.
>
>The code looks like:
>  msg->msg_body = (char *)mmap(NULL, (size_t)mlen, PROT_READ, 0,mfd,
>            (off_t)mofft)) == (char *)-1);
>
>You can reproduce it by running cmp with skip arguments (cmp file1 file2 10 10).
>Any ideas?

mmap() currently requires the offset to be a multiple of PAGE_SIZE (4096).
This is a bug according to the man page.  Similar restrictions on other
mmap args were removed in February 1996.  The args get rounded up or down
to a multiple of PAGE_SIZE as appropriate.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199612131231.XAA32237>