Re: Lazy Newbie Question

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Tue May 21 2002 - 10:53:58 EST


On Tue, 21 May 2002, Calin A. Culianu wrote:

>
> Whats the best way to do the equivalent of a stat() on a char * pathname
> from inside a kernel module? Don't ask why I need to do this.. I know it
> sounds evil but I just need to do it... Basically I need to find out the
> minor number of a device file.
>

No. You never "need to do it". Some user-mode task, somewhere, installs
your module. That same task can open your device and via ioctl() tell
it anything it needs to know.

A "file" is something the kernel handles on behalf of a task. That
task has a context which, amongst other things, allows the kernel
to assign file-descriptors. The kernel is not a task. It does not
have a "context". Of course it can create one and it can steal one.
These are the two methods used inside the kernel to handle "files".

And, unless the kernel task "thread" is permanent, it's a dirty
way of corrupting the kernel.

Cheers,
Dick Johnson

Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).

                 Windows-2000/Professional isn't.

-
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 : Thu May 23 2002 - 22:00:22 EST