LinuxQuestions.org
Visit Jeremy's Blog.
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 03-19-2009, 04:42 PM   #1
Jon99
LQ Newbie
 
Registered: Mar 2009
Posts: 1

Rep: Reputation: 0
Question Block user app until kobject (/sys/foo/myattribute) changes


I have a kobject/attribute in a kernel module that gets added to the sysfs:

example_kobj = kobject_create_and_add("foo", kernel_kobj);
if (!example_kobj)
return -ENOMEM;

/* Create the files associated with this kobject */
retval = sysfs_create_group(example_kobj, &attr_group);

That all works fine, but I would like to be able to notify my user app when the attribute changes. I found this routine:

kobject_uevent(example_kobj, KOBJ_CHANGE);

The problem is that I do not know what to do in the user app, in order to block until the attribute changes. I tried using select, but that did not seem to work after I opened the file /sys/foo/myattribute. Could somebody point me to some docs on how this mechanism works. As you can probably tell I am new to Linux. I have the Linux Device Drivers book ed.3, but they don't really address the notification process.
 
  


Reply


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
Missing Partitions in /sys/block and /dev ThatGuyTim Linux - Newbie 6 01-30-2009 04:05 PM
/sys/block/sda/sda1/dev: No such fiel or directory PlatinumX Linux - Newbie 1 08-05-2008 07:16 AM
Waiting for /sys/block/hda/dev to come up davcefai Debian 3 11-29-2007 05:06 PM
Which config file should I use... foo or foo.new? davidguygc Slackware 6 08-01-2007 06:21 PM
LVM and sys/block cantabile Linux - General 0 08-27-2005 11:47 AM

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

All times are GMT -5. The time now is 06:16 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration