Re: [RFC] [PATCH] To list all active probes in the system

From: Andrew Morton
Date: Wed Feb 07 2007 - 17:28:09 EST


On Wed, 07 Feb 2007 10:55:23 +0530
Srinivasa Ds <srinivasa@xxxxxxxxxx> wrote:

> --- linux-2.6.20.orig/fs/debugfs/inode.c
> +++ linux-2.6.20/fs/debugfs/inode.c
> @@ -25,6 +25,7 @@
> #include <linux/namei.h>
> #include <linux/debugfs.h>
> #include <linux/fsnotify.h>
> +#include <linux/kprobes.h>
>
> #define DEBUGFS_MAGIC 0x64626720
>
> @@ -320,6 +321,7 @@ static int __init debugfs_init(void)
> retval = register_filesystem(&debug_fs_type);
> if (retval)
> subsystem_unregister(&debug_subsys);
> + debugfs_kprobe_init();
> return retval;
> }

eww. Didn't it feel bad when you did that?


As this module has a dependency upon debugfs, I'd have thought the
approproate way of expressing that would be to run debugfs_kprobe_init()
at a lower initcall priority than debugfs_init()

> +void __kprobes debugfs_kprobe_init(void)
> +{
> + struct dentry *dir;
> +
> + dir = debugfs_create_dir("kprobes", NULL);
> + if (dir == NULL)
> + return;
> + debugfs_create_file("list", 0444, dir , 0 , &proc_kprobes_operations);
> +}
> +
> __initcall(init_kprobes);

debugfs_init() already runs at core_initcall level, presumably so that
debugfs clients can use plain old module_init().

>
> +static inline void debugfs_kprobe_init(void)
> +{
> +}

In which case we don't need this.
-
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/