uprobes: Add exports for module use
[deliverable/linux.git] / kernel / trace / trace_uprobe.c
CommitLineData
f3f096cf
SD
1/*
2 * uprobes-based tracing events
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Copyright (C) IBM Corporation, 2010-2012
18 * Author: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
19 */
20
21#include <linux/module.h>
22#include <linux/uaccess.h>
23#include <linux/uprobes.h>
24#include <linux/namei.h>
b2e902f0 25#include <linux/string.h>
f3f096cf
SD
26
27#include "trace_probe.h"
28
29#define UPROBE_EVENT_SYSTEM "uprobes"
30
31/*
32 * uprobe event core functions
33 */
34struct trace_uprobe;
35struct uprobe_trace_consumer {
36 struct uprobe_consumer cons;
37 struct trace_uprobe *tu;
38};
39
40struct trace_uprobe {
41 struct list_head list;
42 struct ftrace_event_class class;
43 struct ftrace_event_call call;
44 struct uprobe_trace_consumer *consumer;
45 struct inode *inode;
46 char *filename;
47 unsigned long offset;
48 unsigned long nhit;
49 unsigned int flags; /* For TP_FLAG_* */
50 ssize_t size; /* trace entry size */
51 unsigned int nr_args;
52 struct probe_arg args[];
53};
54
55#define SIZEOF_TRACE_UPROBE(n) \
56 (offsetof(struct trace_uprobe, args) + \
57 (sizeof(struct probe_arg) * (n)))
58
59static int register_uprobe_event(struct trace_uprobe *tu);
60static void unregister_uprobe_event(struct trace_uprobe *tu);
61
62static DEFINE_MUTEX(uprobe_lock);
63static LIST_HEAD(uprobe_list);
64
65static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs);
66
67/*
68 * Allocate new trace_uprobe and initialize it (including uprobes).
69 */
70static struct trace_uprobe *
71alloc_trace_uprobe(const char *group, const char *event, int nargs)
72{
73 struct trace_uprobe *tu;
74
75 if (!event || !is_good_name(event))
76 return ERR_PTR(-EINVAL);
77
78 if (!group || !is_good_name(group))
79 return ERR_PTR(-EINVAL);
80
81 tu = kzalloc(SIZEOF_TRACE_UPROBE(nargs), GFP_KERNEL);
82 if (!tu)
83 return ERR_PTR(-ENOMEM);
84
85 tu->call.class = &tu->class;
86 tu->call.name = kstrdup(event, GFP_KERNEL);
87 if (!tu->call.name)
88 goto error;
89
90 tu->class.system = kstrdup(group, GFP_KERNEL);
91 if (!tu->class.system)
92 goto error;
93
94 INIT_LIST_HEAD(&tu->list);
95 return tu;
96
97error:
98 kfree(tu->call.name);
99 kfree(tu);
100
101 return ERR_PTR(-ENOMEM);
102}
103
104static void free_trace_uprobe(struct trace_uprobe *tu)
105{
106 int i;
107
108 for (i = 0; i < tu->nr_args; i++)
109 traceprobe_free_probe_arg(&tu->args[i]);
110
111 iput(tu->inode);
112 kfree(tu->call.class->system);
113 kfree(tu->call.name);
114 kfree(tu->filename);
115 kfree(tu);
116}
117
118static struct trace_uprobe *find_probe_event(const char *event, const char *group)
119{
120 struct trace_uprobe *tu;
121
122 list_for_each_entry(tu, &uprobe_list, list)
123 if (strcmp(tu->call.name, event) == 0 &&
124 strcmp(tu->call.class->system, group) == 0)
125 return tu;
126
127 return NULL;
128}
129
130/* Unregister a trace_uprobe and probe_event: call with locking uprobe_lock */
131static void unregister_trace_uprobe(struct trace_uprobe *tu)
132{
133 list_del(&tu->list);
134 unregister_uprobe_event(tu);
135 free_trace_uprobe(tu);
136}
137
138/* Register a trace_uprobe and probe_event */
139static int register_trace_uprobe(struct trace_uprobe *tu)
140{
141 struct trace_uprobe *old_tp;
142 int ret;
143
144 mutex_lock(&uprobe_lock);
145
146 /* register as an event */
147 old_tp = find_probe_event(tu->call.name, tu->call.class->system);
148 if (old_tp)
149 /* delete old event */
150 unregister_trace_uprobe(old_tp);
151
152 ret = register_uprobe_event(tu);
153 if (ret) {
154 pr_warning("Failed to register probe event(%d)\n", ret);
155 goto end;
156 }
157
158 list_add_tail(&tu->list, &uprobe_list);
159
160end:
161 mutex_unlock(&uprobe_lock);
162
163 return ret;
164}
165
166/*
167 * Argument syntax:
168 * - Add uprobe: p[:[GRP/]EVENT] PATH:SYMBOL[+offs] [FETCHARGS]
169 *
170 * - Remove uprobe: -:[GRP/]EVENT
171 */
172static int create_trace_uprobe(int argc, char **argv)
173{
174 struct trace_uprobe *tu;
175 struct inode *inode;
176 char *arg, *event, *group, *filename;
177 char buf[MAX_EVENT_NAME_LEN];
178 struct path path;
179 unsigned long offset;
180 bool is_delete;
181 int i, ret;
182
183 inode = NULL;
184 ret = 0;
185 is_delete = false;
186 event = NULL;
187 group = NULL;
188
189 /* argc must be >= 1 */
190 if (argv[0][0] == '-')
191 is_delete = true;
192 else if (argv[0][0] != 'p') {
0d13ac96 193 pr_info("Probe definition must be started with 'p' or '-'.\n");
f3f096cf
SD
194 return -EINVAL;
195 }
196
197 if (argv[0][1] == ':') {
198 event = &argv[0][2];
199 arg = strchr(event, '/');
200
201 if (arg) {
202 group = event;
203 event = arg + 1;
204 event[-1] = '\0';
205
206 if (strlen(group) == 0) {
207 pr_info("Group name is not specified\n");
208 return -EINVAL;
209 }
210 }
211 if (strlen(event) == 0) {
212 pr_info("Event name is not specified\n");
213 return -EINVAL;
214 }
215 }
216 if (!group)
217 group = UPROBE_EVENT_SYSTEM;
218
219 if (is_delete) {
220 if (!event) {
221 pr_info("Delete command needs an event name.\n");
222 return -EINVAL;
223 }
224 mutex_lock(&uprobe_lock);
225 tu = find_probe_event(event, group);
226
227 if (!tu) {
228 mutex_unlock(&uprobe_lock);
229 pr_info("Event %s/%s doesn't exist.\n", group, event);
230 return -ENOENT;
231 }
232 /* delete an event */
233 unregister_trace_uprobe(tu);
234 mutex_unlock(&uprobe_lock);
235 return 0;
236 }
237
238 if (argc < 2) {
239 pr_info("Probe point is not specified.\n");
240 return -EINVAL;
241 }
242 if (isdigit(argv[1][0])) {
243 pr_info("probe point must be have a filename.\n");
244 return -EINVAL;
245 }
246 arg = strchr(argv[1], ':');
247 if (!arg)
248 goto fail_address_parse;
249
250 *arg++ = '\0';
251 filename = argv[1];
252 ret = kern_path(filename, LOOKUP_FOLLOW, &path);
253 if (ret)
254 goto fail_address_parse;
255
bcd83ea6 256 ret = kstrtoul(arg, 0, &offset);
f3f096cf
SD
257 if (ret)
258 goto fail_address_parse;
259
260 inode = igrab(path.dentry->d_inode);
d24d7dbf
JZ
261 if (!S_ISREG(inode->i_mode)) {
262 ret = -EINVAL;
263 goto fail_address_parse;
264 }
f3f096cf
SD
265
266 argc -= 2;
267 argv += 2;
268
269 /* setup a probe */
270 if (!event) {
b2e902f0 271 char *tail;
f3f096cf
SD
272 char *ptr;
273
b2e902f0
AS
274 tail = kstrdup(kbasename(filename), GFP_KERNEL);
275 if (!tail) {
f3f096cf
SD
276 ret = -ENOMEM;
277 goto fail_address_parse;
278 }
279
f3f096cf
SD
280 ptr = strpbrk(tail, ".-_");
281 if (ptr)
282 *ptr = '\0';
283
284 snprintf(buf, MAX_EVENT_NAME_LEN, "%c_%s_0x%lx", 'p', tail, offset);
285 event = buf;
286 kfree(tail);
287 }
288
289 tu = alloc_trace_uprobe(group, event, argc);
290 if (IS_ERR(tu)) {
291 pr_info("Failed to allocate trace_uprobe.(%d)\n", (int)PTR_ERR(tu));
292 ret = PTR_ERR(tu);
293 goto fail_address_parse;
294 }
295 tu->offset = offset;
296 tu->inode = inode;
297 tu->filename = kstrdup(filename, GFP_KERNEL);
298
299 if (!tu->filename) {
300 pr_info("Failed to allocate filename.\n");
301 ret = -ENOMEM;
302 goto error;
303 }
304
305 /* parse arguments */
306 ret = 0;
307 for (i = 0; i < argc && i < MAX_TRACE_ARGS; i++) {
308 /* Increment count for freeing args in error case */
309 tu->nr_args++;
310
311 /* Parse argument name */
312 arg = strchr(argv[i], '=');
313 if (arg) {
314 *arg++ = '\0';
315 tu->args[i].name = kstrdup(argv[i], GFP_KERNEL);
316 } else {
317 arg = argv[i];
318 /* If argument name is omitted, set "argN" */
319 snprintf(buf, MAX_EVENT_NAME_LEN, "arg%d", i + 1);
320 tu->args[i].name = kstrdup(buf, GFP_KERNEL);
321 }
322
323 if (!tu->args[i].name) {
324 pr_info("Failed to allocate argument[%d] name.\n", i);
325 ret = -ENOMEM;
326 goto error;
327 }
328
329 if (!is_good_name(tu->args[i].name)) {
330 pr_info("Invalid argument[%d] name: %s\n", i, tu->args[i].name);
331 ret = -EINVAL;
332 goto error;
333 }
334
335 if (traceprobe_conflict_field_name(tu->args[i].name, tu->args, i)) {
336 pr_info("Argument[%d] name '%s' conflicts with "
337 "another field.\n", i, argv[i]);
338 ret = -EINVAL;
339 goto error;
340 }
341
342 /* Parse fetch argument */
343 ret = traceprobe_parse_probe_arg(arg, &tu->size, &tu->args[i], false, false);
344 if (ret) {
345 pr_info("Parse error at argument[%d]. (%d)\n", i, ret);
346 goto error;
347 }
348 }
349
350 ret = register_trace_uprobe(tu);
351 if (ret)
352 goto error;
353 return 0;
354
355error:
356 free_trace_uprobe(tu);
357 return ret;
358
359fail_address_parse:
360 if (inode)
361 iput(inode);
362
d24d7dbf 363 pr_info("Failed to parse address or file.\n");
f3f096cf
SD
364
365 return ret;
366}
367
368static void cleanup_all_probes(void)
369{
370 struct trace_uprobe *tu;
371
372 mutex_lock(&uprobe_lock);
373 while (!list_empty(&uprobe_list)) {
374 tu = list_entry(uprobe_list.next, struct trace_uprobe, list);
375 unregister_trace_uprobe(tu);
376 }
377 mutex_unlock(&uprobe_lock);
378}
379
380/* Probes listing interfaces */
381static void *probes_seq_start(struct seq_file *m, loff_t *pos)
382{
383 mutex_lock(&uprobe_lock);
384 return seq_list_start(&uprobe_list, *pos);
385}
386
387static void *probes_seq_next(struct seq_file *m, void *v, loff_t *pos)
388{
389 return seq_list_next(v, &uprobe_list, pos);
390}
391
392static void probes_seq_stop(struct seq_file *m, void *v)
393{
394 mutex_unlock(&uprobe_lock);
395}
396
397static int probes_seq_show(struct seq_file *m, void *v)
398{
399 struct trace_uprobe *tu = v;
400 int i;
401
402 seq_printf(m, "p:%s/%s", tu->call.class->system, tu->call.name);
403 seq_printf(m, " %s:0x%p", tu->filename, (void *)tu->offset);
404
405 for (i = 0; i < tu->nr_args; i++)
406 seq_printf(m, " %s=%s", tu->args[i].name, tu->args[i].comm);
407
408 seq_printf(m, "\n");
409 return 0;
410}
411
412static const struct seq_operations probes_seq_op = {
413 .start = probes_seq_start,
414 .next = probes_seq_next,
415 .stop = probes_seq_stop,
416 .show = probes_seq_show
417};
418
419static int probes_open(struct inode *inode, struct file *file)
420{
421 if ((file->f_mode & FMODE_WRITE) && (file->f_flags & O_TRUNC))
422 cleanup_all_probes();
423
424 return seq_open(file, &probes_seq_op);
425}
426
427static ssize_t probes_write(struct file *file, const char __user *buffer,
428 size_t count, loff_t *ppos)
429{
430 return traceprobe_probes_write(file, buffer, count, ppos, create_trace_uprobe);
431}
432
433static const struct file_operations uprobe_events_ops = {
434 .owner = THIS_MODULE,
435 .open = probes_open,
436 .read = seq_read,
437 .llseek = seq_lseek,
438 .release = seq_release,
439 .write = probes_write,
440};
441
442/* Probes profiling interfaces */
443static int probes_profile_seq_show(struct seq_file *m, void *v)
444{
445 struct trace_uprobe *tu = v;
446
447 seq_printf(m, " %s %-44s %15lu\n", tu->filename, tu->call.name, tu->nhit);
448 return 0;
449}
450
451static const struct seq_operations profile_seq_op = {
452 .start = probes_seq_start,
453 .next = probes_seq_next,
454 .stop = probes_seq_stop,
455 .show = probes_profile_seq_show
456};
457
458static int profile_open(struct inode *inode, struct file *file)
459{
460 return seq_open(file, &profile_seq_op);
461}
462
463static const struct file_operations uprobe_profile_ops = {
464 .owner = THIS_MODULE,
465 .open = profile_open,
466 .read = seq_read,
467 .llseek = seq_lseek,
468 .release = seq_release,
469};
470
471/* uprobe handler */
472static void uprobe_trace_func(struct trace_uprobe *tu, struct pt_regs *regs)
473{
474 struct uprobe_trace_entry_head *entry;
475 struct ring_buffer_event *event;
476 struct ring_buffer *buffer;
477 u8 *data;
478 int size, i, pc;
479 unsigned long irq_flags;
480 struct ftrace_event_call *call = &tu->call;
481
482 tu->nhit++;
483
484 local_save_flags(irq_flags);
485 pc = preempt_count();
486
487 size = sizeof(*entry) + tu->size;
488
489 event = trace_current_buffer_lock_reserve(&buffer, call->event.type,
490 size, irq_flags, pc);
491 if (!event)
492 return;
493
494 entry = ring_buffer_event_data(event);
74e59dfc 495 entry->ip = instruction_pointer(task_pt_regs(current));
f3f096cf
SD
496 data = (u8 *)&entry[1];
497 for (i = 0; i < tu->nr_args; i++)
498 call_fetch(&tu->args[i].fetch, regs, data + tu->args[i].offset);
499
500 if (!filter_current_check_discard(buffer, call, entry, event))
501 trace_buffer_unlock_commit(buffer, event, irq_flags, pc);
502}
503
504/* Event entry printers */
505static enum print_line_t
506print_uprobe_event(struct trace_iterator *iter, int flags, struct trace_event *event)
507{
508 struct uprobe_trace_entry_head *field;
509 struct trace_seq *s = &iter->seq;
510 struct trace_uprobe *tu;
511 u8 *data;
512 int i;
513
514 field = (struct uprobe_trace_entry_head *)iter->ent;
515 tu = container_of(event, struct trace_uprobe, call.event);
516
517 if (!trace_seq_printf(s, "%s: (", tu->call.name))
518 goto partial;
519
520 if (!seq_print_ip_sym(s, field->ip, flags | TRACE_ITER_SYM_OFFSET))
521 goto partial;
522
523 if (!trace_seq_puts(s, ")"))
524 goto partial;
525
526 data = (u8 *)&field[1];
527 for (i = 0; i < tu->nr_args; i++) {
528 if (!tu->args[i].type->print(s, tu->args[i].name,
529 data + tu->args[i].offset, field))
530 goto partial;
531 }
532
533 if (trace_seq_puts(s, "\n"))
534 return TRACE_TYPE_HANDLED;
535
536partial:
537 return TRACE_TYPE_PARTIAL_LINE;
538}
539
540static int probe_event_enable(struct trace_uprobe *tu, int flag)
541{
542 struct uprobe_trace_consumer *utc;
543 int ret = 0;
544
545 if (!tu->inode || tu->consumer)
546 return -EINTR;
547
548 utc = kzalloc(sizeof(struct uprobe_trace_consumer), GFP_KERNEL);
549 if (!utc)
550 return -EINTR;
551
552 utc->cons.handler = uprobe_dispatcher;
f3f096cf
SD
553 ret = uprobe_register(tu->inode, tu->offset, &utc->cons);
554 if (ret) {
555 kfree(utc);
556 return ret;
557 }
558
559 tu->flags |= flag;
560 utc->tu = tu;
561 tu->consumer = utc;
562
563 return 0;
564}
565
566static void probe_event_disable(struct trace_uprobe *tu, int flag)
567{
568 if (!tu->inode || !tu->consumer)
569 return;
570
571 uprobe_unregister(tu->inode, tu->offset, &tu->consumer->cons);
572 tu->flags &= ~flag;
573 kfree(tu->consumer);
574 tu->consumer = NULL;
575}
576
577static int uprobe_event_define_fields(struct ftrace_event_call *event_call)
578{
579 int ret, i;
580 struct uprobe_trace_entry_head field;
581 struct trace_uprobe *tu = (struct trace_uprobe *)event_call->data;
582
583 DEFINE_FIELD(unsigned long, ip, FIELD_STRING_IP, 0);
584 /* Set argument names as fields */
585 for (i = 0; i < tu->nr_args; i++) {
586 ret = trace_define_field(event_call, tu->args[i].type->fmttype,
587 tu->args[i].name,
588 sizeof(field) + tu->args[i].offset,
589 tu->args[i].type->size,
590 tu->args[i].type->is_signed,
591 FILTER_OTHER);
592
593 if (ret)
594 return ret;
595 }
596 return 0;
597}
598
599#define LEN_OR_ZERO (len ? len - pos : 0)
600static int __set_print_fmt(struct trace_uprobe *tu, char *buf, int len)
601{
602 const char *fmt, *arg;
603 int i;
604 int pos = 0;
605
606 fmt = "(%lx)";
607 arg = "REC->" FIELD_STRING_IP;
608
609 /* When len=0, we just calculate the needed length */
610
611 pos += snprintf(buf + pos, LEN_OR_ZERO, "\"%s", fmt);
612
613 for (i = 0; i < tu->nr_args; i++) {
614 pos += snprintf(buf + pos, LEN_OR_ZERO, " %s=%s",
615 tu->args[i].name, tu->args[i].type->fmt);
616 }
617
618 pos += snprintf(buf + pos, LEN_OR_ZERO, "\", %s", arg);
619
620 for (i = 0; i < tu->nr_args; i++) {
621 pos += snprintf(buf + pos, LEN_OR_ZERO, ", REC->%s",
622 tu->args[i].name);
623 }
624
625 return pos; /* return the length of print_fmt */
626}
627#undef LEN_OR_ZERO
628
629static int set_print_fmt(struct trace_uprobe *tu)
630{
631 char *print_fmt;
632 int len;
633
634 /* First: called with 0 length to calculate the needed length */
635 len = __set_print_fmt(tu, NULL, 0);
636 print_fmt = kmalloc(len + 1, GFP_KERNEL);
637 if (!print_fmt)
638 return -ENOMEM;
639
640 /* Second: actually write the @print_fmt */
641 __set_print_fmt(tu, print_fmt, len + 1);
642 tu->call.print_fmt = print_fmt;
643
644 return 0;
645}
646
647#ifdef CONFIG_PERF_EVENTS
648/* uprobe profile handler */
649static void uprobe_perf_func(struct trace_uprobe *tu, struct pt_regs *regs)
650{
651 struct ftrace_event_call *call = &tu->call;
652 struct uprobe_trace_entry_head *entry;
653 struct hlist_head *head;
654 u8 *data;
655 int size, __size, i;
656 int rctx;
657
658 __size = sizeof(*entry) + tu->size;
659 size = ALIGN(__size + sizeof(u32), sizeof(u64));
660 size -= sizeof(u32);
661 if (WARN_ONCE(size > PERF_MAX_TRACE_SIZE, "profile buffer not large enough"))
662 return;
663
664 preempt_disable();
665
666 entry = perf_trace_buf_prepare(size, call->event.type, regs, &rctx);
667 if (!entry)
668 goto out;
669
74e59dfc 670 entry->ip = instruction_pointer(task_pt_regs(current));
f3f096cf
SD
671 data = (u8 *)&entry[1];
672 for (i = 0; i < tu->nr_args; i++)
673 call_fetch(&tu->args[i].fetch, regs, data + tu->args[i].offset);
674
675 head = this_cpu_ptr(call->perf_events);
e6dab5ff 676 perf_trace_buf_submit(entry, size, rctx, entry->ip, 1, regs, head, NULL);
f3f096cf
SD
677
678 out:
679 preempt_enable();
680}
681#endif /* CONFIG_PERF_EVENTS */
682
683static
684int trace_uprobe_register(struct ftrace_event_call *event, enum trace_reg type, void *data)
685{
686 struct trace_uprobe *tu = (struct trace_uprobe *)event->data;
687
688 switch (type) {
689 case TRACE_REG_REGISTER:
690 return probe_event_enable(tu, TP_FLAG_TRACE);
691
692 case TRACE_REG_UNREGISTER:
693 probe_event_disable(tu, TP_FLAG_TRACE);
694 return 0;
695
696#ifdef CONFIG_PERF_EVENTS
697 case TRACE_REG_PERF_REGISTER:
698 return probe_event_enable(tu, TP_FLAG_PROFILE);
699
700 case TRACE_REG_PERF_UNREGISTER:
701 probe_event_disable(tu, TP_FLAG_PROFILE);
702 return 0;
703#endif
704 default:
705 return 0;
706 }
707 return 0;
708}
709
710static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs)
711{
712 struct uprobe_trace_consumer *utc;
713 struct trace_uprobe *tu;
714
715 utc = container_of(con, struct uprobe_trace_consumer, cons);
716 tu = utc->tu;
717 if (!tu || tu->consumer != utc)
718 return 0;
719
720 if (tu->flags & TP_FLAG_TRACE)
721 uprobe_trace_func(tu, regs);
722
723#ifdef CONFIG_PERF_EVENTS
724 if (tu->flags & TP_FLAG_PROFILE)
725 uprobe_perf_func(tu, regs);
726#endif
727 return 0;
728}
729
730static struct trace_event_functions uprobe_funcs = {
731 .trace = print_uprobe_event
732};
733
734static int register_uprobe_event(struct trace_uprobe *tu)
735{
736 struct ftrace_event_call *call = &tu->call;
737 int ret;
738
739 /* Initialize ftrace_event_call */
740 INIT_LIST_HEAD(&call->class->fields);
741 call->event.funcs = &uprobe_funcs;
742 call->class->define_fields = uprobe_event_define_fields;
743
744 if (set_print_fmt(tu) < 0)
745 return -ENOMEM;
746
747 ret = register_ftrace_event(&call->event);
748 if (!ret) {
749 kfree(call->print_fmt);
750 return -ENODEV;
751 }
752 call->flags = 0;
753 call->class->reg = trace_uprobe_register;
754 call->data = tu;
755 ret = trace_add_event_call(call);
756
757 if (ret) {
758 pr_info("Failed to register uprobe event: %s\n", call->name);
759 kfree(call->print_fmt);
760 unregister_ftrace_event(&call->event);
761 }
762
763 return ret;
764}
765
766static void unregister_uprobe_event(struct trace_uprobe *tu)
767{
768 /* tu->event is unregistered in trace_remove_event_call() */
769 trace_remove_event_call(&tu->call);
770 kfree(tu->call.print_fmt);
771 tu->call.print_fmt = NULL;
772}
773
774/* Make a trace interface for controling probe points */
775static __init int init_uprobe_trace(void)
776{
777 struct dentry *d_tracer;
778
779 d_tracer = tracing_init_dentry();
780 if (!d_tracer)
781 return 0;
782
783 trace_create_file("uprobe_events", 0644, d_tracer,
784 NULL, &uprobe_events_ops);
785 /* Profile interface */
786 trace_create_file("uprobe_profile", 0444, d_tracer,
787 NULL, &uprobe_profile_ops);
788 return 0;
789}
790
791fs_initcall(init_uprobe_trace);
This page took 0.078755 seconds and 5 git commands to generate.