1 #!/bin/sh 2 # SPDX-License-Identifier: GPL-2.0 3 # description: event tracing - restricts events based on pid 4 # requires: set_event set_event_pid events/sched 5 # flags: instance 6 7 do_reset() { 8 echo > set_event 9 echo > set_event_pid 10 echo 0 > options/event-fork 11 clear_trace 12 } 13 14 fail() { #msg 15 do_reset 16 echo $1 17 exit_fail 18 } 19 20 echo 0 > options/event-fork 21 22 echo 1 > events/sched/sched_switch/enable 23 24 yield 25 26 count=`cat trace | grep sched_switch | wc -l` 27 if [ $count -eq 0 ]; then 28 fail "sched_switch events are not recorded" 29 fi 30 31 do_reset 32 33 read mypid rest < /proc/self/stat 34 35 echo $mypid > set_event_pid 36 grep -q $mypid set_event_pid 37 echo 'sched:sched_switch' > set_event 38 39 yield 40 41 count=`cat trace | grep sched_switch | grep -v "pid=$mypid" | wc -l` 42 if [ $count -ne 0 ]; then 43 fail "sched_switch events from other task are recorded" 44 fi 45 46 do_reset 47 48 echo $mypid > set_event_pid 49 echo 1 > options/event-fork 50 echo 1 > events/sched/sched_switch/enable 51 52 yield 53 54 count=`cat trace | grep sched_switch | grep -v "pid=$mypid" | wc -l` 55 if [ $count -eq 0 ]; then 56 fail "sched_switch events from other task are not recorded" 57 fi 58 59 do_reset 60 61 exit 0
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.