Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 72 lines (63 sloc) 2.242 kb
068b733 @ry Land Cantrill's DTrace patch
ry authored
1 /*
2 * This is the DTrace library file for the node provider, which includes
3 * the necessary translators to get from the args[] to something useful.
4 * Be warned: the mechanics here are seriously ugly -- and one must always
5 * keep in mind that clean abstractions often require filthy systems.
6 */
7 #pragma D depends_on library procfs.d
8
9 typedef struct {
10 int32_t fd;
11 int32_t port;
12 uint32_t remote;
e9257b8 @ry New DTrace probes from CA team
ry authored
13 uint32_t buffered;
068b733 @ry Land Cantrill's DTrace patch
ry authored
14 } node_dtrace_connection_t;
15
16 typedef struct {
17 int32_t fd;
18 int32_t port;
19 uint64_t remote;
e9257b8 @ry New DTrace probes from CA team
ry authored
20 uint32_t buffered;
068b733 @ry Land Cantrill's DTrace patch
ry authored
21 } node_dtrace_connection64_t;
22
23 typedef struct {
24 int fd;
25 string remoteAddress;
26 int remotePort;
e9257b8 @ry New DTrace probes from CA team
ry authored
27 int bufferSize;
068b733 @ry Land Cantrill's DTrace patch
ry authored
28 } node_connection_t;
29
30 translator node_connection_t <node_dtrace_connection_t *nc> {
31 fd = *(int32_t *)copyin((uintptr_t)&nc->fd, sizeof (int32_t));
32 remotePort =
33 *(int32_t *)copyin((uintptr_t)&nc->port, sizeof (int32_t));
34 remoteAddress = curpsinfo->pr_dmodel == PR_MODEL_ILP32 ?
35 copyinstr((uintptr_t)*(uint32_t *)copyin((uintptr_t)&nc->remote,
36 sizeof (int32_t))) :
37 copyinstr((uintptr_t)*(uint64_t *)copyin((uintptr_t)
38 &((node_dtrace_connection64_t *)nc)->remote, sizeof (int64_t)));
e9257b8 @ry New DTrace probes from CA team
ry authored
39 bufferSize = curpsinfo->pr_dmodel == PR_MODEL_ILP32 ?
40 *(uint32_t *)copyin((uintptr_t)&nc->buffered, sizeof (int32_t)) :
41 *(uint32_t *)copyin((uintptr_t)
42 &((node_dtrace_connection64_t *)nc)->buffered, sizeof (int32_t));
068b733 @ry Land Cantrill's DTrace patch
ry authored
43 };
44
45 typedef struct {
46 uint32_t url;
47 uint32_t method;
48 } node_dtrace_http_request_t;
49
50 typedef struct {
51 uint64_t url;
52 uint64_t method;
53 } node_dtrace_http_request64_t;
54
55 typedef struct {
56 string url;
57 string method;
58 } node_http_request_t;
59
60 translator node_http_request_t <node_dtrace_http_request_t *nd> {
61 url = curpsinfo->pr_dmodel == PR_MODEL_ILP32 ?
62 copyinstr((uintptr_t)*(uint32_t *)copyin((uintptr_t)&nd->url,
63 sizeof (int32_t))) :
64 copyinstr((uintptr_t)*(uint64_t *)copyin((uintptr_t)
65 &((node_dtrace_http_request64_t *)nd)->url, sizeof (int64_t)));
66 method = curpsinfo->pr_dmodel == PR_MODEL_ILP32 ?
67 copyinstr((uintptr_t)*(uint32_t *)copyin((uintptr_t)&nd->method,
68 sizeof (int32_t))) :
69 copyinstr((uintptr_t)*(uint64_t *)copyin((uintptr_t)
70 &((node_dtrace_http_request64_t *)nd)->method, sizeof (int64_t)));
71 };
Something went wrong with that request. Please try again.