Re: Function calls not permitted in kernel code

From: Tigran Aivazian (tigran@aivazian.fsnet.co.uk)
Date: Wed Sep 20 2000 - 07:44:21 EST


On Wed, 20 Sep 2000, Mark James wrote:

> That is, can a kernel module open and read files or sockets,
> call libc functions, start processes?

kernel code is, as userspace one, just a code to be executed by the CPU,
I suspect you knew that already ;) Therefore, it can do absolutely
anything the human tells it to. Even calling "libc functions" as long as
you implement the desired libc functionality in the kernel yourself - most
of what is needed is there already, e.g. sprintf() etc.

Having said that, doing things like opening files and sockets is usually
frowned upon and rightly so, except in special cases like khttpd and such.

> (1) Get a user process to do the work, communicating
> with the kernel via /proc or some other way.

some other way may be by means of system calls. System calls are the most
natural (by definition) way of communicating between userspace and kernel.

Regards,
Tigran

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



This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 21:00:23 EST