Re: Kernelspace to Userspace message passing

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

 



> Jan Hudec <bulb@ucw.cz> wrote:
> >Sandip Bhattacharya <sandipb@bigfoot.com> wrote:
> >>I have an userspace application running, which communicates to a kernel
> >>modules using IOCTLs. Now, from time to time, the kernel needs to send
> >>a message back to the application. Now one alternative would be that the
> >>app polls the kernel using IOCTLs to see if any message is waiting. How
> >>can I avoid that and send a message directly as in a callback or signal?
> >
> >When you use ioctl, you have to have a file descriptor. It should be
> >possible to implement poll syscall to work with that descriptor (character
> >device or proc file).
> 
> This is one possibility.
> Actually the elegant/clean/... solution would be : make a char driver, 
> which accepts "commands" (that what are now the ioctl()s) through the
> read(2) syscall and which may provide something useful through write(2)
> syscall. Of course you implement the poll for this device (look e.g.
> into Rubini's book for this).

Yes, it would definitely be cleaner to have userland read those messages via
read rather then ioctl. (And to send commands via write). But it's much
orthogonal to writing the poll function. It mus be written in both cases and
it's implementation is independent of interface used to pass the actual data.

--------------------------------------------------------------------------------
                  				- Jan Hudec `Bulb' <bulb@ucw.cz>
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[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