Re: kobject_uevent() usage?

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

 



On Wed, Aug 23, 2006 at 12:02:13PM -0400, Arun Thomas wrote:
> Hi all,
> 
> I'm attempting to use kobject_uevent() to send event notifications to
> userspace. Unfortunately, my userspace program never sees the uevent. 
> 
> >From my kernel module, I call kobject_uevent(&miscdev.class->kobj,
> KOBJ_CHANGE). I assume I don't need to call kobject_uevent_init(), since
> it looks like it's called during the kernel init phase. Are there any
> other setup routines I must call before using kobject_uevent()?

No, it should be fine.  Have you run 'udevmonitor' to see if udev
catches this event?  Perhaps that is why your program isn't seeing it.

> I'm using a stock 2.6.17 kernel. Also, what is the purpose of the uevent
> file in the sysfs hierarchy (e.g. /sys/class/mem/urandom/uevent)? It
> looks like it's write only. Does it enable/disable uevents perhaps? 

No, the 'uevent' file is for "coldplugging" functionality.  At boot
time, when init starts, udev walks the sysfs tree and writes a 1 to the
uevent files.  That causes the kernel to emit the event as if the
kobject had just been added to the kernel for the first time.  That
makes userspace logic for coldplugging very tiny, as it doesn't have to
try to reconstruct the proper logic for what happened before it started
up.

Hope this helps,

greg k-h

--
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