diff options
| author | Steve Dickson <steved@redhat.com> | 2009-03-17 14:25:20 -0400 |
|---|---|---|
| committer | Steve Dickson <steved@redhat.com> | 2009-03-17 14:25:20 -0400 |
| commit | 797de07cda3e6a2bd654d8d061ea4b56efd90f34 (patch) | |
| tree | b82d118ae5ad1a822a49bffc6a3b6e3198a83e50 | |
| parent | fa68a5ef561a1e642fce79723a9261c5bbb8758b (diff) | |
| download | systemtap-797de07cda3e6a2bd654d8d061ea4b56efd90f34.tar.gz systemtap-797de07cda3e6a2bd654d8d061ea4b56efd90f34.tar.xz systemtap-797de07cda3e6a2bd654d8d061ea4b56efd90f34.zip | |
Added show_all arg to sunrpc-svc
Signed-off-by: Steve Dickson <steved@redhat.com>
| -rw-r--r-- | sunrpc/sunrpc-svc.stp | 122 |
1 files changed, 115 insertions, 7 deletions
diff --git a/sunrpc/sunrpc-svc.stp b/sunrpc/sunrpc-svc.stp index 5de6059..0fb2a06 100644 --- a/sunrpc/sunrpc-svc.stp +++ b/sunrpc/sunrpc-svc.stp @@ -1,4 +1,64 @@ -global rq_prog, rq_vers, rq_proc, rq_prot, sv_name +function svcprog:string(_prog:long) +%{ + static struct { + int prog; + char *string; + } svc_progtbl[] = { + {100000, "rpcbind"}, + {100024, "statd"}, + {100011, "rquotad"}, + {100003, "nfsd"}, + {100021, "nlockmgr"}, + {100005, "mountd"}, + {100227, "nfs_acl"}, + }; + int i; + int tabsz = (sizeof(svc_progtbl)/sizeof(svc_progtbl[0])); + + for (i = 0; i < tabsz; i++) { + if (svc_progtbl[i].prog == THIS->_prog) { + break; + } + } + if (i == tabsz) + snprintf(THIS->__retvalue, MAXSTRINGLEN, "%lld", THIS->_prog); + else + snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", svc_progtbl[i].string); + +%} +function svcerror:string(err:long) +%{ + static struct { + int svcerr; + char *string; + } svc_errtbl[] = { + {1, "SVC_GARBAGE" }, + {2, "SVC_SYSERR" }, + {3, "SVC_VALID" }, + {4, "SVC_NEGATIVE" }, + {5, "SVC_OK" }, + {6, "SVC_DROP" }, + {7, "SVC_DENIED" }, + {8, "SVC_PENDING" }, + {9, "SVC_COMPLETE" }, + }; + int i; + int tabsz = (sizeof(svc_errtbl)/sizeof(svc_errtbl[0])); + + for (i = 0; i < tabsz; i++) { + if (svc_errtbl[i].svcerr == THIS->err) { + break; + } + } + if (i == tabsz) + snprintf(THIS->__retvalue, MAXSTRINGLEN, "svcerr %lld", THIS->err); + else + snprintf(THIS->__retvalue, MAXSTRINGLEN, + "svcderr %d(%s)", svc_errtbl[i].svcerr, svc_errtbl[i].string); + +%} +global rq_prog, rq_vers, rq_proc, rq_prot +global show_all probe module("sunrpc").function("svc_process") { @@ -6,19 +66,67 @@ probe module("sunrpc").function("svc_process") rq_proc = $rqstp->rq_proc rq_vers = $rqstp->rq_vers rq_prog = $rqstp->rq_prog - sv_name = kernel_string($rqstp->rq_server->sv_name) } probe module("sunrpc").function("svc_process").return { if ($return == 0) { printf("%s(%d): svc_process: return %d (%s)\n", - execname(), pid(), $return, errno_str($return)); + execname(), pid(), $return, errno_str($return)); } else if ($return != 0) { - printf("%s(%d): svc_process:%s:%d,%d:%d:%d: bytes %d\n", - execname(), pid(), sv_name, rq_proc,rq_vers, - rq_prot,rq_prog, $return); + if (rq_vers == 4) { + printf("%s(%d): svc_process:%s(%d): bytes %d\n", + execname(), pid(), svcprog(rq_prog), rq_vers, $return); + } else { + printf("%s(%d): svc_process:%s(%d):%d: bytes %d\n", + execname(), pid(), svcprog(rq_prog), rq_vers, + rq_proc, $return); + } + } +} +probe module("sunrpc").function("svc_authenticate") +{ + if (show_all) { + printf("svc_authenticate: rqstp %p authp %p\n", $rqstp, $authp); + } +} +probe module("sunrpc").function("svc_authenticate").return +{ + if (show_all) { + printf("svc_authenticate: return %s\n", svcerror($return)); + } else if ($return != 5) { + printf("svc_authenticate: return %s\n", svcerror($return)); + } +} +probe module("sunrpc").function("svc_recv") +{ + if (show_all) { + printf("svc_recv: rqstp %p timeout %d\n", $rqstp, $timeout); + } +} +probe module("sunrpc").function("svc_recv").return +{ + if (show_all) { + if ($return >= 0) { + printf("svc_recv: bytes %d\n", $return); + } else { + printf("svc_recv: return %d (%s)\n", $return, errno_str($return)); + } + } else if ($return < 0 && $return != -11) { + printf("svc_recv: return %d (%s)\n", $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-svc probe") } -probe begin { log("starting sunrpc-svc probe") } probe end { log("ending sunrpc-svc probe") } |
