Re: Operations inside a module

From: Rik van Riel (riel@conectiva.com.br)
Date: Thu Nov 21 2002 - 15:24:40 EST


On Thu, 21 Nov 2002, Matt Young wrote:

> Within the open routine of my module I need to open another device; and
> the write routine needs to write to the other device.
>
> User space system calls seem to be unavailable to module code. I know
> about swapping the DS and ES to fake out other modules; then using
> sys_write etc.

You don't need the system calls, you can just call the in-kernel
functions directly. If one of the functions you want isn't exported
you could either use an exported alternative or export it yourself
by patching your kernel. However, chances are that if it's not
exported it'll be changed or gone 10 kernels down the line, so you
don't want to use it anyway. ;)

> My module code would also like to use user space malloc, is this a
> problem?

Yes. This is absolutely impossible.

Think of the kernel as a shared library, a shared library that
causes the process that calls a function from it to switch into
supervisor mode.

regards,

Rik

-- 
A: No.
Q: Should I include quotations after my reply?

http://www.surriel.com/ http://distro.conectiva.com/

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Nov 23 2002 - 22:00:37 EST