kobject_uevent
One of the new features of 2.6.10 (well, AFAIK its new) is the kobject_uevent function set.
Currently only some places send out events like this, so I was thinking to add some more.
Question is: how can I test this? Is there any userland program that catches these events and prints some information on them to the screen?
I found out Kay Siever and RML's (maybe some others too?) work on kernel->userspace events, but the syntax used there seems to be somewhat different. Kay's got a listener
(http://vrfy.org/projects/kdbusd/kdbusd.c), but is this one compatible?
Regards, Ikke
Next to this, there seems to be a mistake in the 2.6.10 changelog: it writes [quote]
kobject_uevent(const char *signal,
struct kobject *kobj,
struct attribute *attr)
[/quote]
whilst include/linux/kobject_uevent.h defines
[quote]
int kobject_uevent(struct kobject *kobj,
enum kobject_action action,
struct attribute *attr);
[/quote]
which is something completely different.
Quoted 17 lines · Ikke
One of the new features of 2.6.10 (well, AFAIK its new) is the
kobject_ueventfunction set.
Currently only some places send out events like this, so I was thinking to add some more.Question is: how can I test this? Is there any userland program that catches these events and prints some information on them to the screen?
I found out Kay Siever and RML's (maybe some others too?) work on
kernel->userspaceevents, but the syntax used there seems to be somewhat different. Kay's got a listener
(http://vrfy.org/projects/kdbusd/kdbusd.c), but is this one compatible?Regards, Ikke
Quoted 5 lines · Ikke
Next to this, there seems to be a mistake in the 2.6.10 changelog: it writes [quote]
kobject_uevent(const char *signal,
struct kobject *kobj,
struct attribute *attr)
Quoted 8 lines
[/quote]
whilstinclude/linux/kobject_uevent.hdefines
[quote]
int kobject_uevent(struct kobject *kobj,
enumkobject_actionaction,
struct attribute *attr);
[/quote]
which is something completely different.
The signal as a string was replaced by the kobject_action enumeration, which is mapped to a string. It is just an attempt at providing type safety.
Robert Love
Quoted 5 lines · Ikke
Next to this, there seems to be a mistake in the 2.6.10 changelog: it writes [quote]
kobject_uevent(const char *signal,
struct kobject *kobj,
struct attribute *attr)
Quoted 8 lines
[/quote]
whilstinclude/linux/kobject_uevent.hdefines
[quote]
int kobject_uevent(struct kobject *kobj,
enumkobject_actionaction,
struct attribute *attr);
[/quote]
which is something completely different.
Look further on in the changelog where I changed the api to the current one :)
thanks,
greg k-h
Quoted 8 lines · Ikke
One of the new features of 2.6.10 (well, AFAIK its new) is the
kobject_ueventfunction set.
Currently only some places send out events like this, so I was thinking to add some more.Question is: how can I test this? Is there any userland program that catches these events and prints some information on them to the screen?
http://www.us.kernel.org/pub/linux/utils/kernel/hotplug/uevent_listen.c
should be a good place to start. It's what I used to verify stuff was working properly.
Good luck,
greg k-h
I've been working a bit on the kobject_uevent stuff, and got a prototype system working (well, almost) which takes kernel's uevents, and sends them to the DBUS system bus so other software can (ab)use them.
I'll add more uevents later, once I understand the system completely. I'm a little confused by the use of KOBJ_* stuff in include/linux/kobject_uevent.h and the string representation of them in lib/kobject_uevent.c, which means people must edit 2 files if they want to add new events?
More information on my little work here [1]
Regards, Ikke
[1] http://blog.eikke.com/index.php/ikke/2005/01/07/kernel_events_to_dbus
Quoted 4 lines · Ikke
I'm a little confused by the use of KOBJ_* stuff in
include/linux/kobject_uevent.hand the string representation of them inlib/kobject_uevent.c, which means people must edit 2 files if they want to add new events?
Yes, that is exactly correct. The enumerated type is used for the callers to kobject_uevent* and the string is sent out on the wire from within the kevent core code.
Hope this helps,
greg k-h
Ok, events are sent to DBUS now, including the additional string information [1]. Code (for now, it's not "done" yet!) is here [2].
I'll ask the DBUS guys whether it's usefull to get this (optionally) directly into DBUS.
Let's hope other kernel devs will also start introducing events into their code! :-)
Greetings, Ikke
[1] http://blog.eikke.com/index.php/ikke/2005/01/08/udev_kernel_events_part_2
[2] http://www.eikke.com/files/code/uevent_listen.c
Quoted 14 lines · Greg KH
Quoted 4 lines · Ikke
I'm a little confused by the use of KOBJ_* stuff in
include/linux/kobject_uevent.hand the string representation of them inlib/kobject_uevent.c, which means people must edit 2 files if they want to add new events?Yes, that is exactly correct. The enumerated type is used for the callers to kobject_uevent* and the string is sent out on the wire from within the kevent core code.
Hope this helps,
greg k-h