probe-event.c (02b95dadc8a1d2c302513e5fa24c492380d26e93) probe-event.c (7ca5989dd065cbc48a958666c273794686ea7525)
1/*
2 * probe-event.c : perf-probe definition to kprobe_events format converter
3 *
4 * Written by Masami Hiramatsu <mhiramat@redhat.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 28 unchanged lines hidden (view full) ---

37#include "event.h"
38#include "string.h"
39#include "strlist.h"
40#include "debug.h"
41#include "cache.h"
42#include "color.h"
43#include "symbol.h"
44#include "thread.h"
1/*
2 * probe-event.c : perf-probe definition to kprobe_events format converter
3 *
4 * Written by Masami Hiramatsu <mhiramat@redhat.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 28 unchanged lines hidden (view full) ---

37#include "event.h"
38#include "string.h"
39#include "strlist.h"
40#include "debug.h"
41#include "cache.h"
42#include "color.h"
43#include "symbol.h"
44#include "thread.h"
45#include "debugfs.h"
45#include "trace-event.h" /* For __unused */
46#include "trace-event.h" /* For __unused */
46#include "parse-events.h" /* For debugfs_path */
47#include "probe-event.h"
48#include "probe-finder.h"
49
50#define MAX_CMDLEN 256
51#define MAX_PROBE_ARGS 128
52#define PERFPROBE_GROUP "probe"
53
54bool probe_event_dry_run; /* Dry run flag */

--- 1015 unchanged lines hidden (view full) ---

1070 if (tev->args)
1071 free(tev->args);
1072 memset(tev, 0, sizeof(*tev));
1073}
1074
1075static int open_kprobe_events(bool readwrite)
1076{
1077 char buf[PATH_MAX];
47#include "probe-event.h"
48#include "probe-finder.h"
49
50#define MAX_CMDLEN 256
51#define MAX_PROBE_ARGS 128
52#define PERFPROBE_GROUP "probe"
53
54bool probe_event_dry_run; /* Dry run flag */

--- 1015 unchanged lines hidden (view full) ---

1070 if (tev->args)
1071 free(tev->args);
1072 memset(tev, 0, sizeof(*tev));
1073}
1074
1075static int open_kprobe_events(bool readwrite)
1076{
1077 char buf[PATH_MAX];
1078 const char *__debugfs;
1078 int ret;
1079
1079 int ret;
1080
1080 ret = e_snprintf(buf, PATH_MAX, "%s/../kprobe_events", debugfs_path);
1081 __debugfs = debugfs_find_mountpoint();
1082 if (__debugfs == NULL) {
1083 pr_warning("Debugfs is not mounted.\n");
1084 return -ENOENT;
1085 }
1086
1087 ret = e_snprintf(buf, PATH_MAX, "%stracing/kprobe_events", __debugfs);
1081 if (ret >= 0) {
1088 if (ret >= 0) {
1089 pr_debug("Opening %s write=%d\n", buf, readwrite);
1082 if (readwrite && !probe_event_dry_run)
1083 ret = open(buf, O_RDWR, O_APPEND);
1084 else
1085 ret = open(buf, O_RDONLY, 0);
1086 }
1087
1088 if (ret < 0) {
1089 if (errno == ENOENT)

--- 531 unchanged lines hidden ---
1090 if (readwrite && !probe_event_dry_run)
1091 ret = open(buf, O_RDWR, O_APPEND);
1092 else
1093 ret = open(buf, O_RDONLY, 0);
1094 }
1095
1096 if (ret < 0) {
1097 if (errno == ENOENT)

--- 531 unchanged lines hidden ---