1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#! /bin/sh ./stap -p4 -g $@ - <<'END' %{ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) #include <linux/version.h> #else #include <linux/utsrelease.h> #endif %} function get_release () %{ strncpy(THIS->__retvalue, UTS_RELEASE, MAXSTRINGLEN); %} probe begin { log("hello from systemtap, kernel version " . get_release()) } END