1#!/bin/sh 2# SPDX-License-Identifier: GPL-2.0 3# description: Generic dynamic event - add/remove eprobe events 4# requires: dynamic_events events/syscalls/sys_enter_openat "e[:[<group>/]<event>] <attached-group>.<attached-event> [<args>]":README 5 6echo 0 > events/enable 7 8clear_dynamic_events 9 10SYSTEM="syscalls" 11EVENT="sys_enter_openat" 12FIELD="filename" 13EPROBE="eprobe_open" 14 15echo "e:$EPROBE $SYSTEM/$EVENT file=+0(\$filename):ustring" >> dynamic_events 16 17grep -q "$EPROBE" dynamic_events 18test -d events/eprobes/$EPROBE 19 20echo 1 > events/eprobes/$EPROBE/enable 21ls 22echo 0 > events/eprobes/$EPROBE/enable 23 24content=`grep '^ *ls-' trace | grep 'file='` 25nocontent=`grep '^ *ls-' trace | grep 'file=' | grep -v -e '"/' -e '"."' -e '(fault)' ` || true 26 27if [ -z "$content" ]; then 28 exit_fail 29fi 30 31if [ ! -z "$nocontent" ]; then 32 exit_fail 33fi 34 35echo "-:$EPROBE" >> dynamic_events 36 37! grep -q "$EPROBE" dynamic_events 38! test -d events/eprobes/$EPROBE 39 40clear_trace 41