kobject_uevent() and sysfs attribute sync

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

 



Hi all,

I implemented a module that sends signals to user space using
kobject_uevent() when some conditions happen. That step is working.

When the signal is sent, a sysfs attribute is also changed (switch from
0 to 1 or vice-versa). This means that the corresponding file under
/sys/ has its contents modified as well (using "_name"_show(struct
subsystem *subsys, char *page) function) .

The user space when receives the signal (sent by kobject_uevent()) it
tries to read the file under /sys (that was changed to 1 when the
signal was sent), but the value is always 0. IMHO there is a sync
problem, because when user space gets the signal and it reads the file
under /sys, the value set to 1 (notify moment) could be changed back to
0 (read moment) later.

So is there any way to send a signal and guarantee that the attribute
will be read by user space before being changed by subsequent actions?
Is sysfs_notify() a possible solution for that?

BR,

Mauricio Lin.


		
_______________________________________________________ 
Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu celular. Registre seu aparelho agora! 
http://br.mobile.yahoo.com/mailalertas/ 
 


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[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