lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 17 Mar 2009 18:52:28 -0400 (EDT)
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
cc:	mingo@...e.hu, paulus@...ba.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC][PATCH 04/11] ftrace: provide an id file for each event



On Tue, 17 Mar 2009, Peter Zijlstra wrote:

> Since not every event has a format file to read the id from, expose it
> explicitly in a separate file.

If the format is not exported, the ID is pretty useless. It's used for
binary formats.

But if you have a generic format defined in trace.h (I'll have to look
at your other patches), then those are exported in

 kernel/trace/trace_event_types.h

-- Steve

> 
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
> ---
>  kernel/trace/trace_events.c |   36 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 36 insertions(+)
> 
> Index: linux-2.6/kernel/trace/trace_events.c
> ===================================================================
> --- linux-2.6.orig/kernel/trace/trace_events.c
> +++ linux-2.6/kernel/trace/trace_events.c
> @@ -414,6 +414,29 @@ event_format_read(struct file *filp, cha
>  	return r;
>  }
>  
> +static ssize_t
> +event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos)
> +{
> +	struct ftrace_event_call *call = filp->private_data;
> +	struct trace_seq *s;
> +	int r;
> +
> +	if (*ppos)
> +		return 0;
> +
> +	s = kmalloc(sizeof(*s), GFP_KERNEL);
> +	if (!s)
> +		return -ENOMEM;
> +
> +	trace_seq_init(s);
> +	trace_seq_printf(s, "%d\n", call->id);
> +
> +	r = simple_read_from_buffer(ubuf, cnt, ppos,
> +				    s->buffer, s->len);
> +	kfree(s);
> +	return r;
> +}
> +
>  static const struct seq_operations show_event_seq_ops = {
>  	.start = t_start,
>  	.next = t_next,
> @@ -454,6 +477,11 @@ static const struct file_operations ftra
>  	.read = event_format_read,
>  };
>  
> +static const struct file_operations ftrace_event_id_fops = {
> +	.open = tracing_open_generic,
> +	.read = event_id_read,
> +};
> +
>  static struct dentry *event_trace_events_dir(void)
>  {
>  	static struct dentry *d_tracer;
> @@ -552,6 +580,14 @@ event_create_dir(struct ftrace_event_cal
>  				   "'%s/enable' entry\n", call->name);
>  	}
>  
> +	if (call->id) {
> +		entry = debugfs_create_file("id", 0444, call->dir, call,
> +				&ftrace_event_id_fops);
> +		if (!entry)
> +			pr_warning("Could not create debugfs '%s/id' entry\n",
> +					call->name);
> +	}
> +
>  	/* A trace may not want to export its format */
>  	if (!call->show_format)
>  		return 0;
> 
> -- 
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ