1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3# description: Kprobe dynamic event - adding and removing
4
5[ -f kprobe_events ] || exit_unsupported # this is configurable
6
7! grep -q 'myevent' kprobe_profile
8echo p:myevent _do_fork > kprobe_events
9grep -q 'myevent[[:space:]]*0[[:space:]]*0$' kprobe_profile
10echo 1 > events/kprobes/myevent/enable
11( echo "forked" )
12grep -q 'myevent[[:space:]]*[[:digit:]]*[[:space:]]*0$' kprobe_profile
13echo 0 > events/kprobes/myevent/enable
14echo > kprobe_events
15! grep -q 'myevent' kprobe_profile
16