Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 94 lines (84 sloc) 3.38 kb
55048cd @ry Update copyright headers
ry authored
1 /* Copyright Joyent, Inc. and other Node contributors.
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a
4 * copy of this software and associated documentation files (the
5 * "Software"), to deal in the Software without restriction, including
6 * without limitation the rights to use, copy, modify, merge, publish,
7 * distribute, sublicense, and/or sell copies of the Software, and to permit
8 * persons to whom the Software is furnished to do so, subject to the
9 * following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 * USE OR OTHER DEALINGS IN THE SOFTWARE.
21 */
22
068b733 @ry Land Cantrill's DTrace patch
ry authored
23 /*
24 * This is the DTrace library file for the node provider, which includes
25 * the necessary translators to get from the args[] to something useful.
26 * Be warned: the mechanics here are seriously ugly -- and one must always
27 * keep in mind that clean abstractions often require filthy systems.
28 */
29 #pragma D depends_on library procfs.d
30
31 typedef struct {
32 int32_t fd;
33 int32_t port;
34 uint32_t remote;
e9257b8 @ry New DTrace probes from CA team
ry authored
35 uint32_t buffered;
068b733 @ry Land Cantrill's DTrace patch
ry authored
36 } node_dtrace_connection_t;
37
38 typedef struct {
39 int32_t fd;
40 int32_t port;
41 uint64_t remote;
e9257b8 @ry New DTrace probes from CA team
ry authored
42 uint32_t buffered;
068b733 @ry Land Cantrill's DTrace patch
ry authored
43 } node_dtrace_connection64_t;
44
45 typedef struct {
46 int fd;
47 string remoteAddress;
48 int remotePort;
e9257b8 @ry New DTrace probes from CA team
ry authored
49 int bufferSize;
068b733 @ry Land Cantrill's DTrace patch
ry authored
50 } node_connection_t;
51
52 translator node_connection_t <node_dtrace_connection_t *nc> {
53 fd = *(int32_t *)copyin((uintptr_t)&nc->fd, sizeof (int32_t));
54 remotePort =
55 *(int32_t *)copyin((uintptr_t)&nc->port, sizeof (int32_t));
56 remoteAddress = curpsinfo->pr_dmodel == PR_MODEL_ILP32 ?
57 copyinstr((uintptr_t)*(uint32_t *)copyin((uintptr_t)&nc->remote,
58 sizeof (int32_t))) :
59 copyinstr((uintptr_t)*(uint64_t *)copyin((uintptr_t)
60 &((node_dtrace_connection64_t *)nc)->remote, sizeof (int64_t)));
e9257b8 @ry New DTrace probes from CA team
ry authored
61 bufferSize = curpsinfo->pr_dmodel == PR_MODEL_ILP32 ?
62 *(uint32_t *)copyin((uintptr_t)&nc->buffered, sizeof (int32_t)) :
63 *(uint32_t *)copyin((uintptr_t)
64 &((node_dtrace_connection64_t *)nc)->buffered, sizeof (int32_t));
068b733 @ry Land Cantrill's DTrace patch
ry authored
65 };
66
67 typedef struct {
68 uint32_t url;
69 uint32_t method;
70 } node_dtrace_http_request_t;
71
72 typedef struct {
73 uint64_t url;
74 uint64_t method;
75 } node_dtrace_http_request64_t;
76
77 typedef struct {
78 string url;
79 string method;
80 } node_http_request_t;
81
82 translator node_http_request_t <node_dtrace_http_request_t *nd> {
83 url = curpsinfo->pr_dmodel == PR_MODEL_ILP32 ?
84 copyinstr((uintptr_t)*(uint32_t *)copyin((uintptr_t)&nd->url,
85 sizeof (int32_t))) :
86 copyinstr((uintptr_t)*(uint64_t *)copyin((uintptr_t)
87 &((node_dtrace_http_request64_t *)nd)->url, sizeof (int64_t)));
88 method = curpsinfo->pr_dmodel == PR_MODEL_ILP32 ?
89 copyinstr((uintptr_t)*(uint32_t *)copyin((uintptr_t)&nd->method,
90 sizeof (int32_t))) :
91 copyinstr((uintptr_t)*(uint64_t *)copyin((uintptr_t)
92 &((node_dtrace_http_request64_t *)nd)->method, sizeof (int64_t)));
93 };
Something went wrong with that request. Please try again.