summaryrefslogtreecommitdiffstats
path: root/tapset
diff options
context:
space:
mode:
authorSteve Dickson <steved@redhat.com>2009-12-22 13:51:40 -0500
committerSteve Dickson <steved@redhat.com>2009-12-22 13:51:40 -0500
commit2549149b4588b19c2cbca5b38c7876febb3e0e57 (patch)
tree9dc224442043641fe6b784fe3c45a005bd8348a3 /tapset
parentcb79a3f04253b9cbda91241abadfc59ad8af38cf (diff)
downloadsystemtap-2549149b4588b19c2cbca5b38c7876febb3e0e57.tar.gz
systemtap-2549149b4588b19c2cbca5b38c7876febb3e0e57.tar.xz
systemtap-2549149b4588b19c2cbca5b38c7876febb3e0e57.zip
Added hexdump()
Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'tapset')
-rw-r--r--tapset/svc_cred.stp57
1 files changed, 56 insertions, 1 deletions
diff --git a/tapset/svc_cred.stp b/tapset/svc_cred.stp
index 35e7d4d..a9e698b 100644
--- a/tapset/svc_cred.stp
+++ b/tapset/svc_cred.stp
@@ -1,16 +1,50 @@
%{
+#include <linux/types.h>
+
#include <linux/sunrpc/svc.h>
#include <linux/sunrpc/cache.h>
+
+static void hexdump(char *inbuf, const unsigned char *buf, unsigned short len )
+{
+ static char str[80];
+ char octet[10];
+ int ofs, i, l, cc=0;
+
+ for (ofs = 0; ofs < len; ofs += 16) {
+ sprintf( str, "%03d: ", ofs );
+
+ for (i = 0; i < 16; i++) {
+ if ((i + ofs) < len)
+ sprintf( octet, "%02x ", buf[ofs + i] );
+ else
+ strcpy( octet, " " );
+
+ strcat( str, octet );
+ }
+ strcat( str, " " );
+ l = strlen( str );
+
+ for (i = 0; (i < 16) && ((i + ofs) < len); i++)
+ str[l++] = isprint( buf[ofs + i] ) ? buf[ofs + i] : '.';
+
+ str[l] = '\0';
+ sprintf(inbuf+cc, "%s\n", str );
+ cc = strlen(inbuf);
+ }
+}
+
%}
function svc_creds:string(_rqstp:long)
%{
struct svc_rqst *rqstp =
(struct svc_rqst *)(long) kread(&(THIS->_rqstp));
+ struct kvec *rq_vec;
char buf[MAXSTRINGLEN];
int cc=0;
- sprintf(buf+cc, "cr_uid %d cr_gid %d", rqstp->rq_cred.cr_uid,
+ rq_vec = &rqstp->rq_arg.head[0];
+ sprintf(buf+cc, "cr_uid %d cr_gid %d", rqstp->rq_cred.cr_uid,
rqstp->rq_cred.cr_gid);
cc = strlen(buf);
@@ -18,4 +52,25 @@ function svc_creds:string(_rqstp:long)
CATCH_DEREF_FAULT();
%}
+function svc_rqst:string(_rqstp:long)
+%{
+ struct svc_rqst *rqstp =
+ (struct svc_rqst *)(long) kread(&(THIS->_rqstp));
+ struct kvec *iov;
+ char buf[MAXSTRINGLEN];
+ int cc=0;
+ __be32 flavor;
+
+ iov = &rqstp->rq_arg.head[0];
+ memcpy(&flavor, iov->iov_base, sizeof(flavor));
+ sprintf(buf+cc, "iov_len %ld", iov->iov_len);
+ cc = strlen(buf);
+ /*
+ hexdump(buf+cc, iov->iov_base+sizeof(__be32), 64);
+ */
+
+ snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", buf);
+
+ CATCH_DEREF_FAULT();
+%}