Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 03-19-2009, 03:42 PM   #1
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.


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

All times are GMT -5. The time now is 12:17 PM.

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