powerpc/mm: Rename arch/powerpc/kernel/mmap.c to mmap_64.c
[deliverable/linux.git] / samples / tracepoints / tracepoint-sample.c
CommitLineData
4a089752
MD
1/* tracepoint-sample.c
2 *
3 * Executes a tracepoint when /proc/tracepoint-example is opened.
4 *
5 * (C) Copyright 2007 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
6 *
7 * This file is released under the GPLv2.
8 * See the file COPYING for more details.
9 */
10
11#include <linux/module.h>
12#include <linux/sched.h>
13#include <linux/proc_fs.h>
14#include "tp-samples-trace.h"
15
7e066fb8
MD
16DEFINE_TRACE(subsys_event);
17DEFINE_TRACE(subsys_eventb);
18
4a089752
MD
19struct proc_dir_entry *pentry_example;
20
21static int my_open(struct inode *inode, struct file *file)
22{
23 int i;
24
25 trace_subsys_event(inode, file);
26 for (i = 0; i < 10; i++)
27 trace_subsys_eventb();
28 return -EPERM;
29}
30
31static struct file_operations mark_ops = {
32 .open = my_open,
33};
34
7ec7fb39 35static int __init example_init(void)
4a089752
MD
36{
37 printk(KERN_ALERT "example init\n");
38 pentry_example = proc_create("tracepoint-example", 0444, NULL,
39 &mark_ops);
40 if (!pentry_example)
41 return -EPERM;
42 return 0;
43}
44
7ec7fb39 45static void __exit example_exit(void)
4a089752
MD
46{
47 printk(KERN_ALERT "example exit\n");
48 remove_proc_entry("tracepoint-example", NULL);
49}
50
51module_init(example_init)
52module_exit(example_exit)
53
54MODULE_LICENSE("GPL");
55MODULE_AUTHOR("Mathieu Desnoyers");
56MODULE_DESCRIPTION("Tracepoint example");
This page took 0.045924 seconds and 5 git commands to generate.