summaryrefslogtreecommitdiffstats
path: root/sunrpc/sunrpc.stp
blob: d94076f54978317e3cf7cd16609f9531f911d5f0 (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
global syn_clnt, syn_msg, syn_flags
global asyn_clnt, asyn_msg, asyn_flags
global show_all

probe module("sunrpc").function("rpc_call_sync")
{
	if (show_all) {
		printf("%s(%d): rpc_call_sync:%s:%s: flags 0x%x\n",
				execname(), pid(), rpcprocname($msg), 
				rpcprogname($clnt), $flags);
	}
	syn_clnt = $clnt;
	syn_msg = $msg;
	syn_flags = $flags;
}
probe module("sunrpc").function("rpc_call_sync").return
{
	if ($return) {
		if (rpcprocnum(syn_msg) != 2 && $return != -2) {
			printf("%s(%d): rpc_call_sync:%s:%s: return %d (%s)\n", 
				execname(), pid(), rpcprocname(syn_msg), rpcprogname(syn_clnt),
				$return, errno_str($return));
		}
	}
}
probe module("sunrpc").function("rpc_call_async")
{
	if (show_all) {
		printf("%s(%d): rpc_call_sync:%s:%s:flags 0x%x\n",
				execname(), pid(), rpcprocname($msg), 
				rpcprogname($clnt), $flags);
	}
	asyn_clnt = $clnt;
	asyn_msg = $msg;
	asyn_flags = $flags;
}
probe module("sunrpc").function("rpc_call_async").return
{
	if ($return) {
		if (rpcprocnum(asyn_msg) != 2 && $return != -2) {
			printf("%s(%d): rpc_call_sync:%s:%s: return %d (%s)\n", 
				execname(), pid(), rpcprocname(syn_msg), rpcprogname(syn_clnt),
				$return, errno_str($return));
		}
	}
}
probe begin 
{ 
	show_all = 0;
	if (argc > 0) {
		if (isinstr(argv[1], "--show_all")) {
			show_all = 1
		} else {
			error("Usage: sunrpc -- --show_all");
		}
	}
	log("starting sunrpc probe")
}
probe end { log("ending sunrpc probe") }