Sanil K wrote: > Hi all, > > This may be a generic problem as far as a driver is concerned. > > We need to handle an interrupt and inform the user space on the event and > pass the data correspodning to the event. > > The event can be informed through SIGNAL and the signal handler can be > invoked in the user space. Then again for data, we need to have the > "copy_to_user" mechanism . > > Is there any other effective mechanism(s) to handle the interrupt. I mean > we need to convey the event and or data to the user space(prefer - > asynchronously). > > Please share your views. > Hi. You could use relayfs to do this; it was designed with this type of thing in mind - basically you use it to create a kernel buffer that you can write into from your module and then access the data using a file in the relayfs file system. You can use read() or mmap() to access the data, depending on your needs. If you just need to do this for debugging purposes, then the following patch to the relayfs version I posted on this list a couple of weeks ago might be of use, or you can use it as an example and do something similar in your own code. Here's a link to the relayfs posting this patch needs to be applied to: http://marc.theaimsgroup.com/?l=linux-kernel&m=106556134715271&w=2 Apply the attached patch on top of that, and then use klog() or klog_raw() to write to the buffer and from user space read() from /mnt/relay/klog, or similar depending on where you mounted relayfs. If you expect to generate a lot of data, then it might be better to use mmap() to get at it. For an example of this, you can look at the most recent version of the Linux Trace Toolkit I posted to the ltt and ltt-dev mailing lists around the same time. Hope this helps, Tom Note: this patch is based on a patch kindly contributed by Hubertus Franke, but I've added and changed things - in any case all responsibility for any problems with this code are mine alone. Please send all comments/questions to me. Thanks. > Sanil. > > - > 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/ >