summaryrefslogtreecommitdiffstats
path: root/sunrpc/sunrpc-xprtsock.stp
blob: e070208ff3f2ac84d0c8054e6880b8c9569614ad (plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
 * stap -g -I../tapset  sunrpc-xprtsock.stp
 */
%{
#include <linux/kernel.h>
#include <linux/sunrpc/clnt.h>
#include <linux/sunrpc/svc.h>

struct rpcbind_args {
    struct rpc_xprt *   r_xprt;

    u32         r_prog;
    u32         r_vers;
    u32         r_prot;
    unsigned short      r_port;
    const char *        r_netid;
    const char *        r_addr;
    const char *        r_owner;

    int         r_status;
};
%}

function rpcb_status:long(_rpc:long)
%{
	struct rpcbind_args *rpc = 
		(struct rpcbind_args *)(long) kread(&(THIS->_rpc));

	THIS->__retvalue = rpc->r_status;

	CATCH_DEREF_FAULT();
%}
function rpcb_proc:string(_rpc:long)
%{
	struct rpcbind_args *rpc = 
		(struct rpcbind_args *)(long) kread(&(THIS->_rpc));

	snprintf(THIS->__retvalue, MAXSTRINGLEN, "%d:%d:%d", 
		rpc->r_prog, rpc->r_vers, rpc->r_prot);

	CATCH_DEREF_FAULT();
%}
probe kernel.function("tcp_sendpage").return
{
	if ($return == -107) /* ENOTCONN */
		printf("%s(%d): tcp_sendpage: return %d (%s)\n", 
			execname(), pid(), $return, errno_str($return));
}
probe module("sunrpc").function("xs_sendpages").return
{
	if ($return == -107) /* ENOTCONN */
		printf("%s(%d): xs_sendpages: return %d (%s)\n", 
			execname(), pid(), $return, errno_str($return));
}
probe module("sunrpc").function("xs_send_kvec").return
{
	if ($return == -107) /* ENOTCONN */
		printf("%s(%d): xs_send_kvec: return %d (%s)\n", 
			execname(), pid(), $return, errno_str($return));
}
/*
probe module("sunrpc").function("xs_send_pagedata").return
{
	if ($return == -107)
		printf("%s(%d): xs_send_pagedata: return %d (%s)\n", 
			execname(), pid(), $return, errno_str($return));
}
*/
probe module("sunrpc").function("xs_tcp_send_request").return
{
	if ($return == -107) /* ENOTCONN */
		printf("%s(%d): xs_tcp_send_request: return %d (%s)\n", 
			execname(), pid(), $return, errno_str($return));
}
global rpcb_task
probe module("sunrpc").function("rpcb_getport_async")
{
	rpcb_task = $task
}
probe module("sunrpc").function("rpcb_getport_async").return
{
	if (task_status(rpcb_task))
		printf("%s(%d): rpcb_getport_async: status %d\n", 
			execname(), pid(), task_status(rpcb_task));
}
global rpc_args;
probe module("sunrpc").function("rpcb_getport_done")
{
	if (task_status($child)) 
		printf("%s(%d): rpcb_getport_done: task status %d\n", 
			execname(), pid(), task_status($child));
	rpc_args = $data;
}
probe module("sunrpc").function("rpcb_getport_done").return
{
	if (rpcb_status(rpc_args)) 
		printf("%s(%d): rpcb_getport_done: rpcbind: %s:  status %d\n", 
			execname(), pid(), rpcb_proc(rpc_args), rpcb_status(rpc_args));
}
global xstcp_task
probe module("sunrpc").function("xs_tcp_connect")
{
	xstcp_task = $task
}
probe module("sunrpc").function("xs_tcp_connect").return
{
		if (task_status(xstcp_task))
			printf("%s(%d): xs_tcp_connect: status %d\n", 
				execname(), pid(), task_status(rpcb_task));
}
probe begin { log("starting xprtsock probe") }
probe end { log("ending xprtsock probe") }