Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


  Search this Thread
Old 10-09-2012, 12:30 AM   #1
LQ Newbie
Registered: Oct 2012
Posts: 13

Rep: Reputation: Disabled
Question Polling on device file

I have one kernel thread(this wont run in calling process context common for all driver instances) created by driver, which signals when asynchronous message is received by it.
An user space application needs to poll for this message.
I have seen sample code for processes waiting on socket descriptors.But i have doubts for following questions.
Is it possible to wait on device file descriptor ?
If such wait can be done how poll will return ? How kernel thread can send an event ?
Old 10-10-2012, 12:28 AM   #2
LQ Newbie
Registered: Oct 2012
Posts: 13

Original Poster
Rep: Reputation: Disabled
Got answer
I got answer from Device driver book Ldd3 by Rubini sample code.
scull driver which creates scullpipe has poll implemented.
Now in my case,
User space application poll function call will reach device driver poll function, which can block on queue using poll_wait function call. Kernel thread can write to this queue and poll can be unblocked.
Ldd3 sample code which is compilable in latest kernel version can be found at below path.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Proper way of polling a device george_mercury Programming 4 12-13-2008 01:13 PM
Polling Device Drivers Jay-Whizzle Programming 1 04-04-2006 09:04 PM
Code for a Polling Linux Device Driver Jay-Whizzle Linux - Hardware 1 03-22-2006 12:52 AM
NAPI in linux with kernel 2.6 for device polling wangjinyi Linux - Networking 0 09-22-2005 02:36 AM
about device polling wangjinyi Fedora 0 04-27-2005 02:22 AM

All times are GMT -5. The time now is 05:00 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration