summaryrefslogtreecommitdiffstats
path: root/tapset/string.stp
diff options
context:
space:
mode:
authorkevinrs <kevinrs>2005-09-28 00:29:47 +0000
committerkevinrs <kevinrs>2005-09-28 00:29:47 +0000
commit5b328efe93befa4d48774985bd0254560d9c8470 (patch)
tree4ddcacbf30c8a7984e4ca9a3da0c698450834d33 /tapset/string.stp
parent26093a09fc6e336c8a44b8b4076db69ed0c29d00 (diff)
downloadsystemtap-steved-5b328efe93befa4d48774985bd0254560d9c8470.tar.gz
systemtap-steved-5b328efe93befa4d48774985bd0254560d9c8470.tar.xz
systemtap-steved-5b328efe93befa4d48774985bd0254560d9c8470.zip
tapset/mask_string.stp:
wrote a few aux functions that can be used by tapsets to derive a bitmask symbolic string from a given number tapset/string.stp: strlen: Returns the length of the string argument substr: Returns a substring starting at start/ending at stop stapfuncs.5.in: Added a STRING category with aforementioned functions tapset/system_calls.stp Exported more variable for more system calls
Diffstat (limited to 'tapset/string.stp')
-rw-r--r--tapset/string.stp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tapset/string.stp b/tapset/string.stp
new file mode 100644
index 00000000..f6933724
--- /dev/null
+++ b/tapset/string.stp
@@ -0,0 +1,18 @@
+function strlen:long(s:string) %{
+ THIS->__retvalue=strlen(THIS->s);
+%}
+
+function substr:string(str:string,start:long,stop:long) %{
+ int len=strlen(THIS->str);
+ if(THIS->start<0 || THIS->stop<0 ||
+ THIS->start>len || THIS->stop>len ||
+ THIS->start>=THIS->stop)
+ {
+ return;
+ }
+ else {
+ char *s=THIS->str;
+ strncpy(THIS->__retvalue,s+THIS->start,THIS->stop);
+ THIS->__retvalue[THIS->stop]='\0';
+ }
+%}