Subject: Re: direct copy() between two proc address spaces
To: None <tech-kern@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 06/21/2004 19:25:27
[Pulling together messages from Thor Lancelot Simon <tls@rek.tjls.com>,
Jonathan Stone <jonathan@dsg.stanford.edu>, and Jason Thorpe
<thorpej@wasabisystems.com>.]

[tls]

> Here's a question: what happens if you pass an fd to /dev/zero to an
> unrelated process, then mmap it MAP_SHARED on each side?

Given how mmap on /dev/zero actually works, I feel sure it's the same
as if the unrelated process opens its own fd on /dev/zero and then
maps: two unrelated, unshared, memory sections.

[jonathan]

> If we made /dev/zero cloning, [...]

Possibly.  But that makes /dev/zero a much more complicated thing than
it currently is.  It also doesn't address one of the major reasons I
wanted to pass memory through AF_LOCAL sockets in the first place, that
being that it doesn't require that the memory be created as shared.

[thorpej]

> If you want "named" "anonymous" memory, [...]

I don't.  The only naming scheme I want for the memory is "this
address, this many bytes" on send, and "here's an address and byte
count" on receive.

Not that I expect any such thing to go into NetBSD.  It's a pipe-dream
item, not one I care about even enough to implement it myself for just
my own systems.  But it'd be cool to have - I suspect that if I had it,
I'd find myself finding uses for it, just as I have for AF_TIMER
sockets.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B