From owner-freebsd-emulation Mon Apr 22 13:25:37 2002 Delivered-To: freebsd-emulation@freebsd.org Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) by hub.freebsd.org (Postfix) with ESMTP id 5C37637B61B; Mon, 22 Apr 2002 13:24:33 -0700 (PDT) Received: from grasshopper.cs.duke.edu (grasshopper.cs.duke.edu [152.3.145.30]) by duke.cs.duke.edu (8.9.3/8.9.3) with ESMTP id QAA14970; Mon, 22 Apr 2002 16:23:28 -0400 (EDT) Received: (from gallatin@localhost) by grasshopper.cs.duke.edu (8.11.6/8.9.1) id g3MKMwe02443; Mon, 22 Apr 2002 16:22:58 -0400 (EDT) (envelope-from gallatin@cs.duke.edu) From: Andrew Gallatin MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15556.28962.259876.509643@grasshopper.cs.duke.edu> Date: Mon, 22 Apr 2002 16:22:58 -0400 (EDT) To: Kenneth Culver Cc: freebsd-hackers@freebsd.org, Subject: Re: implementing linux mmap2 syscall In-Reply-To: <20020422155927.E22719-100000@alpha.yumyumyum.org> References: <15556.6399.62081.426193@grasshopper.cs.duke.edu> <20020422155927.E22719-100000@alpha.yumyumyum.org> X-Mailer: VM 6.75 under 21.1 (patch 12) "Channel Islands" XEmacs Lucid Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Kenneth Culver writes: > > To me, it looks like mmap2 takes an offset that's a page index, rather > > than a byte position. Since linux passes the offset with a 32-bit > > long, rather than a 64-bit off_t like we do, they need to do this in > > order to be able to map offsets larger than 4GB into a file. > > > > For linux_mmap2, I'd think we want to do roughly the same things as > > linux_mmap, but with bsd_args.pos = ctob((off_t)linux_args.pos) > > > > Drew > > > > > AHH, ok I was wondering where PAGE_SHIFT was for FreeBSD. I guess ctob > does what I need it to. I think that's probably why it still wasn't > working yet... I think it also has to be page aligned before you pass it > in though, I have to look at linux's do_mmap_pgoff() (I think that's the > right function name) to see if it's expecting an already page-aligned arg, > or if it's aligning it before it uses it. The name implies that do_mmap_pgoff() takes page-shift'ed args. An offset specified as a page-shift is page-aligned by definition. Eg, when you call ctob(pgoff) this turns out to be (pgoff << PAGE_SHIFT) bytes. Drew To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message