]> sourceware.org Git - systemtap.git/commitdiff
conditionalize pty_write count variable on kernel version
authorTim Moore <timoore@redhat.com>
Mon, 21 Dec 2009 11:31:14 +0000 (12:31 +0100)
committerTim Moore <timoore@redhat.com>
Mon, 21 Dec 2009 11:31:14 +0000 (12:31 +0100)
* testsuite/systemtap.examples/general/grapher.stp: Conditionalize
  pty_write count variable on kernel version.

testsuite/systemtap.examples/general/grapher.stp

index baeeff5c0842f8fa9d07f72ff42d2b98b4dff06f..46f5063c9f5a3c26df7d937000b92473e28dd85e 100755 (executable)
@@ -35,17 +35,18 @@ probe kernel.function("kbd_event") {
 }
 
 probe kernel.function("pty_write") {
-    if ($count > 0) {
-            printf("pty %d ", gettimeofday_ms())
-            str = kernel_string($buf)
-            for (i = 0; i < $count; ++i) {
-                if (i > 1)
-                   printf("\n")
-                # yes it's gross
-                c = substr(str, i, 1)
-                printf("%s", text_str(c))
-            }
-            printf("%c", 0)
+    count = %(kernel_v>="2.6.31" %? $c %: $count %)
+    if (count > 0) {
+        printf("pty %d ", gettimeofday_ms())
+        str = kernel_string($buf)
+        for (i = 0; i < count; ++i) {
+            if (i > 1)
+                printf("\n")
+            # yes it's gross
+            c = substr(str, i, 1)
+            printf("%s", text_str(c))
+        }
+        printf("%c", 0)
     }
 }
 
This page took 0.028809 seconds and 5 git commands to generate.