probe begin { curr = task_current() // Compare PIDs pid = pid() cast_pid = @cast(curr, "task_struct")->tgid if (pid == cast_pid) println("PID OK") else printf("PID %d != %d\n", pid, cast_pid) // Compare PIDs using a generated kernel module cast_pid = @cast(curr, "task_struct", "kmod")->tgid if (pid == cast_pid) println("PID2 OK") else printf("PID2 %d != %d\n", pid, cast_pid) // Compare execnames name = execname() cast_name = kernel_string(@cast(curr, "task_struct")->comm) if (name == cast_name) println("execname OK") else printf("execname \"%s\" != \"%s\"\n", name, cast_name) // Compare tv_sec using a generated user module sec = 42 cast_sec = @cast(get_timeval(sec), "timeval", "umod")->tv_sec if (sec == cast_sec) println("tv_sec OK") else printf("tv_sec %d != %d\n", sec, cast_sec) exit() } function get_timeval:long(sec:long) %{ static struct timeval mytime = {0}; mytime.tv_sec = THIS->sec; THIS->__retvalue = (long)&mytime; %}