summaryrefslogtreecommitdiffstats
path: root/tapset/rpc_clnt.stp
blob: 587a67b638da62dfaf342df9c81e9318fcc412eb (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
%{
#include <linux/sunrpc/sched.h>
#include <linux/sunrpc/clnt.h>
%}
function rpcprocnum:long(_msg:long)
%{
	struct rpc_message *msg = (struct rpc_message *)(long) kread(&(THIS->_msg));
	struct rpc_procinfo *rpc_proc = 
		(struct rpc_procinfo *)(long) kread(&(msg->rpc_proc));

	THIS->__retvalue = rpc_proc->p_proc;

	CATCH_DEREF_FAULT();
%}
function rpcprocname:string(_msg:long)
%{
	struct rpc_message *msg = (struct rpc_message *)(long) kread(&(THIS->_msg));
	struct rpc_procinfo *rpc_proc = 
		(struct rpc_procinfo *)(long) kread(&(msg->rpc_proc));
	char *p_name = kread(&(rpc_proc->p_name));
	char buf[MAXSTRINGLEN];

	snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s(%d)",
		p_name ? p_name : "NULL" , rpc_proc->p_proc);

	CATCH_DEREF_FAULT();
%}
function rpcprogname:string(_clnt:long)
%{
	struct rpc_clnt *clnt = (struct rpc_clnt *)(long) kread(&(THIS->_clnt));
	char *cl_server = kread(&(clnt->cl_server));
	char *cl_protname = kread(&(clnt->cl_protname));
	char buf[MAXSTRINGLEN];

	snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s:%s(%d)",
		cl_server ? cl_server : "NULL" ,
		cl_protname ? cl_protname : "NULL",
		clnt->cl_vers);

	CATCH_DEREF_FAULT();
%}