lkml.org 
[lkml]   [2006]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 02/11] Task watchers: Register process events task watcher
Date
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?

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

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/

\
 
 \ /
  Last update: 2006-06-14 02:42    [W:0.066 / U:1.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site