Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __PROBE_FILE_H
0003 #define __PROBE_FILE_H
0004 
0005 #include "probe-event.h"
0006 
0007 struct strlist;
0008 struct strfilter;
0009 
0010 /* Cache of probe definitions */
0011 struct probe_cache_entry {
0012     struct list_head    node;
0013     bool            sdt;
0014     struct perf_probe_event pev;
0015     char            *spev;
0016     struct strlist      *tevlist;
0017 };
0018 
0019 struct probe_cache {
0020     int fd;
0021     struct list_head entries;
0022 };
0023 
0024 enum probe_type {
0025     PROBE_TYPE_U = 0,
0026     PROBE_TYPE_S,
0027     PROBE_TYPE_X,
0028     PROBE_TYPE_STRING,
0029     PROBE_TYPE_BITFIELD,
0030     PROBE_TYPE_END,
0031 };
0032 
0033 #define PF_FL_UPROBE    1
0034 #define PF_FL_RW    2
0035 #define for_each_probe_cache_entry(entry, pcache) \
0036     list_for_each_entry(entry, &pcache->entries, node)
0037 
0038 /* probe-file.c depends on libelf */
0039 #ifdef HAVE_LIBELF_SUPPORT
0040 int open_trace_file(const char *trace_file, bool readwrite);
0041 int probe_file__open(int flag);
0042 int probe_file__open_both(int *kfd, int *ufd, int flag);
0043 struct strlist *probe_file__get_namelist(int fd);
0044 struct strlist *probe_file__get_rawlist(int fd);
0045 int probe_file__add_event(int fd, struct probe_trace_event *tev);
0046 
0047 int probe_file__del_events(int fd, struct strfilter *filter);
0048 int probe_file__get_events(int fd, struct strfilter *filter,
0049                   struct strlist *plist);
0050 int probe_file__del_strlist(int fd, struct strlist *namelist);
0051 
0052 int probe_cache_entry__get_event(struct probe_cache_entry *entry,
0053                  struct probe_trace_event **tevs);
0054 
0055 struct probe_cache *probe_cache__new(const char *target, struct nsinfo *nsi);
0056 int probe_cache__add_entry(struct probe_cache *pcache,
0057                struct perf_probe_event *pev,
0058                struct probe_trace_event *tevs, int ntevs);
0059 int probe_cache__scan_sdt(struct probe_cache *pcache, const char *pathname);
0060 int probe_cache__commit(struct probe_cache *pcache);
0061 void probe_cache__purge(struct probe_cache *pcache);
0062 void probe_cache__delete(struct probe_cache *pcache);
0063 int probe_cache__filter_purge(struct probe_cache *pcache,
0064                   struct strfilter *filter);
0065 struct probe_cache_entry *probe_cache__find(struct probe_cache *pcache,
0066                         struct perf_probe_event *pev);
0067 struct probe_cache_entry *probe_cache__find_by_name(struct probe_cache *pcache,
0068                     const char *group, const char *event);
0069 int probe_cache__show_all_caches(struct strfilter *filter);
0070 bool probe_type_is_available(enum probe_type type);
0071 bool kretprobe_offset_is_supported(void);
0072 bool uprobe_ref_ctr_is_supported(void);
0073 bool user_access_is_supported(void);
0074 bool multiprobe_event_is_supported(void);
0075 bool immediate_value_is_supported(void);
0076 #else   /* ! HAVE_LIBELF_SUPPORT */
0077 static inline struct probe_cache *probe_cache__new(const char *tgt __maybe_unused, struct nsinfo *nsi __maybe_unused)
0078 {
0079     return NULL;
0080 }
0081 #define probe_cache__delete(pcache) do {} while (0)
0082 #endif
0083 #endif