]> sourceware.org Git - systemtap.git/commitdiff
linux tapset: new guru-only function raise() to send a signal to current task
authorFrank Ch. Eigler <fche@redhat.com>
Fri, 28 Jun 2013 01:51:40 +0000 (21:51 -0400)
committerFrank Ch. Eigler <fche@redhat.com>
Fri, 28 Jun 2013 01:52:18 +0000 (21:52 -0400)
NEWS
doc/SystemTap_Tapset_Reference/tapsets.tmpl
tapset/linux/guru-signal.stp [new file with mode: 0644]
testsuite/buildok/guru.stp

diff --git a/NEWS b/NEWS
index 3cb60b101e1cba3b796d99d0689c96aab4e025e1..ff9c23e470fb2540a767bd4cd6390f9540f424cc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,9 @@
 
 - The udp.stp tapset adds some ip-address/port variables.
 
+- A new guru-mode-only tapset function raise() is available to send signals
+  to the current task.
+
 - The following tapset functions are deprecated in release 2.3:
   'stap_NFS_CLIENT', '__getfh_inode', '_success_check',
   '_sock_prot_num', '_sock_fam_num', '_sock_state_num',
index e67de507379b4f60db696d4f244c4212ac943f48..f3e0637f27163717d05446a95a0e88ef9cd90711 100644 (file)
     </para>
 !Itapset/linux/guru-delay.stp
 !Itapset/linux/panic.stp
+!Itapset/linux/guru-signal.stp
   </chapter>
 
   <chapter id="string.stp">
diff --git a/tapset/linux/guru-signal.stp b/tapset/linux/guru-signal.stp
new file mode 100644 (file)
index 0000000..654bcd5
--- /dev/null
@@ -0,0 +1,33 @@
+// Copyright (C) 2013 Red Hat Inc.,
+//
+// This file is part of systemtap, and is free software.  You can
+// redistribute it and/or modify it under the terms of the GNU General
+// Public License (GPL); either version 2, or (at your option) any
+// later version.
+//
+
+// <tapsetdescription>
+// Functions in the guru-signal tapset allow a probe handler to queue
+// a user-space signals.  Such operations may only be safe from some 
+// kinds of probe points, therefore are guru-mode only.
+// </tapsetdescription>
+
+
+/**
+ * sfunction raise - raise a signal in the current thread
+ * @signo: signal number
+ *
+ * Description: This function calls the kernel send_sig routine on
+ * the current thread, with the given raw unchecked signal number.
+ * It may raise an error if send_sig() failed.
+ * It requires guru mode.
+ */
+function raise(signo:long) %{
+  /* guru */
+  int rc = send_sig ((int) STAP_ARG_signo, current, 1);
+  if (rc) {
+    snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
+              "raise/send_sig error %d", rc);
+    CONTEXT->last_error = CONTEXT->error_buffer;
+  }
+%}
index 6f34dbf0b51f26013caafb7040b97d48e882681c..be8750de3162cbcb3f171698e8c2c94656439f12 100755 (executable)
@@ -4,4 +4,5 @@ probe begin {
        mdelay(100);
        udelay(-1);
        panic("yo");
+        raise(%{ SIGINT %});
 }
This page took 0.0404 seconds and 5 git commands to generate.