probe-file.c (2a267e7c41aa88215de2b542de797d03d16ecdfd) probe-file.c (1e032f7cfa141b4424827b0ecb0ea899f84e182e)
1/*
2 * probe-file.c : operate ftrace k/uprobe events files
3 *
4 * Written by Masami Hiramatsu <masami.hiramatsu.pt@hitachi.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

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

1010
1011 return 0;
1012}
1013
1014enum ftrace_readme {
1015 FTRACE_README_PROBE_TYPE_X = 0,
1016 FTRACE_README_KRETPROBE_OFFSET,
1017 FTRACE_README_UPROBE_REF_CTR,
1/*
2 * probe-file.c : operate ftrace k/uprobe events files
3 *
4 * Written by Masami Hiramatsu <masami.hiramatsu.pt@hitachi.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

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

1010
1011 return 0;
1012}
1013
1014enum ftrace_readme {
1015 FTRACE_README_PROBE_TYPE_X = 0,
1016 FTRACE_README_KRETPROBE_OFFSET,
1017 FTRACE_README_UPROBE_REF_CTR,
1018 FTRACE_README_USER_ACCESS,
1018 FTRACE_README_END,
1019};
1020
1021static struct {
1022 const char *pattern;
1023 bool avail;
1024} ftrace_readme_table[] = {
1025#define DEFINE_TYPE(idx, pat) \
1026 [idx] = {.pattern = pat, .avail = false}
1027 DEFINE_TYPE(FTRACE_README_PROBE_TYPE_X, "*type: * x8/16/32/64,*"),
1028 DEFINE_TYPE(FTRACE_README_KRETPROBE_OFFSET, "*place (kretprobe): *"),
1029 DEFINE_TYPE(FTRACE_README_UPROBE_REF_CTR, "*ref_ctr_offset*"),
1019 FTRACE_README_END,
1020};
1021
1022static struct {
1023 const char *pattern;
1024 bool avail;
1025} ftrace_readme_table[] = {
1026#define DEFINE_TYPE(idx, pat) \
1027 [idx] = {.pattern = pat, .avail = false}
1028 DEFINE_TYPE(FTRACE_README_PROBE_TYPE_X, "*type: * x8/16/32/64,*"),
1029 DEFINE_TYPE(FTRACE_README_KRETPROBE_OFFSET, "*place (kretprobe): *"),
1030 DEFINE_TYPE(FTRACE_README_UPROBE_REF_CTR, "*ref_ctr_offset*"),
1031 DEFINE_TYPE(FTRACE_README_USER_ACCESS, "*[u]<offset>*"),
1030};
1031
1032static bool scan_ftrace_readme(enum ftrace_readme type)
1033{
1034 int fd;
1035 FILE *fp;
1036 char *buf = NULL;
1037 size_t len = 0;

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

1082{
1083 return scan_ftrace_readme(FTRACE_README_KRETPROBE_OFFSET);
1084}
1085
1086bool uprobe_ref_ctr_is_supported(void)
1087{
1088 return scan_ftrace_readme(FTRACE_README_UPROBE_REF_CTR);
1089}
1032};
1033
1034static bool scan_ftrace_readme(enum ftrace_readme type)
1035{
1036 int fd;
1037 FILE *fp;
1038 char *buf = NULL;
1039 size_t len = 0;

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

1084{
1085 return scan_ftrace_readme(FTRACE_README_KRETPROBE_OFFSET);
1086}
1087
1088bool uprobe_ref_ctr_is_supported(void)
1089{
1090 return scan_ftrace_readme(FTRACE_README_UPROBE_REF_CTR);
1091}
1092
1093bool user_access_is_supported(void)
1094{
1095 return scan_ftrace_readme(FTRACE_README_USER_ACCESS);
1096}