From owner-freebsd-arch Sat Jan 11 15:42:48 2003 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CEDB737B401 for ; Sat, 11 Jan 2003 15:42:46 -0800 (PST) Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7BB1443E4A for ; Sat, 11 Jan 2003 15:42:45 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: from apollo.backplane.com (localhost [127.0.0.1]) by apollo.backplane.com (8.12.6/8.12.6) with ESMTP id h0BNgjYp048597; Sat, 11 Jan 2003 15:42:45 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.12.6/8.12.6/Submit) id h0BNgj9a048596; Sat, 11 Jan 2003 15:42:45 -0800 (PST) Date: Sat, 11 Jan 2003 15:42:45 -0800 (PST) From: Matthew Dillon Message-Id: <200301112342.h0BNgj9a048596@apollo.backplane.com> To: Peter Wemm Cc: "Alan L. Cox" , arch@FreeBSD.ORG Subject: Re: Virtual memory question References: <20030111224444.94D102A89E@canning.wemm.org> Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG :Speaking of which, I've been thinking about some sort of non-fs persistent :object handle for doing mmaps. (Note: thinking about, not actually getting :around to doing :-). : :Imagine mmapping /dev/zero, but having a persistent object per fd that was :opened. This would be to enable things like fd passing to get access to :another process's store and so on. Basically a replacement for the :MAP_NOSYNC files, and it would be swap backed instead of vfs backed. : :This would be very damn useful at work. It could be ideal for malloc too :since it would be a single object with coherent ordering etc. At work, we :have lots of problems with complications of having a file system attached :to things that we just want to shove data into and otherwise forget about. : :Cheers, :-Peter :-- :Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com This is basically how shared memory works, except that shared memory is managed outside the file descriptor framework. I would love to see a shared memory object that is managed inside the file descriptor framework, sort of like 'pipe()'. I do not see any need to use /dev/zero to implement the feature, though, because it will not improve portability. How about something like: getmemfd(). You would then be able to mmap() to your heart's content. We wouldn't even need to implement ftruncate(), we could just default it to a 64 bit object space. fd = getmemfd(); mmap(...) pass the descriptor around, etc. BTW, this would be utterly trivial to implement. I don't even think we need a VFS. Just a fileops set. -Matt Matthew Dillon To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message