Re: Can I do ioctl() on a device file from inside a module?

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

 



Me> I want to write a module that opens up a device (known to the
Me> userland filesystem as "/dev/mtd/0"), runs some ioctl()s on it,
Me> and writes some data to it.

Greg> Do that in a userspace program, not from within the kernel.

I would rather do it in a userspace program, except for one big
problem:

There are quite a few other userspace programs running on this
embedded system, including programs that are started by the kernel to
service timer interrupts, and they are all running out of a CRAMFS
partition that I am trying to overwrite for a software upgrade.  I'm
afraid that one of those processes will get scheduled, and when CRAMFS
tries to read a text segment from the partition that has been
partially overwritten, it could hang the kernel before I complete the
software upgrade.  If I could do this in a kernel-space module, I
could do a cli() to make sure I complete the upgrade with no
interruptions.

I can copy a userspace program to a tmpfs filesystem and run it from
there, hence preventing my program from invoking a CRAMFS read.  But I
can't do this for every program that could run.  For example, if the
kernel gets a device hotswap event, it runs a userspace helper out of
a specific path in the CRAMFS.  I have no way to prevent that from
happening.

If there were a way to guarantee the CPU to my program and its device
until they are finished with the upgrade, I wouldn't care if the
kernel crashes as a result of the CRAMFS partition getting changed out
from under it.

Dave


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux