LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-15-2010, 04:41 AM   #1
mehulc87
LQ Newbie
 
Registered: Feb 2008
Posts: 1

Rep: Reputation: 0
best way to communicate and synchronize between kernel and user space in linux


Hello All,

My objective is to log a lot of activities from kernel. For this I need to write into disk based file systems.

So, I have implemented a character device driver, and a user space process which reads from this virtual device. The driver copies the data into the user space buffer, and the user process writes it into a file.

My problem is how to synchronize the data. I started using kfifo an in kernel implementation for fifo. So wherever I want to log I use the kfifo API for copying data into the fifo. The virtual device driver reads from the fifo and copies it into user space. Since the data being logged is huge I need synchronization such as in producer consumer. Is there any such support in linux kernel which I can use?

Does netlink socket solve such a problem??
 
Old 12-16-2010, 01:02 PM   #2
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
I guess I don't understand. What activities are you logging, and what is wrong with using syslog?

What data do you want to synchronize, and what do you want to synchronize it with?

You can always trigger an interrupt and have a kernel interrupt service routine signal the userspace app to read data, but then the question becomes how you'd trigger the interrupt. You could do it off a timer.

More information is needed to give any kind of useful direction for this.
 
  


Reply



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
Free user space pages of different user processes from inside kernel space trueskyte Linux - Kernel 1 10-22-2010 04:37 PM
Netlink sockets usage to communicate b/w user and kernel space. vinodkr83 Linux - Newbie 1 07-03-2009 03:22 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:34 PM.

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