Messages in this thread | | | Subject | Re: [PATCH 02/11] Task watchers: Register process events task watcher | From | Matt Helsley <> | Date | Tue, 13 Jun 2006 17:52:37 -0700 |
| |
On Tue, 2006-06-13 at 19:39 -0500, Chase Venters wrote: > On Tuesday 13 June 2006 18:54, Matt Helsley wrote: > > > +static int cn_proc_watch_task(struct notifier_block *nb, unsigned long > > val, + void *t) > > +{ > > + struct task_struct *task = t; > > Why the copy?
It shouldn't result in a copy. Since t is a void* I don't think any additional instructions or stack space are required. This should have zero runtime cost while improving clarity of the code. It's also needed in the next patch.
> > + int rc = NOTIFY_OK; > > + > > + switch (get_watch_event(val)) { > > + case WATCH_TASK_CLONE: > > + proc_fork_connector(task); > > + break; > > + case WATCH_TASK_EXEC: > > + proc_exec_connector(task); > > + break; > > + case WATCH_TASK_UID: > > + proc_id_connector(task, PROC_EVENT_UID); > > + break; > > + case WATCH_TASK_GID: > > + proc_id_connector(task, PROC_EVENT_GID); > > + break; > > + case WATCH_TASK_EXIT: > > + proc_exit_connector(task); > > + break; > > + default: /* we don't care about WATCH_TASK_INIT|FREE because we > > + don't keep per-task info */ > > + rc = NOTIFY_DONE; /* ignore all other notifications */ > > + break; > > + } > > + return rc; > > +} > > + > > > /* > > * cn_proc_init - initialization entry point > > * > > * Adds the connector callback to the connector driver. > > */ > > @@ -219,11 +259,16 @@ static int __init cn_proc_init(void) > > int err; > > > > if ((err = cn_add_callback(&cn_proc_event_id, "cn_proc", > > &cn_proc_mcast_ctl))) { > > printk(KERN_WARNING "cn_proc failed to register\n"); > > - return err; > > + goto out; > > } > > - return 0; > > + > > + err = register_task_watcher(&cn_proc_nb); > > + if (err != 0) > > if (err)
I don't see any benefit to changing this. Care to elaborate on why this is important?
> Thanks, > Chase
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |