From: Serhei Makarov Date: Fri, 8 Mar 2019 22:53:48 +0000 (-0500) Subject: stapbpf PR22330 WIP :: change exit.stp to send perf_events message X-Git-Tag: release-4.1~66^2~9 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=5e20bfa70cc95da5fa238130c506961e3611d2c3;p=systemtap.git stapbpf PR22330 WIP :: change exit.stp to send perf_events message * 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. --- diff --git a/bpf-internal.h b/bpf-internal.h index 8de9b890b..ec27d26af 100644 --- a/bpf-internal.h +++ b/bpf-internal.h @@ -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, diff --git a/tapset/bpf/exit.stp b/tapset/bpf/exit.stp index 18d4d843e..d2c98ded4 100644 --- a/tapset/bpf/exit.stp +++ b/tapset/bpf/exit.stp @@ -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; +%} diff --git a/tapset/logging.stp b/tapset/logging.stp index be4a6c4e7..838123ca7 100644 --- a/tapset/logging.stp +++ b/tapset/logging.stp @@ -69,7 +69,7 @@ function exit () %: { /* unprivileged */ /* bpf */ _set_exit_status() - printf("") + _send_exit_msg() } %)