How linux driver notify asynchrnous events to user space
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How linux driver notify asynchrnous events to user space
Hi All,
I am looking methods to implements asynchronous events handing in kernel & send data to userspace.
I saw there are many ways to handle asynchrnous event in linux eg. fasync, poll etc.
My requirement is as soon as receive the event in kernel space, send event notification along with the data to user space.
Can any one send the best mechanism/ sample code use in linux?
Regards,
akv
Last edited by onebuck; 01-16-2014 at 05:25 AM.
Reason: correct subject title
The purpose of any such signal, if you want to think of it this way, is merely "to wake the process up, if it is asleep," and to notify it (asynchronously ...) that it might have something to do. The signal is not associated with any particular request, and it might in fact turn out to be a false alarm.
The timing of such things is entirely fluid: the signal itself is nothing more and nothing less than a ringing bell that will wake-up a sleeping process and (whether or not it was sleeping ...) send it into a subroutine.
The user-land process, having been thusly informed that it might have work-to-do, must now issue whatever system calls may be required to find out if it (still) has work-to-do, and to do that work. It's entirely possible that said process may discover that, in any particular cycle, it has none. (Waking up a process "too often" is not a concern: "sorry to have bothered you." For the process to "go to sleep when still it has work to do," is.)
And this is pretty much the way that it is with every operating-system on the planet.
Last edited by sundialsvcs; 01-15-2014 at 06:06 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.