Re: Lazy Newbie Question

Calin A. Culianu (calin@ajvar.org)
Tue, 21 May 2002 12:07:03 -0400 (EDT)


On Tue, 21 May 2002, Richard B. Johnson wrote:

> 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.

Well I need to do it. I know all about ioctls and the like,
thank-you-very-much. I am writing code for COMEDI (have you heard of this
driver suite?) which uses a kernel-space API for Realtime Linux
(RTAI/RT-Linux). So yes, I NEED TO DO IT! :)

>
> 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.
>

Yes, as meantioned above.. my thread is permanent. It is a periodic
realtime priority thread. However, the stuff that needs to determine
device minors is going to run at non-realtime priority.

At any rate.. please don't chastise me. I am asking a simple question and
I wanted a straightforward answer.. I didn't expect to be flamed for it.

Have a nice day, Dick.

-Calin

-
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/