]> sourceware.org Git - systemtap.git/commitdiff
stapbpf PR22330 WIP :: change exit.stp to send perf_events message
authorSerhei Makarov <smakarov@redhat.com>
Fri, 8 Mar 2019 22:53:48 +0000 (17:53 -0500)
committerSerhei Makarov <smakarov@redhat.com>
Fri, 8 Mar 2019 22:53:48 +0000 (17:53 -0500)
* tapset/bpf/exit.stp (_set_exit_status): comment fix.
(_send_exit_msg): new embedded-code function sending STP_EXIT.
* tapset/logging.stp (exit): switch to using _send_exit_msg.

bpf-internal.h
tapset/bpf/exit.stp
tapset/logging.stp

index 8de9b890b9d362f5887ddf0e82a3236f05c47d05..ec27d26afdbf4faa6de9e5167fa02859daa75e8d 100644 (file)
@@ -383,7 +383,7 @@ struct globals
   // Types of transport messages supported:
   enum perf_event_type
   {
-    STP_EXIT,
+    STP_EXIT = 0,
     STP_PRINTF_START,
     STP_PRINTF_END,
     STP_PRINTF_FORMAT,
index 18d4d843ee448305a2498f88e9f7529c0e545513..d2c98ded4cc3822a47a4f7caf53833afd67a51c1 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * function exit - 
+ * function _set_exit_status - 
  *
  * Description: Set exit flag.
  */
@@ -16,3 +16,16 @@ function _set_exit_status:long ()
     0x85, 0, 0, 0, 2;          /* call bpf_map_update_elem */ 
     0xbf, $$, 0, 0, 0           /* return r0 */
 %}
+
+/**
+ * function _exit
+ *
+ * Description: Send an exit request through perf_events transport.
+ */
+function _send_exit_msg:long ()
+%{ /* bpf */ /* unprivileged */
+    0x118, $perf_events_map, 0, 0, 1; /* BPF_LD_MAP_FD($perf_events_map, map1) */
+    alloc, $data, 8;
+    0x7a, $data, -, -, 0x0;  /* stdw [$data+0], STP_EXIT */
+    call, $$, perf_event_output, $ctx, $perf_events_map, -1, $data, 8;
+%}
index be4a6c4e7b7e1404892b915d90d6cade98f46d81..838123ca7cf727a1c383b2fe99c5d73f9c7adb99 100644 (file)
@@ -69,7 +69,7 @@ function exit ()
 %:
   { /* unprivileged */ /* bpf */
     _set_exit_status()
-    printf("")
+    _send_exit_msg()
   }
 %)
 
This page took 0.028637 seconds and 5 git commands to generate.