Re: Regarding - unresolved symbol

From: Jon Masters
Date: Tue Oct 11 2005 - 10:33:15 EST


On 10/11/05, linux-os (Dick Johnson) <linux-os@xxxxxxxxxxxx> wrote:

> On Tue, 11 Oct 2005, vinay hegde wrote:

> > [I am able to fix this problem by simply using the
> > 'sys_mknod()' call in my module, but I really would
> > like to know why the above piece of code can not
> > work!]

> Even sys_mknod() should not work from a module; Who's
> context did you steal to create that device-file? What
> happens next to that poor sucker? Who's data-space
> did you corrupt for the file-name string? I note that,
> from the names, it's likely that you intend to do this
> dastardly deed from a timer-queue!!!

Yummy.

> File operations require a process context. The kernel doesn't
> have one. All file operations should (read must) be done
> from user space. The kernel is designed to do things
> on behalf of user-space callers. Executing sys_* from
> a module will result in somebody saying; "See, you are
> wrong... It works fine!". Later on mysterious errors
> occur which are un-trackable.

The fix is to call out to userland to get the device node cerated for
you - either allow udev/devfs to do this for you, use
call_usermode_helper to do it, send a message up to userland via
NETLINK or whatever. There's more than one way to do it.

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