[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] Using device files in "/dev" from kernel space




Am Donnerstag, den 23.12.2010, 22:30 +0100 schrieb David Gálvez <dgalvez75@gmail.com>:
Hi,

From what I know in UNIX kernels files in /dev directory make an
interface between user space applications and device drivers.

Is correct to use this interface from kernel space? For example
opening a device and calling ioctl() or Fcntl() functions from a
kernel module.

These functions do operate on an filehandle ( well, I don't know Fcntl ), a filehandle is bound to an Process. Because a Kernel Module has no Process associated to it (OK, I don't know if this is true for MiNT, but that's how it works within linux), but the FileHandle requires a process, you can't use functions which operate on Filehandle.

From the linux point of view it is not even possible to call such function - they don't exist in kernel space - because there is no libc for kernel modules. I guess it's the same for MiNT kernel modules: No gemlib available to kernel modules (???).

Of course there exists ways to use files within the linux kernel - but that is considered an hack, afaik. ...And of course it requires different code compared to user-space applications.

Greets,
m