Re: [SLUG] kernel-level asynchronous i/o

From: Ed Centanni (ecentan1@tampabay.rr.com)
Date: Sat Jun 14 2003 - 09:26:58 EDT


I am not a kernel hacker but I hate to see a question go un-answered. I
looked in the "Understanding the Linux Kernel" book and found some info.

I believe the async I/O C library functions (user mode) you are
referring to are ioctl() and fcntl()? fcntl() in particular can arrange
that a signal be sent when input or output is available on a file
descriptor.

Of course the kernel is the part of the OS that deals with hardware so
it's role in asynchronous operation is to capture and route interrupts
and exceptions. Since they may pass these on to user mode via signals
set up by the C lib functions, the operations are MUCH less abstract
than the C Lib functions and the details can potentially vary from one
CPU architecture to another.

The closest thing I can guess that may be what you're looking for is the
kernel functions that place entries into the Interrupt Descriptor Table.
  These are:

set_intr_gate(n,addr) to set an interrupt gate. "All Linux interrupt
handlers are activated by means of interrupt gates, and all are
restricted to Kernel Mode."

set_system_gate(n,addr) and set_trap_gate(n,addr) also put entries into
the Interrupt Descriptor Table but deal mostly with exceptions and not
necessarily normal I/O operations.

If you want to deal with hardware interrupts at the kernel level, your
best bet is to write a loadable device driver module. If you want to
export a kernel interrupt to a user mode application. You *might* be
able to insert a system gate(in a modified kernel), create a phony
exception that could be handled in your application with some assembly
language opcodes. But I'm only guessing. Again, I'm not a kernel hacker.

See chapter 2 of "Understanding the Linux Kernel" by By Daniel P. Bovet,
Marco Cesati.

Ed.

Bill Glidden wrote:

> Does some version of Linux support async i/o at the kernel level?
> I remember reading somewhere that there was a form of async i/o
> in the C library, but it wasn't kernel level.
>
> Thanks.
>
>



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 16:41:35 EDT