From owner-freebsd-hackers Fri Dec 13 04:32:41 1996 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id EAA13588 for hackers-outgoing; Fri, 13 Dec 1996 04:32:41 -0800 (PST) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id EAA13583 for ; Fri, 13 Dec 1996 04:32:38 -0800 (PST) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.3/8.6.9) id XAA32237; Fri, 13 Dec 1996 23:31:06 +1100 Date: Fri, 13 Dec 1996 23:31:06 +1100 From: Bruce Evans Message-Id: <199612131231.XAA32237@godzilla.zeta.org.au> To: gena@NetVision.net.il, hackers@FreeBSD.ORG Subject: Re: mmap() with offset Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >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