mlock into kernel module
Hello,
I need to use mlock and munlock function into a kernel module. How so I call this system call from my module ?
I need to do this because I must use mlock in my software, but I can't use root or suser to start it. So mlock alwaays fail. Regards,
sej
Quoted 7 lines · sej.kernel
Hello,
I need to use mlock and munlock function into a kernel module. How so I call this system call from my module ?
I need to do this because I must use mlock in my software, but I can't use root or suser to start it. So mlock alwaays fail. Regards,
sej
You don't call mlock from a module. You can lock down pages inside your module by using non-paged RAM. This can be accessed from user-space by implimenting mmap() in your module so that the user-code can memory-map it. That way, the page(s) you have allocated in the kernel are never swapped.
Cheers,
Dick Johnson
Penguin : Linux version 2.6.16.4 on an i686 machine (5592.89 BogoMips). New book: http://www.lymanschool.com
_
****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to [email protected] - and destroy all copies of this information, including any attachments, without reading or disclosing them.
Thank you.
Quoted 3 lines · sej.kernel
Hello,
I need to use mlock and munlock function into a kernel module. How so I call this system call from my module ?
no it's a bug if you need to do that
Quoted 2 lines
I need to do this because I must use mlock in my software, but I can't use root or suser to start it. So mlock alwaays fail.
that's an rlimit thing, just fix the rlimit on your system.
Also if you want to do this for pinning hardware at a physical address you have a really wrong design (mlock is the wrong api) which also includes a security hole btw
Quoted 2 lines · * sej.kernel ([email protected]) wrote:
I need to use mlock and munlock function into a kernel module. How so I call this system call from my module ?
You shouldn't.
Quoted 2 lines
I need to do this because I must use mlock in my software, but I can't use root or suser to start it. So mlock alwaays fail.
You should be using rlimits for this.
thanks,
-chris