Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

usdt.h 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright (c) 2012, Chris Andrews. All rights reserved.
  3. */
  4. #include <stdint.h>
  5. #include <unistd.h>
  6. #define USDT_ARG_MAX 32
  7. typedef enum usdt_error {
  8. USDT_ERROR_MALLOC = 0,
  9. USDT_ERROR_VALLOC,
  10. USDT_ERROR_NOPROBES,
  11. USDT_ERROR_LOADDOF,
  12. USDT_ERROR_ALREADYENABLED,
  13. USDT_ERROR_UNLOADDOF,
  14. USDT_ERROR_DUP_PROBE,
  15. USDT_ERROR_REMOVE_PROBE
  16. } usdt_error_t;
  17. typedef struct usdt_probe {
  18. int (*isenabled_addr)(void);
  19. void *probe_addr;
  20. } usdt_probe_t;
  21. int usdt_is_enabled(usdt_probe_t *probe);
  22. void usdt_fire_probe(usdt_probe_t *probe, size_t argc, void **argv);
  23. typedef struct usdt_probedef {
  24. const char *name;
  25. const char *function;
  26. size_t argc;
  27. char *types[USDT_ARG_MAX];
  28. struct usdt_probe *probe;
  29. struct usdt_probedef *next;
  30. int refcnt;
  31. } usdt_probedef_t;
  32. usdt_probedef_t *usdt_create_probe(const char *func, const char *name,
  33. size_t argc, const char **types);
  34. void usdt_probe_release(usdt_probedef_t *probedef);
  35. typedef struct usdt_provider {
  36. const char *name;
  37. const char *module;
  38. usdt_probedef_t *probedefs;
  39. char *error;
  40. int enabled;
  41. void *file;
  42. } usdt_provider_t;
  43. usdt_provider_t *usdt_create_provider(const char *name, const char *module);
  44. int usdt_provider_add_probe(usdt_provider_t *provider, usdt_probedef_t *probedef);
  45. int usdt_provider_remove_probe(usdt_provider_t *provider, usdt_probedef_t *probedef);
  46. int usdt_provider_enable(usdt_provider_t *provider);
  47. int usdt_provider_disable(usdt_provider_t *provider);
  48. void usdt_provider_free(usdt_provider_t *provider);
  49. void usdt_error(usdt_provider_t *provider, usdt_error_t error, ...);
  50. char *usdt_errstr(usdt_provider_t *provider);