Re: [RFC][PATCH 2.6.11-rc3-mm2] Relay Fork Module

From: Guillaume Thouvenin
Date: Mon Feb 14 2005 - 03:28:56 EST


On Fri, 2005-02-11 at 11:11 -0800, Greg KH wrote:
> > + char *kobj_path = NULL;
> > + char *action_string = NULL;
> > + char **envp = NULL;
> > + char ppid_string[FORK_BUFFER_SIZE];
> > + char cpid_string[FORK_BUFFER_SIZE];
> > +
> > + if (!uevent_sock)
> > + return;
> > +
> > + action_string = action_to_string(KOBJ_FORK);
> > + if (!action_string)
> > + return;
> > +
> > + kobj_path = kobject_get_path(kobj, GFP_KERNEL);
> > + if (!kobj_path)
> > + return;
>
> How is there a path for a kobject that is never registered with sysfs?

My kobject has a name, kobject_set_name(&fork_kobj, "fork_kobj"), and no
parent so I thought that the path returned by kobject_get_path() was
"/fork_kobj" even if the kobject is not registered with sysfs. As
send_uevent() function needs an object path, I used the
kobject_get_path() routine.

> I agree with Andrew, why are you using a kobject for this? Have you
> looked at the "connector" code that is in the -mm tree? That might be a
> better solution for this, and it will be going into the kernel tree
> after 2.6.11 is released.

I'm using kobject because it allows to notify user space application by
sending an event and as I need to send a kernel event (fork event) to a
user space application I thought about kobject. Do you think that it's
not the good solution because it's a too big mechanism for what I want
to do?

I haven't looked at the "connector" code and I will have a look now.
Thank you very much to point this.

Thank you for your comments and your help,
Regards,
Guillaume

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/