On Thu, Oct 30, 2008 at 10:58:46AM -0500, Eric Haszlakiewicz wrote: > On Wed, Oct 29, 2008 at 10:35:24PM +0000, David Laight wrote: > > On Tue, Oct 28, 2008 at 04:30:37PM -0700, Matt Thomas wrote: > > > It's already used by ioctls for plists. Basically the kernel > > > allocates VM and > > > puts the dictionary in it returning the location and size. User code > > > is responsible > > > munmap it after its done with it. > > > > That is trully horrid! > > hmm.. it doesn't seem too bad to me. That sounds like a great way to have > the kernel allocate memory for a process, similar to how various library > functions allocate memory and have a function other than free to release it. > (e.g. fopen, openlog, etc...) > > What's so horrid about it? I don't what people have against it. I don't see any other way to have data going two ways flexibly in one call. The usual solution involves two calls which is a locking nightmare. I guess another way would be to provide a facility to userland to do copyin() from kernel memory, but such a framework would have to be very carefully designed. The kernel could pass some cookie back that would allow userland to map exactly what it needs, do the copy and free it, but that means at least one more travel back to kernel space that the "horrid" solution. -- Quentin Garnier - cube%cubidou.net@localhost - cube%NetBSD.org@localhost "See the look on my face from staying too long in one place [...] every time the morning breaks I know I'm closer to falling" KT Tunstall, Saving My Face, Drastic Fantastic, 2007.
Attachment:
pgp7TJoqjdJOW.pgp
Description: PGP signature