updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / kernel26-yi / 37_trace-add-trace-events-for-open-exec-an.patch
blobb1c0121e4227603f9d464f78f2b0a1351b233c1e
1 diff --git a/fs/exec.c b/fs/exec.c
2 index c62efcb..d4261c7 100644
3 --- a/fs/exec.c
4 +++ b/fs/exec.c
5 @@ -56,6 +56,8 @@
6 #include <linux/pipe_fs_i.h>
7 #include <linux/oom.h>
9 +#include <trace/events/fs.h>
11 #include <asm/uaccess.h>
12 #include <asm/mmu_context.h>
13 #include <asm/tlb.h>
14 @@ -737,6 +739,8 @@ struct file *open_exec(const char *name)
16 fsnotify_open(file);
18 + trace_open_exec(name);
20 err = deny_write_access(file);
21 if (err)
22 goto exit;
23 diff --git a/fs/open.c b/fs/open.c
24 index 4197b9e..42913db 100644
25 --- a/fs/open.c
26 +++ b/fs/open.c
27 @@ -33,6 +33,9 @@
29 #include "internal.h"
31 +#define CREATE_TRACE_POINTS
32 +#include <trace/events/fs.h>
34 int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs,
35 struct file *filp)
37 @@ -890,6 +893,7 @@ long do_sys_open(int dfd, const char __user *filename, int flags, int mode)
38 } else {
39 fsnotify_open(f);
40 fd_install(fd, f);
41 + trace_do_sys_open(tmp, flags, mode);
44 putname(tmp);
45 diff --git a/include/trace/events/fs.h b/include/trace/events/fs.h
46 new file mode 100644
47 index 0000000..e967c55
48 --- /dev/null
49 +++ b/include/trace/events/fs.h
50 @@ -0,0 +1,71 @@
51 +#undef TRACE_SYSTEM
52 +#define TRACE_SYSTEM fs
54 +#if !defined(_TRACE_FS_H) || defined(TRACE_HEADER_MULTI_READ)
55 +#define _TRACE_FS_H
57 +#include <linux/fs.h>
58 +#include <linux/tracepoint.h>
60 +TRACE_EVENT(do_sys_open,
62 + TP_PROTO(char *filename, int flags, int mode),
64 + TP_ARGS(filename, flags, mode),
66 + TP_STRUCT__entry(
67 + __string( filename, filename )
68 + __field( int, flags )
69 + __field( int, mode )
70 + ),
72 + TP_fast_assign(
73 + __assign_str(filename, filename);
74 + __entry->flags = flags;
75 + __entry->mode = mode;
76 + ),
78 + TP_printk("\"%s\" %x %o",
79 + __get_str(filename), __entry->flags, __entry->mode)
80 +);
82 +TRACE_EVENT(uselib,
84 + TP_PROTO(char *filename),
86 + TP_ARGS(filename),
88 + TP_STRUCT__entry(
89 + __string( filename, filename )
90 + ),
92 + TP_fast_assign(
93 + __assign_str(filename, filename);
94 + ),
96 + TP_printk("\"%s\"",
97 + __get_str(filename))
98 +);
100 +TRACE_EVENT(open_exec,
102 + TP_PROTO(char *filename),
104 + TP_ARGS(filename),
106 + TP_STRUCT__entry(
107 + __string( filename, filename )
108 + ),
110 + TP_fast_assign(
111 + __assign_str(filename, filename);
112 + ),
114 + TP_printk("\"%s\"",
115 + __get_str(filename))
118 +#endif /* _TRACE_FS_H */
120 +/* This part must be outside protection */
121 +#include <trace/define_trace.h>