Re: Allocating Page Aligned Memory in User Space

From: Amit Phansalkar (amit_phansalkar_at_mail.com)
Date: 08/26/03


Date: 26 Aug 2003 00:55:01 -0700

legoburns@yahoo.com (LegoGT) wrote in message news:<5ff867d6.0308210636.570a304f@posting.google.com>...
> Does anyone know how to allocate memory like this without having to
> write a (kernel level) driver? Are there certain files or steps I
> need to look at in order to have this kernel functionality? (I know
> that it's possible using kmalloc, but I'm not quite sure how to use
> that from a program -- even if it's run as root.)

AFAIK, this isn't possible from user mode. kmalloc cannot be used from
user mode either. You could write a small dummy driver, that does the
allocation for you, and maps the memory to user-space (mmap
interface). Your program could then use the memory from user-space by
using mmap.

That's the best way that I can think of. Hope that helps..

-Amit.



Relevant Pages