probe-file.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __PROBE_FILE_H
  3. #define __PROBE_FILE_H
  4. #include "probe-event.h"
  5. struct strlist;
  6. struct strfilter;
  7. /* Cache of probe definitions */
  8. struct probe_cache_entry {
  9. struct list_head node;
  10. bool sdt;
  11. struct perf_probe_event pev;
  12. char *spev;
  13. struct strlist *tevlist;
  14. };
  15. struct probe_cache {
  16. int fd;
  17. struct list_head entries;
  18. };
  19. enum probe_type {
  20. PROBE_TYPE_U = 0,
  21. PROBE_TYPE_S,
  22. PROBE_TYPE_X,
  23. PROBE_TYPE_STRING,
  24. PROBE_TYPE_BITFIELD,
  25. PROBE_TYPE_END,
  26. };
  27. #define PF_FL_UPROBE 1
  28. #define PF_FL_RW 2
  29. #define for_each_probe_cache_entry(entry, pcache) \
  30. list_for_each_entry(entry, &pcache->entries, node)
  31. /* probe-file.c depends on libelf */
  32. #ifdef HAVE_LIBELF_SUPPORT
  33. int open_trace_file(const char *trace_file, bool readwrite);
  34. int probe_file__open(int flag);
  35. int probe_file__open_both(int *kfd, int *ufd, int flag);
  36. struct strlist *probe_file__get_namelist(int fd);
  37. struct strlist *probe_file__get_rawlist(int fd);
  38. int probe_file__add_event(int fd, struct probe_trace_event *tev);
  39. int probe_file__del_events(int fd, struct strfilter *filter);
  40. int probe_file__get_events(int fd, struct strfilter *filter,
  41. struct strlist *plist);
  42. int probe_file__del_strlist(int fd, struct strlist *namelist);
  43. int probe_cache_entry__get_event(struct probe_cache_entry *entry,
  44. struct probe_trace_event **tevs);
  45. struct probe_cache *probe_cache__new(const char *target, struct nsinfo *nsi);
  46. int probe_cache__add_entry(struct probe_cache *pcache,
  47. struct perf_probe_event *pev,
  48. struct probe_trace_event *tevs, int ntevs);
  49. int probe_cache__scan_sdt(struct probe_cache *pcache, const char *pathname);
  50. int probe_cache__commit(struct probe_cache *pcache);
  51. void probe_cache__purge(struct probe_cache *pcache);
  52. void probe_cache__delete(struct probe_cache *pcache);
  53. int probe_cache__filter_purge(struct probe_cache *pcache,
  54. struct strfilter *filter);
  55. struct probe_cache_entry *probe_cache__find(struct probe_cache *pcache,
  56. struct perf_probe_event *pev);
  57. struct probe_cache_entry *probe_cache__find_by_name(struct probe_cache *pcache,
  58. const char *group, const char *event);
  59. int probe_cache__show_all_caches(struct strfilter *filter);
  60. bool probe_type_is_available(enum probe_type type);
  61. bool kretprobe_offset_is_supported(void);
  62. bool uprobe_ref_ctr_is_supported(void);
  63. bool user_access_is_supported(void);
  64. bool multiprobe_event_is_supported(void);
  65. bool immediate_value_is_supported(void);
  66. #else /* ! HAVE_LIBELF_SUPPORT */
  67. static inline struct probe_cache *probe_cache__new(const char *tgt __maybe_unused, struct nsinfo *nsi __maybe_unused)
  68. {
  69. return NULL;
  70. }
  71. #define probe_cache__delete(pcache) do {} while (0)
  72. #endif
  73. #endif