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